scinote-web/app/helpers/search_helper.rb

36 lines
1,007 B
Ruby
Raw Normal View History

2016-02-12 23:52:43 +08:00
module SearchHelper
def experiments_results(tag)
experiments = []
tag.my_modules.each do |mod|
experiments << mod.experiment
end
experiments.uniq
end
2016-10-11 22:16:48 +08:00
def route_to_other_team(path, search_team, text, html = {})
if search_team != current_team
2016-10-11 22:16:48 +08:00
link_to text,
path,
html.merge(
data: { turbolinks: false,
confirm: t('users.settings.changed_team_in_search',
team: search_team.name) }
)
2016-10-11 22:16:48 +08:00
else
link_to text, path, html.merge(data: { turbolinks: false })
2016-10-11 22:16:48 +08:00
end
end
2017-01-06 17:10:33 +08:00
def route_to_other_team_btn(path, search_team, text)
if search_team != current_team
2017-01-06 17:10:33 +08:00
link_to text,
path,
2020-01-07 23:13:34 +08:00
class: 'btn btn-primary',
data: { confirm: t('users.settings.changed_team_in_search',
team: search_team.name) }
2017-01-06 17:10:33 +08:00
else
2020-01-07 23:13:34 +08:00
link_to text, path, class: 'btn btn-primary'
2017-01-06 17:10:33 +08:00
end
end
2016-02-12 23:52:43 +08:00
end