Class: Spotlight::AccessibilityController

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

Overview

Exhibit dashboard controller

Instance Method Summary collapse

Methods included from Concerns::ApplicationController

#enabled_in_spotlight_view_type_configuration?, #field_enabled?

Methods included from Controller

#add_breadcrumb, #blacklight_config, #breadcrumbs, #current_exhibit, #current_masthead, #current_masthead=, #current_site, #default_url_options, #exhibit_masthead?, #exhibit_search_action_url, #exhibit_search_facet_path, #resource_masthead?, #search_action_url, #search_facet_path, #search_state, #set_exhibit_locale_scope, #set_locale

Methods included from Config

#exhibit_specific_blacklight_config

Instance Method Details

#alt_textObject



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?(&: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