Show More
Commit Description:
added user settings...
Commit Description:
added user settings
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@37 6386c4cd-e34a-4fa8-8920-d93eb39b512e
References:
File last commit:
Show/Diff file:
Action:
app/helpers/application_helper.rb
| 24 lines
| 827 B
| text/x-ruby
| RubyLexer
|
|
r0 | # Methods added to this helper will be available to all templates in the application. | ||
module ApplicationHelper | ||||
|
r13 | |||
def user_options | ||||
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 | ||||
options += link_to_unless_current '[Main]', | ||||
:controller => 'main', :action => 'list' | ||||
options += link_to_unless_current '[Settings]', | ||||
:controller => 'users', :action => 'index' | ||||
options = options + ' ' + | ||||
link_to('[Log out]', {:controller => 'main', :action => 'login'}) | ||||
options | ||||
end | ||||
|
r0 | end | ||