Sha256: 6b5633499ce704009f89271b207175f686fe206735d8d2bb4761731160352cae
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module Users # --------------------------------------------------------------------------- # Paginate top users get "/users/:page" do page = params[:page] ? params[:page].to_i : 1 puts "User filter", @filter.inspect elapsed = Benchmark.realtime do @users = Wackamole::User.paginate_tops( @filter.to_conds, page ) end puts "Find users %5.4f" % elapsed @search_path = "/users/search" @filter_path = "/users/filter" if request.xhr? erb :'users/index.js', :layout => false else erb :'users/index' end end # --------------------------------------------------------------------------- # search users post "/users/search" do begin @filter.search_terms = params[:search_filter][:search_terms] @users = Wackamole::User.paginate_tops( @filter.to_conds ) rescue => boom logger.error boom flash[:error] = boom @users = [].paginate end erb :"users/filter.js", :layout => false end # --------------------------------------------------------------------------- # Filter post "/users/filter" do @filter.from_options( params[:filter] ) session[:filter] = @filter puts "Setting user filter #{session[:filter].inspect}" @users = Wackamole::User.paginate_tops( @filter.to_conds ) erb :"users/filter.js", :layout => false end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wackamole-0.0.6 | lib/controllers/users.rb |
wackamole-0.0.5 | lib/controllers/users.rb |
wackamole-0.0.4 | lib/controllers/users.rb |