Sha256: 145f87fd01aeb69299f204c5c80096eb5b42b6a3bb4280be9da527742b086dee

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

module Databases
  
  # ---------------------------------------------------------------------------  
  get "/databases/:page" do
    page       = params[:page].to_i || 1
    path_names = session[:path_names]
          
    @cltns     = options.connection.paginate_db( path_names, page, 10 )
    @back_url  = "/explore/back"
    
    erb :'databases/list'
  end
  
  # ---------------------------------------------------------------------------
  get "/databases/collection/:name/" do
    cltn_name  = params[:name]
    path_names = session[:path_names]
    path_ids   = session[:path_ids]
    
    update_paths!( path_ids + "|" + cltn_name, path_names + "|" + cltn_name )

    redirect "/collections/1"
  end
      
  # ---------------------------------------------------------------------------  
  get "/databases/drop/" do
    path_names = session[:path_names]
    options.connection.drop_db( path_names )
    
    redirect "/explore/back"
  end

  # ---------------------------------------------------------------------------  
  post "/databases/delete/" do
    path = params[:path]    
 
    options.connection.drop_cltn( session[:path_names] + "|" + path )
    
    flash_it!( :info, "Collection #{path} was dropped successfully!" )        
    
    @cltns = options.connection.paginate_db( session[:path_names], 1, 10 )    
  
    erb :'databases/results.js', :layout => false
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongo3-0.0.9 lib/controllers/databases.rb
mongo3-0.0.8 lib/controllers/databases.rb
mongo3-0.0.7 lib/controllers/databases.rb
mongo3-0.0.6 lib/controllers/databases.rb