Module: Sufia::RecordsHelperBehavior

Included in:
RecordsHelper
Defined in:
app/helpers/sufia/records_helper_behavior.rb

Instance Method Summary collapse

Instance Method Details

#add_field(key) ⇒ Object



3
4
5
# File 'app/helpers/sufia/records_helper_behavior.rb', line 3

def add_field(key)
  more_or_less_button(key, 'adder', '+')
end

#get_aria_label(key) ⇒ Object



37
38
39
# File 'app/helpers/sufia/records_helper_behavior.rb', line 37

def get_aria_label(key)
  I18n.t("sufia.aria_label.#{key}", default: default_aria_label(key.to_s.humanize))
end

#get_label(key) ⇒ Object



33
34
35
# File 'app/helpers/sufia/records_helper_behavior.rb', line 33

def get_label(key)
  I18n.t("sufia.field_label.#{key}", default: key.to_s.humanize)
end

#help_icon(key, content = nil, title = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/sufia/records_helper_behavior.rb', line 11

def help_icon(key, content = nil, title = nil)
  content = content || (key)
  title = title || get_label(key)
  link_to '#', id: "generic_file_#{key.to_s}_help", rel: 'popover',
          'data-content' => content,
          'data-original-title' => title,
          'aria-label' => get_aria_label(key) do
     'i', '', "aria-hidden" => true, class: "help-icon"
  end
end

#help_icon_modal(modal_id) ⇒ Object



22
23
24
25
26
27
# File 'app/helpers/sufia/records_helper_behavior.rb', line 22

def help_icon_modal(modal_id)
  link_to '#' + modal_id, id: "generic_file_#{modal_id}_help_modal", rel: 'button', 
          data: { toggle: 'modal' }, 'aria-label' => get_aria_label(modal_id) do
     'i', '', "aria-hidden" => true, class: 'help-icon'
  end
end

#metadata_help(key) ⇒ Object



29
30
31
# File 'app/helpers/sufia/records_helper_behavior.rb', line 29

def (key)
  I18n.t("sufia.metadata_help.#{key}", default: key.to_s.humanize)
end

#subtract_field(key) ⇒ Object



7
8
9
# File 'app/helpers/sufia/records_helper_behavior.rb', line 7

def subtract_field(key)
 more_or_less_button(key, 'remover', '-')
end