Module: GenericFileHelper

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

Overview

Copyright © 2012 The Pennsylvania State University

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Method Summary collapse

Instance Method Details

#add_field(key) ⇒ Object



21
22
23
# File 'app/helpers/generic_file_helper.rb', line 21

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

#display_title(gf) ⇒ Object



17
18
19
# File 'app/helpers/generic_file_helper.rb', line 17

def display_title(gf)
  gf.to_s
end

#get_label(key) ⇒ Object



41
42
43
# File 'app/helpers/generic_file_helper.rb', line 41

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

#help_icon(key) ⇒ Object



29
30
31
32
33
34
35
# File 'app/helpers/generic_file_helper.rb', line 29

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



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

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

#render_batch_edit_field_partial(key, locals) ⇒ Object



53
54
55
# File 'app/helpers/generic_file_helper.rb', line 53

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



49
50
51
# File 'app/helpers/generic_file_helper.rb', line 49

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



57
58
59
# File 'app/helpers/generic_file_helper.rb', line 57

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

#required?(key) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'app/helpers/generic_file_helper.rb', line 45

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

#subtract_field(key) ⇒ Object



25
26
27
# File 'app/helpers/generic_file_helper.rb', line 25

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