Module: Atrium::ShowcasesHelper

Includes:
ApplicationHelper
Included in:
ApplicationHelper, ApplicationController
Defined in:
app/helpers/atrium/showcases_helper.rb

Instance Method Summary collapse

Methods included from ApplicationHelper

#application_name

Instance Method Details

#facet_element(facet, value) ⇒ Object



30
31
32
# File 'app/helpers/atrium/showcases_helper.rb', line 30

def facet_element(facet, value)
  {Atrium.config.label_for_facet(facet) => value}
end

#get_parent_path(showcase) ⇒ Object



4
5
6
7
8
9
10
# File 'app/helpers/atrium/showcases_helper.rb', line 4

def get_parent_path(showcase)
  facet={}
  showcase.facet_selections.each do |x|
    facet[x.solr_facet_name]=x.value
  end
  main_app.polymorphic_path(showcase.parent, f: facet)
end

#get_showcase_parent_edit_path(showcase) ⇒ Object



12
13
14
# File 'app/helpers/atrium/showcases_helper.rb', line 12

def get_showcase_parent_edit_path(showcase)
  atrium.polymorphic_path([showcase.parent,showcase],action: :edit)
end

#get_showcase_parent_show_path(showcase) ⇒ Object



16
17
18
# File 'app/helpers/atrium/showcases_helper.rb', line 16

def get_showcase_parent_show_path(showcase)
  atrium.polymorphic_path([showcase.parent,showcase])
end

#render_showcase_facet_selection(showcase) ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'app/helpers/atrium/showcases_helper.rb', line 20

def render_showcase_facet_selection(showcase)
  facets=showcase.facet_selections
  return "".html_safe unless facets
  content = []
  facets.each do |facet|
    content << facet_element(facet.solr_facet_name, facet.value)
  end
  return content.flatten.join("\n").html_safe
end