Show More
Commit Description:
fixed layout problem, for real, using render :layout => ......
Commit Description:
fixed layout problem, for real, using render :layout => ...
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@51 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/helpers/application_helper.rb
| 35 lines
| 1.0 KiB
| text/x-ruby
| RubyLexer
|
|
r0 | # Methods added to this helper will be available to all templates in the application. | ||
module ApplicationHelper | ||||
|
r13 | |||
|
r22 | def user_header | ||
|
r13 | options = '' | ||
user = User.find(session[:user_id]) | ||||
|
r25 | |||
# main page | ||||
|
r13 | options += link_to_unless_current '[Main]', | ||
:controller => 'main', :action => 'list' | ||||
|
r25 | options += ' ' | ||
# admin menu | ||||
|
r27 | if (user!=nil) and (user.admin?) | ||
|
r25 | 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 | ||||
|
r13 | options += link_to_unless_current '[Settings]', | ||
:controller => 'users', :action => 'index' | ||||
|
r25 | options += ' ' | ||
options += | ||||
|
r13 | link_to('[Log out]', {:controller => 'main', :action => 'login'}) | ||
options | ||||
end | ||||
|
r0 | end | ||