Commit 9d318db48f4d76b8493aefa80e7b29c2ea3cc1cf
Committed by
Dmitriy Zaporozhets
1 parent
29847168
Exists in
master
and in
4 other branches
Added the correct hierarchy of controllers for the administrative part
Showing
11 changed files
with
20 additions
and
20 deletions
Show diff stats
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +# Provides a base class for Admin controllers to subclass | ||
2 | +# | ||
3 | +# Automatically sets the layout and ensures an administrator is logged in | ||
4 | +class Admin::ApplicationController < ApplicationController | ||
5 | + layout 'admin' | ||
6 | + before_filter :authenticate_admin! | ||
7 | + | ||
8 | + def authenticate_admin! | ||
9 | + return render_404 unless current_user.is_admin? | ||
10 | + end | ||
11 | +end |
app/controllers/admin/dashboard_controller.rb
1 | -class Admin::DashboardController < AdminController | 1 | +class Admin::DashboardController < Admin::ApplicationController |
2 | def index | 2 | def index |
3 | @projects = Project.order("created_at DESC").limit(10) | 3 | @projects = Project.order("created_at DESC").limit(10) |
4 | @users = User.order("created_at DESC").limit(10) | 4 | @users = User.order("created_at DESC").limit(10) |
app/controllers/admin/groups_controller.rb
1 | -class Admin::GroupsController < AdminController | 1 | +class Admin::GroupsController < Admin::ApplicationController |
2 | before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :project_teams_update] | 2 | before_filter :group, only: [:edit, :show, :update, :destroy, :project_update, :project_teams_update] |
3 | 3 | ||
4 | def index | 4 | def index |
app/controllers/admin/hooks_controller.rb
app/controllers/admin/logs_controller.rb
app/controllers/admin/projects_controller.rb
1 | -class Admin::ProjectsController < AdminController | 1 | +class Admin::ProjectsController < Admin::ApplicationController |
2 | before_filter :project, only: [:edit, :show, :update, :destroy, :team_update] | 2 | before_filter :project, only: [:edit, :show, :update, :destroy, :team_update] |
3 | 3 | ||
4 | def index | 4 | def index |
app/controllers/admin/resque_controller.rb
app/controllers/admin/team_members_controller.rb
app/controllers/admin/teams_controller.rb
1 | -class Admin::TeamsController < AdminController | 1 | +class Admin::TeamsController < Admin::ApplicationController |
2 | before_filter :user_team, | 2 | before_filter :user_team, |
3 | only: [ :edit, :show, :update, :destroy, | 3 | only: [ :edit, :show, :update, :destroy, |
4 | :delegate_projects, :relegate_project, | 4 | :delegate_projects, :relegate_project, |
app/controllers/admin/users_controller.rb
1 | -class Admin::UsersController < AdminController | 1 | +class Admin::UsersController < Admin::ApplicationController |
2 | def index | 2 | def index |
3 | @admin_users = User.scoped | 3 | @admin_users = User.scoped |
4 | @admin_users = @admin_users.filter(params[:filter]) | 4 | @admin_users = @admin_users.filter(params[:filter]) |
app/controllers/admin_controller.rb
@@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
1 | -# Provides a base class for Admin controllers to subclass | ||
2 | -# | ||
3 | -# Automatically sets the layout and ensures an administrator is logged in | ||
4 | -class AdminController < ApplicationController | ||
5 | - layout 'admin' | ||
6 | - before_filter :authenticate_admin! | ||
7 | - | ||
8 | - def authenticate_admin! | ||
9 | - return render_404 unless current_user.is_admin? | ||
10 | - end | ||
11 | -end |