Class: Spotlight::AccessibilityController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/spotlight/accessibility_controller.rb

Overview

Exhibit dashboard controller

Instance Method Summary collapse

Instance Method Details

#alt_text ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'app/controllers/spotlight/accessibility_controller.rb', line 10

def alt_text
  # Sort by newest except for the homepage, which is always first
  pages_with_alt = @exhibit.pages.order(Arel.sql('id = 1 DESC, created_at DESC')).select { |elem| elem.content.any?(&:supports_alt_text?) }
  @pages = pages_with_alt.map { |page| get_alt_info(page) }
  @has_alt_text = @pages.sum { |page| page[:has_alt_text] }
  @total_alt_items = @pages.sum { |page| page[:can_have_alt_text] }

  attach_alt_text_breadcrumbs
end