Module: GenericFileHelper

Included in:
BatchEditsController
Defined in:
app/helpers/generic_file_helper.rb

Instance Method Summary collapse

Instance Method Details

#add_field(key) ⇒ Object



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

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

#display_title(gf) ⇒ Object



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

def display_title(gf)
  gf.to_s
end

#get_label(key) ⇒ Object



27
28
29
# File 'app/helpers/generic_file_helper.rb', line 27

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

#help_icon(key) ⇒ Object



15
16
17
18
19
20
21
# File 'app/helpers/generic_file_helper.rb', line 15

def help_icon(key)
  link_to '#', id: "generic_file_#{key.to_s}_help", rel: 'popover', 
    'data-content' => (key),
    'data-original-title' => get_label(key) do
       'i', '', class: "icon-question-sign icon-large"
  end
end

#metadata_help(key) ⇒ Object



23
24
25
# File 'app/helpers/generic_file_helper.rb', line 23

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

#render_batch_edit_field_partial(key, locals) ⇒ Object



39
40
41
# File 'app/helpers/generic_file_helper.rb', line 39

def render_batch_edit_field_partial(key, locals)
  render_edit_field_partial_with_action('batch_edit', key, locals)
end

#render_edit_field_partial(key, locals) ⇒ Object



35
36
37
# File 'app/helpers/generic_file_helper.rb', line 35

def render_edit_field_partial(key, locals)
  render_edit_field_partial_with_action('generic_files', key, locals)
end

#render_show_field_partial(key, locals) ⇒ Object



43
44
45
# File 'app/helpers/generic_file_helper.rb', line 43

def render_show_field_partial(key, locals)
  render_show_field_partial_with_action('generic_files', key, locals)
end

#required?(key) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/helpers/generic_file_helper.rb', line 31

def required?(key)
  [:title, :creator, :tag, :rights].include?(key)
end

#subtract_field(key) ⇒ Object



11
12
13
# File 'app/helpers/generic_file_helper.rb', line 11

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