Module: Zizia::ApplicationHelper

Defined in:
app/helpers/zizia/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#collections?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'app/helpers/zizia/application_helper.rb', line 30

def collections?
  !ActiveFedora::SolrService.query('has_model_ssim:Collection').empty?
end

#collections_for_selectObject



24
25
26
27
28
# File 'app/helpers/zizia/application_helper.rb', line 24

def collections_for_select
  ActiveFedora::SolrService.query('has_model_ssim:Collection').map do |c|
    [c['title_tesim'][0], c['id']]
  end
end

#human_update_actor_stack(update_actor_stack) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/zizia/application_helper.rb', line 4

def human_update_actor_stack(update_actor_stack)
  case update_actor_stack
  when 'HyraxDelete'
    'Overwrite All Files & Metadata'
  when 'HyraxMetadataOnly'
    'Update Existing Metadata, create new works'
  when 'HyraxOnlyNew'
    'Ignore Existing Works, new works only'
  else
    'Unknown'
  end
end

#sortable(column, title = nil) ⇒ Object



17
18
19
20
21
22
# File 'app/helpers/zizia/application_helper.rb', line 17

def sortable(column, title = nil)
  title ||= column.titleize
  css_class = column == sort_column ? "current #{sort_direction}" : nil
  direction = column == sort_column && sort_direction == 'asc' ? 'desc' : 'asc'
  link_to title, { sort: column, direction: direction }, class: css_class
end

#status_icon(status) ⇒ Object



34
35
36
37
38
# File 'app/helpers/zizia/application_helper.rb', line 34

def status_icon(status)
  # rubocop:disable Rails/OutputSafety
  return "<span class='glyphicon glyphicon-ok-sign text-success' aria-label='Status: Complete'></span>".html_safe if status == 'attached'
  "<span class='glyphicon glyphicon-question-sign' aria-label='Status: Unknown'></span>".html_safe
end