Skip to content

Commit

Permalink
Merge pull request #3316 from projectblacklight/2669-alt-totals
Browse files Browse the repository at this point in the history
have totals in dashboard be for all items
  • Loading branch information
corylown authored Dec 6, 2024
2 parents 77852ae + 9d779d8 commit 5273dff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
4 changes: 1 addition & 3 deletions app/controllers/spotlight/accessibility_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ class AccessibilityController < Spotlight::ApplicationController
load_and_authorize_resource :exhibit, class: Spotlight::Exhibit

def alt_text
@limit = 5
# 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 = params[:show_all] ? pages_with_alt : pages_with_alt.first(@limit)
@pages = pages.map { |page| get_alt_info(page) }
@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] }

Expand Down
8 changes: 1 addition & 7 deletions app/views/spotlight/accessibility/alt_text.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,4 @@
</tr>
<% end %>
</tbody>
</table>

<% unless params[:show_all] || @pages.length < @limit %>
<%= link_to '?show_all=true', class: 'ml-3' do %>
Show all<%= blacklight_icon('chevron_right') %>
<% end %>
<% end %>
</table>

0 comments on commit 5273dff

Please sign in to comment.