Module: ApplicationHelper
- Defined in:
- app/helpers/application_helper.rb
Instance Method Summary collapse
- #bootstrap_navigation_element(name, path, options = {}) ⇒ Object
- #classify_for_display(curation_concern) ⇒ Object
- #construct_page_title(*elements) ⇒ Object
- #curation_concern_attribute_to_html(curation_concern, method_name, label, options = {}) ⇒ Object
- #curation_concern_page_title(curation_concern) ⇒ Object
- #default_page_title ⇒ Object
- #link_to_edit_permissions(curation_concern, solr_document = nil) ⇒ Object
- #permission_badge_for(curation_concern, solr_document = nil) ⇒ Object
-
#sufia ⇒ Object
This is included to hopefully catch most of the sufia method calls that are vestigal for the Sufia engine being included in the Gemfile but unmounted.
Instance Method Details
#bootstrap_navigation_element(name, path, options = {}) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'app/helpers/application_helper.rb', line 47 def (name, path, = {}) = .delete(:a_tag_options) || {} path_to_use = path if current_page? path [:class] ||= '' [:class] << ' active' [:tabindex] ||= :'-1' path_to_use = '#' end content_tag('li', ) { link_to name, path_to_use, }.html_safe end |
#classify_for_display(curation_concern) ⇒ Object
43 44 45 |
# File 'app/helpers/application_helper.rb', line 43 def classify_for_display(curation_concern) curation_concern.human_readable_type.downcase end |
#construct_page_title(*elements) ⇒ Object
10 11 12 |
# File 'app/helpers/application_helper.rb', line 10 def construct_page_title(*elements) (elements.flatten.compact + [application_name]).join(" // ") end |
#curation_concern_attribute_to_html(curation_concern, method_name, label, options = {}) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/helpers/application_helper.rb', line 31 def curation_concern_attribute_to_html(curation_concern, method_name, label, = {}) markup = "" subject = curation_concern.send(method_name) return markup if !subject.present? && ![:include_empty] markup << %(<tr><th>#{label}</th>\n<td><ul class='tabular'>) [subject].flatten.compact.each do |value| markup << %(<li class="attribute #{method_name}">#{h(value)}</li>\n) end markup << %(</ul></td></tr>) markup.html_safe end |
#curation_concern_page_title(curation_concern) ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/helpers/application_helper.rb', line 14 def curation_concern_page_title(curation_concern) if curation_concern.persisted? construct_page_title(curation_concern.title, "#{curation_concern.human_readable_type} [#{curation_concern.to_param}]") else construct_page_title("New #{curation_concern.human_readable_type}") end end |
#default_page_title ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/helpers/application_helper.rb', line 22 def default_page_title text = controller_name.singularize.titleize if action_name text = "#{action_name.titleize} " + text end construct_page_title(text) end |
#link_to_edit_permissions(curation_concern, solr_document = nil) ⇒ Object
61 62 63 64 65 66 67 68 |
# File 'app/helpers/application_helper.rb', line 61 def (curation_concern, solr_document = nil) markup = <<-HTML <a href="#{edit_polymorphic_path([:curation_concern, curation_concern])}" id="permission_#{curation_concern.to_param}"> #{(curation_concern, solr_document)} </a> HTML markup.html_safe end |
#permission_badge_for(curation_concern, solr_document = nil) ⇒ Object
70 71 72 73 74 |
# File 'app/helpers/application_helper.rb', line 70 def (curation_concern, solr_document = nil) solr_document ||= curation_concern.to_solr dom_label_class, link_title = extract_dom_label_class_and_link_title(solr_document) %(<span class="label #{dom_label_class}" title="#{link_title}">#{link_title}</span>).html_safe end |
#sufia ⇒ Object
This is included to hopefully catch most of the sufia method calls that are vestigal for the Sufia engine being included in the Gemfile but unmounted.
6 7 8 |
# File 'app/helpers/application_helper.rb', line 6 def sufia self end |