Sha256: 2288717ebaad7a911dd4edcfbffd7c07be78f2a2c251d8a90e6015b01958724c
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
module Sufia module RecordsHelperBehavior def add_field(key) more_or_less_button(key, 'adder', '+') end def subtract_field(key) more_or_less_button(key, 'remover', '-') end def help_icon(key, content = nil, title = nil) content = content || metadata_help(key) title = title || get_label(key) link_to '#', id: "generic_file_#{key.to_s}_help", rel: 'popover', 'data-content' => content, 'data-original-title' => title do content_tag 'i', '', class: "glyphicon glyphicon-question-sign large-icon" end end def help_icon_modal(modal_id) link_to '#' + modal_id, id: "generic_file_#{modal_id}_help_modal", rel: 'button', data: { toggle: 'modal' } do content_tag 'i', '', class: 'glyphicon glyphicon-question-sign large-icon' end end def metadata_help(key) I18n.t("sufia.metadata_help.#{key}", default: key.to_s.humanize) end def get_label(key) I18n.t("sufia.field_label.#{key}", default: key.to_s.humanize) end private def more_or_less_button(key, html_class, symbol) # TODO, there could be more than one element with this id on the page, but the fuctionality doesn't work without it. content_tag('button', class: "#{html_class} btn", id: "additional_#{key}_submit", name: "additional_#{key}") do (symbol + content_tag('span', class: 'sr-only') do "add another #{key.to_s}" end).html_safe end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sufia-4.0.0.rc2 | app/helpers/sufia/records_helper_behavior.rb |