Sha256: 9e1fbe84cfebe3dda2dda874ba7f4f9791ee618dd72a99f646cdef9a191951fd

Contents?: true

Size: 1.72 KB

Versions: 21

Compression:

Stored size: 1.72 KB

Contents

class RhosyncConsole::Server
  get '/' do
    if params[:xhr] or request.xhr?
      if login_required
        redirect url_path('/loginpage')
      else
        redirect url_path('/homepage')
      end
    else
      @currentpage = "Console" #which page in menu
      if login_required
        @pagetitle = "Login" #H1 title
        @initialcontent = url_path('/loginpage')

        @locals = {
          :div => "main_box",
          :links => [ 
          #  { :url => url_path('/timing/bydevice'), :selected => true, :title => 'By Device' },
          #  { :url => url_path('/timing/bysource'), :title => 'By Source' }
          ]
        }
      else
        @pagetitle = "Rhosync Console" #H1 title
        @initialcontent = url_path('/homepage')

        @locals = {
          :div => "main_box",
          :links => [ 
            { :url => url_path('/homepage'), :selected => true, :title => 'Info' },
            { :url => url_path('/doc/select'), :title => 'Server Document' },
            { :url => url_path('/users'), :title => 'Users' }
          ]
        }
      end
      erb :content
    end
  end
  
  get '/loginpage' do
    erb :login, :layout => false
  end
  
  get '/homepage' do
    @license = nil
    handle_api_error("Can't get license information") do
      @license = RhosyncApi::get_license_info(session[:server],session[:token])
    end
    @sources = nil
    handle_api_error("Can't load list of application partition sources") do
      @sources = RhosyncApi::list_sources(session[:server],session[:token],:app)
    end
    erb :home, :layout => false
  end
  
  get '/reset' do
    handle_api_error("Can't reset server") do
      RhosyncApi::reset(session[:server],session[:token])
    end
    redirect url_path('/'), 303
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
rhosync-2.1.18.beta2 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.18.beta1 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta7 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta6 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta5 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta4 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta3 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta2 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.17.beta1 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.16 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.15 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.14 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.13 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.12 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.11 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.10 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.7 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.6 lib/rhosync/console/app/routes/home.rb
rhosync-2.1.3 lib/rhosync/console/app/routes/home.rb