2016-02-12 23:52:43 +08:00
|
|
|
module ApplicationHelper
|
2016-07-29 21:47:41 +08:00
|
|
|
def module_page?
|
|
|
|
controller_name == 'my_modules'
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2016-07-29 21:47:41 +08:00
|
|
|
def experiment_page?
|
|
|
|
controller_name == 'experiments'
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
|
|
|
|
2016-07-29 21:47:41 +08:00
|
|
|
def project_page?
|
|
|
|
controller_name == 'projects' ||
|
|
|
|
(controller_name == 'reports' && action_name == 'index')
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|
2016-12-14 20:36:10 +08:00
|
|
|
|
|
|
|
def display_tooltip(message, len = Constants::NAME_TRUNCATION_LENGTH)
|
|
|
|
if message.strip.length > Constants::NAME_TRUNCATION_LENGTH
|
|
|
|
"<div class='modal-tooltip'>#{truncate(message.strip, length: len)} \
|
|
|
|
<span class='modal-tooltiptext'>#{message.strip}</span></div>".html_safe
|
|
|
|
else
|
|
|
|
truncate(message.strip, length: len)
|
|
|
|
end
|
|
|
|
end
|
2016-12-15 00:05:00 +08:00
|
|
|
|
2016-12-12 17:30:03 +08:00
|
|
|
def sample_types_page_project?
|
2016-12-14 17:35:48 +08:00
|
|
|
controller_name == 'sample_types' &&
|
|
|
|
@my_module.nil? &&
|
|
|
|
@experiment.nil?
|
2016-12-12 17:30:03 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def sample_groups_page_project?
|
2016-12-14 17:35:48 +08:00
|
|
|
controller_name == 'sample_groups' &&
|
|
|
|
@my_module.nil? &&
|
|
|
|
@experiment.nil?
|
2016-12-12 17:30:03 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def sample_types_page_my_module?
|
2016-12-14 17:35:48 +08:00
|
|
|
controller_name == 'sample_types' && !@my_module.nil?
|
2016-12-12 17:30:03 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def sample_groups_page_my_module?
|
2016-12-14 17:35:48 +08:00
|
|
|
controller_name == 'sample_groups' && !@my_module.nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def sample_groups_page_experiment?
|
|
|
|
controller_name == 'sample_groups' &&
|
|
|
|
@my_module.nil? &&
|
|
|
|
!@experiment.nil?
|
|
|
|
end
|
|
|
|
|
|
|
|
def sample_types_page_expermient?
|
|
|
|
controller_name == 'sample_types' &&
|
|
|
|
@my_module.nil? &&
|
|
|
|
!@experiment.nil?
|
2016-12-12 17:30:03 +08:00
|
|
|
end
|
2016-02-12 23:52:43 +08:00
|
|
|
end
|