Description:
disabled unused menu items
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r231:4f0fc6ead86a - - 1 file changed: 3 inserted, 3 deleted

@@ -1,80 +1,80
1 # Methods added to this helper will be available to all templates in the application.
1 # Methods added to this helper will be available to all templates in the application.
2 module ApplicationHelper
2 module ApplicationHelper
3
3
4 def user_header
4 def user_header
5 menu_items = ''
5 menu_items = ''
6 user = User.find(session[:user_id])
6 user = User.find(session[:user_id])
7
7
8 if (user!=nil) and (session[:admin])
8 if (user!=nil) and (session[:admin])
9 # admin menu
9 # admin menu
10 menu_items << "<b>Administrative task:</b> "
10 menu_items << "<b>Administrative task:</b> "
11 append_to menu_items, '[Announcements]', 'announcements', 'index'
11 append_to menu_items, '[Announcements]', 'announcements', 'index'
12 append_to menu_items, '[Msg console]', 'messages', 'console'
12 append_to menu_items, '[Msg console]', 'messages', 'console'
13 append_to menu_items, '[Problems]', 'problems', 'index'
13 append_to menu_items, '[Problems]', 'problems', 'index'
14 append_to menu_items, '[Users]', 'user_admin', 'index'
14 append_to menu_items, '[Users]', 'user_admin', 'index'
15 append_to menu_items, '[Results]', 'user_admin', 'user_stat'
15 append_to menu_items, '[Results]', 'user_admin', 'user_stat'
16 append_to menu_items, '[Graders]', 'graders', 'list'
16 append_to menu_items, '[Graders]', 'graders', 'list'
17 append_to menu_items, '[Contests]', 'contests', 'index'
17 append_to menu_items, '[Contests]', 'contests', 'index'
18 append_to menu_items, '[Sites]', 'sites', 'index'
18 append_to menu_items, '[Sites]', 'sites', 'index'
19 append_to menu_items, '[System config]', 'configurations', 'index'
19 append_to menu_items, '[System config]', 'configurations', 'index'
20 menu_items << "<br/>"
20 menu_items << "<br/>"
21 end
21 end
22
22
23 # main page
23 # main page
24 append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list'
24 append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list'
25 append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list'
25 append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list'
26
26
27 if (user!=nil) and (Configuration.show_tasks_to?(user))
27 if (user!=nil) and (Configuration.show_tasks_to?(user))
28 append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list'
28 append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list'
29 - append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission'
29 + #append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission'
30 - append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index'
30 + #append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index'
31 end
31 end
32 - append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help'
32 + #append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help'
33
33
34 if Configuration['system.user_setting_enabled']
34 if Configuration['system.user_setting_enabled']
35 append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index'
35 append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index'
36 end
36 end
37 append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login'
37 append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login'
38
38
39 menu_items
39 menu_items
40 end
40 end
41
41
42 def append_to(option,label, controller, action)
42 def append_to(option,label, controller, action)
43 option << ' ' if option!=''
43 option << ' ' if option!=''
44 option << link_to_unless_current(label,
44 option << link_to_unless_current(label,
45 :controller => controller,
45 :controller => controller,
46 :action => action)
46 :action => action)
47 end
47 end
48
48
49 def format_short_time(time)
49 def format_short_time(time)
50 now = Time.now.gmtime
50 now = Time.now.gmtime
51 st = ''
51 st = ''
52 if (time.yday != now.yday) or
52 if (time.yday != now.yday) or
53 (time.year != now.year)
53 (time.year != now.year)
54 st = time.strftime("%x ")
54 st = time.strftime("%x ")
55 end
55 end
56 st + time.strftime("%X")
56 st + time.strftime("%X")
57 end
57 end
58
58
59 def format_short_duration(duration)
59 def format_short_duration(duration)
60 return '' if duration==nil
60 return '' if duration==nil
61 d = duration.to_f
61 d = duration.to_f
62 return Time.at(d).gmtime.strftime("%X")
62 return Time.at(d).gmtime.strftime("%X")
63 end
63 end
64
64
65 def read_textfile(fname,max_size=2048)
65 def read_textfile(fname,max_size=2048)
66 begin
66 begin
67 File.open(fname).read(max_size)
67 File.open(fname).read(max_size)
68 rescue
68 rescue
69 nil
69 nil
70 end
70 end
71 end
71 end
72
72
73 def user_title_bar(user)
73 def user_title_bar(user)
74 header = ''
74 header = ''
75 time_left = ''
75 time_left = ''
76
76
77 #
77 #
78 # if the contest is over
78 # if the contest is over
79 if Configuration.time_limit_mode?
79 if Configuration.time_limit_mode?
80 if user.contest_finished?
80 if user.contest_finished?
You need to be logged in to leave comments. Login now