Module: Spotlight::PagesHelper

Defined in:
app/helpers/spotlight/pages_helper.rb

Instance Method Summary collapse

Instance Method Details

#has_title?(document) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/helpers/spotlight/pages_helper.rb', line 3

def has_title? document
  document_heading(document) != document.id
end

#item_grid_block_ids(block) ⇒ Object



18
19
20
21
22
# File 'app/helpers/spotlight/pages_helper.rb', line 18

def item_grid_block_ids(block)
  item_grid_block_objects(block).map do |object|
    object[:id] if object[:display]
  end.compact
end

#item_grid_block_objects(block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'app/helpers/spotlight/pages_helper.rb', line 9

def item_grid_block_objects(block)
  objects = []
  block.each do |key, value|
    if value.present? and key.include?("item-grid-id")
      objects << {id: value, display: (block[key.gsub("-id", "-display")] == "true")}
    end
  end
  objects
end

#should_render_record_thumbnail_title?(document, block) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'app/helpers/spotlight/pages_helper.rb', line 6

def should_render_record_thumbnail_title? document, block
  has_title?(document) && block["show-title"]
end