Module: NamespacesHelper

Defined in:
app/helpers/namespaces_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) namespace_autocomplete_tag(namespace)



8
9
10
11
12
13
14
15
16
# File 'app/helpers/namespaces_helper.rb', line 8

def namespace_autocomplete_tag(namespace)
  return nil if namespace.nil?
  a = [
    (namespace.institution.blank? ? nil : ( [(:span, namespace.institution, class: :subtle), '<br>'].join.html_safe  )),
    namespace.short_name,
    (namespace.verbatim_short_name.blank? ? nil : (:span, '[' + namespace.verbatim_short_name + ']', class: :warning ).html_safe ),
    (:span, namespace.name,  class: :subtle )
  ].compact.join(' ').html_safe
end

- (Object) namespace_from_identifier_tag(identifier)



27
28
29
30
31
32
33
# File 'app/helpers/namespaces_helper.rb', line 27

def namespace_from_identifier_tag(identifier)
  if identifier.respond_to?(:namespace)
    namespace_tag(identifier.namespace)
  else
    nil
  end
end


18
19
20
21
# File 'app/helpers/namespaces_helper.rb', line 18

def namespace_link(namespace)
  return nil if namespace.nil?
  link_to(namespace_tag(namespace).html_safe, namespace)
end

- (Object) namespace_select_tag(namespace_element)



35
36
37
38
39
# File 'app/helpers/namespaces_helper.rb', line 35

def namespace_select_tag(namespace_element)
  select_tag(namespace_element,
             options_for_select(Namespace.pluck(:short_name).uniq),
             prompt: 'Select a namespace')
end

- (Object) namespace_tag(namespace)



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

def namespace_tag(namespace)
  return nil if namespace.nil? || !namespace.persisted?
  namespace.short_name + ': ' + namespace.name
end

- (Object) namespaces_search_form



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

def namespaces_search_form
  render('/namespaces/quick_search_form')
end