scinote-web/app/helpers/secondary_navigation_helper.rb

67 lines
1.1 KiB
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
module SecondaryNavigationHelper
def is_all_projects_index?
action_name == 'index'
end
def is_all_projects_archive?
action_name == 'archive'
end
2016-02-12 23:52:43 +08:00
def is_project_info?
2016-07-29 22:46:25 +08:00
action_name == 'show'
2016-02-12 23:52:43 +08:00
end
2016-07-29 22:20:35 +08:00
def is_project_show?
2016-07-29 22:46:25 +08:00
action_name == 'show'
2016-02-12 23:52:43 +08:00
end
def is_project_reports?
2016-07-29 22:48:56 +08:00
controller_name == 'reports' && action_name == 'index'
2016-02-12 23:52:43 +08:00
end
def is_project_archive?
2016-07-29 22:46:25 +08:00
action_name == 'experiment_archive'
2016-07-29 22:20:35 +08:00
end
def is_experiment_canvas?
2016-07-29 22:46:25 +08:00
action_name == 'canvas'
2016-07-29 22:20:35 +08:00
end
def is_experiment_archive?
2016-07-29 22:46:25 +08:00
action_name == 'module_archive'
2016-02-12 23:52:43 +08:00
end
def is_module_info?
2016-07-29 22:46:25 +08:00
action_name == 'show'
2016-02-12 23:52:43 +08:00
end
2016-07-21 19:11:15 +08:00
def is_module_protocols?
%w(protocols my_module_protocol_show).include?(action_name)
2016-02-12 23:52:43 +08:00
end
def is_module_results?
2016-07-29 22:46:25 +08:00
action_name == 'results'
2016-02-12 23:52:43 +08:00
end
def is_module_activities?
2016-07-29 22:46:25 +08:00
action_name == 'activities'
2016-02-12 23:52:43 +08:00
end
def is_module_archive?
2016-07-29 22:46:25 +08:00
action_name == 'archive'
2016-02-12 23:52:43 +08:00
end
2018-04-19 21:12:26 +08:00
def title_element
if all_projects_page?
current_team
elsif project_page?
2018-04-19 21:12:26 +08:00
@project
elsif experiment_page?
@experiment
elsif module_page?
@my_module
end
end
2016-02-12 23:52:43 +08:00
end