diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -11,12 +11,11 @@ end def login - MainController.layout 'login' + MainController.layout 'empty' reset_session end def list - MainController.layout 'application' @problems = Problem.find_available_problems @prob_submissions = Array.new @user = User.find(session[:user_id]) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -4,19 +4,30 @@ def user_header options = '' user = User.find(session[:user_id]) - if user.admin? - options = options + ' ' + - (link_to_unless_current '[Problem admin]', - :controller => 'problems', :action => 'index') - options = options + ' ' + - (link_to_unless_current '[User admin]', - :controller => 'user_admin', :action => 'index') - end + + # main page options += link_to_unless_current '[Main]', :controller => 'main', :action => 'list' + options += ' ' + + # admin menu + if user.admin? + options += + (link_to_unless_current '[Problem admin]', + :controller => 'problems', :action => 'index') + ' ' + options += + (link_to_unless_current '[User admin]', + :controller => 'user_admin', :action => 'index') + ' ' + options += + (link_to_unless_current '[User stat]', + :controller => 'user_admin', :action => 'user_stat') + ' ' + end + + # general options options += link_to_unless_current '[Settings]', :controller => 'users', :action => 'index' - options = options + ' ' + + options += ' ' + options += link_to('[Log out]', {:controller => 'main', :action => 'login'}) options end diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -6,7 +6,7 @@
<%= flash[:notice] %>
- -<%= yield %> - - - diff --git a/app/views/layouts/user_admin.rhtml b/app/views/layouts/user_admin.rhtml deleted file mode 100644 --- a/app/views/layouts/user_admin.rhtml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - -<%= flash[:notice] %>
- -<%= yield %> - - - diff --git a/app/views/problems/list.rhtml b/app/views/problems/list.rhtml --- a/app/views/problems/list.rhtml +++ b/app/views/problems/list.rhtml @@ -1,3 +1,8 @@ +<% content_for :head do %> + <%= stylesheet_link_tag 'scaffold' %> + <%= javascript_include_tag :defaults %> +<% end %> +