rosa-build/app/helpers/advisories_helper.rb

22 lines
685 B
Ruby
Raw Normal View History

module AdvisoriesHelper
2014-01-21 04:51:49 +00:00
def advisories_select_options(advisories, opts = {class: 'popoverable'})
def_values = [[t("layout.advisories.no_"), 'no'], [t("layout.advisories.new"), 'new'], [t("layout.advisories.existing"), 'existing', {class: 'advisory_id'}]]
options_for_select(def_values, def_values.first)
end
def advisory_id_for_hint
2014-01-21 04:51:49 +00:00
sprintf(Advisory::ID_STRING_TEMPLATE, type: "{#{Advisory::TYPES.values.join(',')}}",
year: 'YYYY', id: 'XXXX')
end
def construct_ref_link(ref)
ref = sanitize(ref)
url = if ref =~ %r[^http(s?)://*]
ref
else
'http://' << ref
end
link_to url, url
end
end