mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-25 02:31:19 +00:00
Rescue from AccessError with pretty and informative error page
Add pagination to teams page
This commit is contained in:
parent
77c50dfe6b
commit
769fc29da7
8 changed files with 24 additions and 20 deletions
|
@ -12,7 +12,6 @@ header .banner {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
img {
|
img {
|
||||||
width: em(430);
|
|
||||||
height: em(200);
|
height: em(200);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: em(20);
|
top: em(20);
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#teams {
|
#teams {
|
||||||
|
@include span-columns(12);
|
||||||
|
|
||||||
table {
|
table {
|
||||||
table-layout: auto;
|
table-layout: auto;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
|
include Exceptions
|
||||||
|
|
||||||
helper :all
|
helper :all
|
||||||
helper_method :cuser, :strip, :return_here
|
helper_method :cuser, :strip, :return_here
|
||||||
|
|
||||||
|
@ -8,10 +10,6 @@ class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery
|
protect_from_forgery
|
||||||
respond_to :html, :js
|
respond_to :html, :js
|
||||||
|
|
||||||
include Exceptions
|
|
||||||
|
|
||||||
# Global methods
|
|
||||||
|
|
||||||
def cuser
|
def cuser
|
||||||
@cuser ||= User.find(session[:user]) if session[:user]
|
@cuser ||= User.find(session[:user]) if session[:user]
|
||||||
end
|
end
|
||||||
|
@ -37,20 +35,19 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_to_home
|
def redirect_to_home
|
||||||
redirect_to :controller => "articles", :action => "news_index"
|
redirect_to controller: "articles", action: "news_index"
|
||||||
end
|
end
|
||||||
|
|
||||||
def rescue_action(exception)
|
rescue_from AccessError do |exception|
|
||||||
case exception
|
render 'errors/403', status: 403, layout: 'errors'
|
||||||
when AccessError
|
end
|
||||||
render :text => t(:access_denied), :layout => true
|
|
||||||
when Error
|
rescue_from Error do |exception|
|
||||||
render :text => exception.message, :layout => true
|
render text: exception.message, layout: true
|
||||||
when ActiveRecord::StaleObjectError
|
end
|
||||||
render :text => t(:application_stale)
|
|
||||||
else
|
rescue_from ActiveRecord::StaleObjectError do |exception|
|
||||||
super exception
|
render text: t(:application_stale)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -2,7 +2,7 @@ class TeamsController < ApplicationController
|
||||||
before_filter :get_team, only: [:show, :edit, :update, :destroy, :recover]
|
before_filter :get_team, only: [:show, :edit, :update, :destroy, :recover]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@teams = Team.search(params[:search]).paginate(per_page: 40, page: params[:page]).with_teamers_num(0).ordered
|
@teams = Team.with_teamers_num(0).search(params[:search]).paginate(per_page: 80, page: params[:page]).ordered
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<h1>Current Contests</h1>
|
<h1 class="title">Current Contests</h1>
|
||||||
|
|
||||||
<% @contests.each do |contest| %>
|
<% @contests.each do |contest| %>
|
||||||
<h3><%= link_to contest.name, contest %></h3>
|
<h3><%= link_to contest.name, contest %></h3>
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= will_paginate @teams %>
|
||||||
|
|
||||||
<div id="teams">
|
<div id="teams">
|
||||||
<%= render partial: 'list', locals: { teams: @teams } %>
|
<%= render partial: 'list', locals: { teams: @teams } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%= will_paginate @teams %>
|
|
@ -13,6 +13,8 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= will_paginate @users %>
|
||||||
|
|
||||||
<table id="users" class="striped">
|
<table id="users" class="striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="country"></th>
|
<th class="country"></th>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
set :branch, 'develop'
|
set :branch, 'feature-redesign'
|
||||||
set :deploy_to, '/var/www/virtual/ensl.org/staging/rails'
|
set :deploy_to, '/var/www/virtual/ensl.org/staging/rails'
|
||||||
|
|
||||||
set :rails_env, 'staging'
|
set :rails_env, 'staging'
|
||||||
|
|
Loading…
Reference in a new issue