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 @@ -2,8 +2,6 @@ before_filter :authenticate, :except => [:index, :login] - layout 'application' - verify :method => :post, :only => [:submit], :redirect_to => { :action => :index } @@ -13,8 +11,8 @@ end def login - MainController.layout 'empty' reset_session + render :action => 'login', :layout => 'empty' end def list 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 @@ -11,7 +11,7 @@ options += ' ' # admin menu - if user.admin? + if (user!=nil) and (user.admin?) options += (link_to_unless_current '[Problem admin]', :controller => 'problems', :action => 'index') + ' ' diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,22 @@ + + + +
+ +<%= flash[:notice] %>
+ +<%= yield %> + + + diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml deleted file mode 100644 --- a/app/views/layouts/application.rhtml +++ /dev/null @@ -1,22 +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 @@ -9,6 +9,8 @@ <%= link_to 'Main', :controller => 'main', :action => 'list' %> +<%= link_to 'New problem', :action => 'new' %>Name |
---|