diff --git a/app/assets/stylesheets/earthworks.css b/app/assets/stylesheets/earthworks.css index 62eae128..6b30e23b 100644 --- a/app/assets/stylesheets/earthworks.css +++ b/app/assets/stylesheets/earthworks.css @@ -164,6 +164,21 @@ Uncomment lines 142-144 --bs-pagination-focus-bg: none; --bs-pagination-focus-box-shadow: none; } + +/* Styles for search result description expand/collapse */ + +.expand-collapse .btn-outline-secondary { + display: flex; + &.active { + color: white; + background-color:var(--stanford-cardinal); + } +} + +.expand-collapse i { + align-self: center; +} + /* Styles for code snippet */ .code-snippet-content { diff --git a/app/components/earthworks/search_result_component.html.erb b/app/components/earthworks/search_result_component.html.erb index 3a63fc9b..de10cef8 100644 --- a/app/components/earthworks/search_result_component.html.erb +++ b/app/components/earthworks/search_result_component.html.erb @@ -24,7 +24,7 @@ <% end %> <% end %>
-
+
<%= index_fields_display %> diff --git a/app/javascript/controllers/description_controller.js b/app/javascript/controllers/description_controller.js new file mode 100644 index 00000000..0ce869ac --- /dev/null +++ b/app/javascript/controllers/description_controller.js @@ -0,0 +1,11 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + expand() { + this.element.classList.remove("collapse"); + } + + collapse() { + this.element.classList.add("collapse"); + } +} diff --git a/app/javascript/controllers/expandcollapse_controller.js b/app/javascript/controllers/expandcollapse_controller.js new file mode 100644 index 00000000..3a0bdb80 --- /dev/null +++ b/app/javascript/controllers/expandcollapse_controller.js @@ -0,0 +1,29 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + static outlets = ["description"] + static targets = ["expandButton", "collapseButton"] + + expandDescriptions() { + this.descriptionOutlets.forEach(description => { + description.expand(); + }); + + this.toggleButtonStates(); + } + + + collapseDescriptions() { + this.descriptionOutlets.forEach(description => { + description.collapse(); + }); + + this.toggleButtonStates(); + } + + toggleButtonStates() { + this.expandButtonTarget.classList.toggle("active"); + this.collapseButtonTarget.classList.toggle("active"); + } + +} \ No newline at end of file diff --git a/app/views/catalog/_sort_and_per_page.html.erb b/app/views/catalog/_sort_and_per_page.html.erb new file mode 100644 index 00000000..f79f97bf --- /dev/null +++ b/app/views/catalog/_sort_and_per_page.html.erb @@ -0,0 +1,16 @@ + \ No newline at end of file