From 25cffb6809cecdf0ca9b9e1d8c1fee91963ea175 Mon Sep 17 00:00:00 2001 From: djanelle-mit Date: Mon, 24 Nov 2025 13:15:25 -0500 Subject: [PATCH 01/12] Split tab bar styles into own SCSS partial --- app/assets/stylesheets/application.css.scss | 1 + app/assets/stylesheets/partials/_search.scss | 46 ------------------- .../stylesheets/partials/_source_tabs.scss | 45 ++++++++++++++++++ 3 files changed, 46 insertions(+), 46 deletions(-) create mode 100644 app/assets/stylesheets/partials/_source_tabs.scss diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index b1035bad..4fc387de 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -19,6 +19,7 @@ @import "partials/_record"; @import "partials/_search"; @import "partials/_shared"; +@import "partials/_source_tabs"; @import "partials/_results"; @import "partials/_loading_spinner"; @import "partials/_suggestion-panel"; \ No newline at end of file diff --git a/app/assets/stylesheets/partials/_search.scss b/app/assets/stylesheets/partials/_search.scss index 7897fc4e..105bfd9b 100644 --- a/app/assets/stylesheets/partials/_search.scss +++ b/app/assets/stylesheets/partials/_search.scss @@ -214,52 +214,6 @@ color: #fff; } -/* =========== */ -/* New Tab Bar */ -/* =========== */ - -#tabs { - margin-top: 0; - - ul { - list-style-type: none; - padding: 0; - margin: 0; - display: flex; - gap: 4px; - } - - a { - padding: 12px 20px 16px; - background-color: transparent; - display: inline-block; - border: 2px solid transparent; - border-bottom: 0; - - @include searchUnderlinedLinks; - - &:hover { - border-color: $color-gray-700; - background-color: $color-gray-900; - color: $color-text-oncolor; - } - - &.active { - background-color: $color-white; - color: $color-text-primary; - text-decoration: none; - - &:hover { - color: $color-text-primary; - border-color: transparent; - } - } - - - } - -} - /* ============== */ /* Search Actions */ /* ============== */ diff --git a/app/assets/stylesheets/partials/_source_tabs.scss b/app/assets/stylesheets/partials/_source_tabs.scss new file mode 100644 index 00000000..f7f0ce3f --- /dev/null +++ b/app/assets/stylesheets/partials/_source_tabs.scss @@ -0,0 +1,45 @@ +/* ============================ */ +/* Source Tab Bar in USE Search */ +/* ============================ */ + +#tabs { + margin-top: 0; + + ul { + list-style-type: none; + padding: 0; + margin: 0; + display: flex; + gap: 4px; + } + + a { + padding: 12px 20px 16px; + background-color: transparent; + display: inline-block; + border: 2px solid transparent; + border-bottom: 0; + + @include searchUnderlinedLinks; + + &:hover { + border-color: $color-gray-700; + background-color: $color-gray-900; + color: $color-text-oncolor; + } + + &.active { + background-color: $color-white; + color: $color-text-primary; + text-decoration: none; + + &:hover { + color: $color-text-primary; + border-color: transparent; + } + } + + + } + +} \ No newline at end of file From 37fd5f6d454ef69b59776a53eb75f41d6aa9245c Mon Sep 17 00:00:00 2001 From: djanelle-mit Date: Mon, 24 Nov 2025 13:23:08 -0500 Subject: [PATCH 02/12] Graceful degradation state when no JS is present --- app/assets/stylesheets/partials/_source_tabs.scss | 9 ++++++++- app/views/search/_source_tabs.html.erb | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/assets/stylesheets/partials/_source_tabs.scss b/app/assets/stylesheets/partials/_source_tabs.scss index f7f0ce3f..3c7c6be6 100644 --- a/app/assets/stylesheets/partials/_source_tabs.scss +++ b/app/assets/stylesheets/partials/_source_tabs.scss @@ -5,7 +5,13 @@ #tabs { margin-top: 0; - ul { + // Graceful degradation when JS is not enabled + &:not(.has-js) { + overflow-x: auto; + -webkit-overflow-scrolling: touch; + } + + ul.primary { list-style-type: none; padding: 0; margin: 0; @@ -19,6 +25,7 @@ display: inline-block; border: 2px solid transparent; border-bottom: 0; + white-space: nowrap; @include searchUnderlinedLinks; diff --git a/app/views/search/_source_tabs.html.erb b/app/views/search/_source_tabs.html.erb index a9482de4..2f2f9315 100644 --- a/app/views/search/_source_tabs.html.erb +++ b/app/views/search/_source_tabs.html.erb @@ -1,6 +1,6 @@ \ No newline at end of file From 1f4be6ed82b965cf8bd365253f92c01342935d8c Mon Sep 17 00:00:00 2001 From: djanelle-mit Date: Wed, 26 Nov 2025 11:09:51 -0500 Subject: [PATCH 10/12] Fixing incorrect name of All Primo tab --- app/views/search/_source_tabs.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/search/_source_tabs.html.erb b/app/views/search/_source_tabs.html.erb index 87c33108..b3f23225 100644 --- a/app/views/search/_source_tabs.html.erb +++ b/app/views/search/_source_tabs.html.erb @@ -4,7 +4,7 @@
  • <%= link_to_tab("All") %>
  • <% if Feature.enabled?(:tab_primo_all) %> -
  • <%= link_to_tab("Primo", "Books") %>
  • +
  • <%= link_to_tab("Primo", "Articles and Catalog") %>
  • <% end %>
  • <%= link_to_tab("cdi", "Articles") %>
  • From b28fefb2fbdb7e1f038f1706f604ad2f8ea3d4c4 Mon Sep 17 00:00:00 2001 From: djanelle-mit Date: Wed, 26 Nov 2025 11:10:46 -0500 Subject: [PATCH 11/12] Updating name of Alma to Books and media --- app/views/search/_source_tabs.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/search/_source_tabs.html.erb b/app/views/search/_source_tabs.html.erb index b3f23225..52033a61 100644 --- a/app/views/search/_source_tabs.html.erb +++ b/app/views/search/_source_tabs.html.erb @@ -8,7 +8,7 @@ <% end %>
  • <%= link_to_tab("cdi", "Articles") %>
  • -
  • <%= link_to_tab("alma", "Books") %>
  • +
  • <%= link_to_tab("alma", "Books and media") %>
  • <% if Feature.enabled?(:tab_timdex_all) %>
  • <%= link_to_tab("TIMDEX") %>
  • From 18cb587b06cc8495b0a0559aa572ca4457c8b3c9 Mon Sep 17 00:00:00 2001 From: djanelle-mit Date: Mon, 1 Dec 2025 09:44:54 -0500 Subject: [PATCH 12/12] Switching to loading JS conditionally when tabs are loaded --- app/javascript/application.js | 1 - app/views/search/_source_tabs.html.erb | 2 ++ config/importmap.rb | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/application.js b/app/javascript/application.js index ad1461bf..b3e67a5a 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -2,7 +2,6 @@ import "@hotwired/turbo-rails" import "controllers" import "loading_spinner" -import "source_tabs" // Show the progress bar after 200 milliseconds, not the default 500 Turbo.config.drive.progressBarDelay = 200; \ No newline at end of file diff --git a/app/views/search/_source_tabs.html.erb b/app/views/search/_source_tabs.html.erb index 52033a61..1724a102 100644 --- a/app/views/search/_source_tabs.html.erb +++ b/app/views/search/_source_tabs.html.erb @@ -20,4 +20,6 @@
  • <%= link_to_tab("Website") %>
  • + + <%= javascript_include_tag "source_tabs" %> \ No newline at end of file diff --git a/config/importmap.rb b/config/importmap.rb index cbd365c1..672f444c 100644 --- a/config/importmap.rb +++ b/config/importmap.rb @@ -2,7 +2,6 @@ pin "application", preload: true pin "loading_spinner", preload: true -pin "source_tabs", preload: true pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true