From 6bf0d0eed1a2e16eca599acd4db39f10c4a0bf79 Mon Sep 17 00:00:00 2001 From: neuroalien <105230050+neuroalien@users.noreply.github.com> Date: Mon, 24 Jul 2023 20:01:10 +0100 Subject: [PATCH] AO3-6553 Turn homepage media list into navigation Semantically, the list of media (plus All Fandoms) on the homepage is a navigation element, not a menu. The list of media used in the main site menu needs to stay a `menu`, so we're unDRYing the partial and creating a new partial just for use on the homepage. The preferred element to use in modern web development is `nav`. We don't use this anywhere else (yet), so this will be our test case. (Per https://www.w3.org/TR/html-aria/#docconformance, `ul`s are not allowed to have the role `navigation`.) --- app/views/home/_fandoms.html.erb | 10 ++++++++++ app/views/home/index.html.erb | 12 ++++++------ config/locales/views/en.yml | 8 ++++++++ public/stylesheets/site/2.0/26-media-narrow.css | 2 +- 4 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 app/views/home/_fandoms.html.erb diff --git a/app/views/home/_fandoms.html.erb b/app/views/home/_fandoms.html.erb new file mode 100644 index 00000000000..f5cd74ef2e7 --- /dev/null +++ b/app/views/home/_fandoms.html.erb @@ -0,0 +1,10 @@ + diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index 5cd39fbb77c..0bafaa432d0 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -5,7 +5,7 @@ <% if logged_in? && @homepage.favorite_tags.present? %>
-

<%= ts('Find your favorites') %>

+

<%= t(".find_your_favorites") %>

<% else %> -
-

<%= ts('Find your favorites') %>

+
+ <%= render 'fandoms' %> + <% end %> <% if @homepage.admin_posts.present? %> diff --git a/config/locales/views/en.yml b/config/locales/views/en.yml index 8b3d5cdd91f..69b2975528d 100644 --- a/config/locales/views/en.yml +++ b/config/locales/views/en.yml @@ -429,6 +429,14 @@ en: home: donate: page_title: Donate or Volunteer + fandoms: + all_fandoms: All Fandoms + index: + browse_or_favorite: + one: Browse fandoms by media or favorite up to %{count} tag to have it listed here! + other: Browse fandoms by media or favorite up to %{count} tags to have them listed here! + find_your_favorites: Find your favorites + media_navigation_label: Media invitations: invitation: email_address_label: Enter an email address diff --git a/public/stylesheets/site/2.0/26-media-narrow.css b/public/stylesheets/site/2.0/26-media-narrow.css index aee2a1722be..0fb07fc582e 100644 --- a/public/stylesheets/site/2.0/26-media-narrow.css +++ b/public/stylesheets/site/2.0/26-media-narrow.css @@ -182,7 +182,7 @@ body .narrow-shown { padding: 0; } -.splash div.module, .logged-in .splash div.module { +.splash div.module, .splash nav.module, .logged-in .splash div.module, .logged-in .splash nav.module { clear: both; margin-left: 0; margin-right: 0;