Module: GenericFileHelper
- Included in:
- BatchEditsController, BatchUpdateJob
- 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
- #add_field(key) ⇒ Object
- #display_title(gf) ⇒ Object
- #get_label(key) ⇒ Object
- #help_icon(key) ⇒ Object
- #metadata_help(key) ⇒ Object
- #render_batch_edit_field_partial(key, locals) ⇒ Object
- #render_edit_field_partial(key, locals) ⇒ Object
- #required?(key) ⇒ Boolean
- #subtract_field(key) ⇒ Object
Instance Method Details
#add_field(key) ⇒ Object
24 25 26 |
# File 'app/helpers/generic_file_helper.rb', line 24 def add_field (key) (key, 'adder', '+') end |
#display_title(gf) ⇒ Object
17 18 19 20 21 22 |
# File 'app/helpers/generic_file_helper.rb', line 17 def display_title(gf) title = gf.title.join(' | ') title = gf.label if title.blank? title = 'No Title' if title.blank? title end |
#get_label(key) ⇒ Object
44 45 46 |
# File 'app/helpers/generic_file_helper.rb', line 44 def get_label(key) I18n.t("sufia.field_label.#{key}", default: key.to_s.humanize) end |
#help_icon(key) ⇒ Object
32 33 34 35 36 37 38 |
# File 'app/helpers/generic_file_helper.rb', line 32 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 content_tag 'i', '', class: "icon-question-sign icon-large" end end |
#metadata_help(key) ⇒ Object
40 41 42 |
# File 'app/helpers/generic_file_helper.rb', line 40 def (key) I18n.t("sufia.metadata_help.#{key}", default: key.to_s.humanize) end |
#render_batch_edit_field_partial(key, locals) ⇒ Object
56 57 58 |
# File 'app/helpers/generic_file_helper.rb', line 56 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
52 53 54 |
# File 'app/helpers/generic_file_helper.rb', line 52 def render_edit_field_partial(key, locals) render_edit_field_partial_with_action('generic_files', key, locals) end |
#required?(key) ⇒ Boolean
48 49 50 |
# File 'app/helpers/generic_file_helper.rb', line 48 def required?(key) [:title, :creator, :tag, :rights].include?(key) end |
#subtract_field(key) ⇒ Object
28 29 30 |
# File 'app/helpers/generic_file_helper.rb', line 28 def subtract_field (key) (key, 'remover', '-') end |