[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/libraries/jquery/defunkt-jquery-pjax/test/ -> app.rb (source)

   1  require 'sinatra'
   2  require 'json'
   3  
   4  set :public_folder, settings.root
   5  enable :static
   6  
   7  helpers do
   8    def pjax?
   9      env['HTTP_X_PJAX'] && !params[:layout]
  10    end
  11  
  12    def title(str)
  13      if pjax?
  14        "<title>#{str}</title>"
  15      else
  16        @title = str
  17        nil
  18      end
  19    end
  20  end
  21  
  22  after do
  23    if pjax?
  24      response.headers['X-PJAX-URL'] = request.url
  25    end
  26  end
  27  
  28  
  29  get '/' do
  30    erb :qunit
  31  end
  32  
  33  get '/jquery.pjax.js' do
  34    send_file "#{settings.root}/../jquery.pjax.js"
  35  end
  36  
  37  get '/test/:file' do
  38    send_file "#{settings.root}/../test/#{params[:file]}"
  39  end
  40  
  41  get '/env.html' do
  42    erb :env, :layout => !pjax?
  43  end
  44  
  45  post '/env.html' do
  46    erb :env, :layout => !pjax?
  47  end
  48  
  49  put '/env.html' do
  50    erb :env, :layout => !pjax?
  51  end
  52  
  53  delete '/env.html' do
  54    erb :env, :layout => !pjax?
  55  end
  56  
  57  get '/redirect.html' do
  58    redirect "/hello.html"
  59  end
  60  
  61  get '/timeout.html' do
  62    if pjax?
  63      sleep 1
  64      erb :timeout, :layout => false
  65    else
  66      erb :timeout
  67    end
  68  end
  69  
  70  get '/boom.html' do
  71    status 500
  72    erb :boom, :layout => !pjax?
  73  end
  74  
  75  get '/:page.html' do
  76    erb :"#{params[:page]}", :layout => !pjax?
  77  end


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1