Skip to content

Commit

Permalink
Add site title partial
Browse files Browse the repository at this point in the history
Why these changes are being introduced:

The GeoData visual design includes a heading at the top of each
page, along with some descriptive text.

Relevant ticket(s):

https://mitlibraries.atlassian.net/browse/GDT-182

How this addresses that need:

This adds the requested element as a partial, with conditional
copy for GDT versus non-GDT applications. It also moves the label text
to the `title` attribute, as the label is is now visually redundant but
may still be useful to screen reader users.

Side effects of this change:

* The input label before form submit is now the same as the placeholder
text. This feels fine since screen readers might not read placeholder
text, but they do consistently rely on labels.
* The copy for non-GDT titles did not come from UXWS and is subject
to change.
  • Loading branch information
jazairi committed Feb 20, 2024
1 parent 4783334 commit e2d7575
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/assets/stylesheets/partials/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.basic-search {
background-color: #989898;
margin-bottom: 0rem;
padding: 1.6rem 2rem;
padding: 2.4rem 2rem 1rem 2.4rem;

details {
margin-top: 1rem;
Expand Down
1 change: 1 addition & 0 deletions app/views/basic_search/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<%= content_for(:title, "Search | MIT Libraries") %>

<div class="space-wrap">
<%= render partial: "shared/site_title" %>
<%= render partial: "search/form" %>
<%= render partial: "static/about" if ENV.fetch('ABOUT_APP', nil) %>
</div>
1 change: 1 addition & 0 deletions app/views/record/view.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<%= render(partial: 'shared/error', collection: @errors) %>

<%= render(partial: 'shared/site_title') %>
<%= render(partial: 'search/form')%>

<% if @record.nil? %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/search/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end

<form id="basic-search" class="form-horizontal basic-search" action="<%= results_path %>" method="get">
<div class="form-group">
<label for="basic-search-main" class="field-label"><%= label %></label>
<label for="basic-search-main" class="field-label" title="<%= label %>" />
<input id="basic-search-main" type="search" class="field field-text basic-search-input <%= "required" if search_required %>" name="q" placeholder="Enter your search" value="<%= params[:q] %>" <%= 'required="required" aria-required="true"' if search_required %>>
<div class="basic-search-submit">
<button type="submit" class="btn button-primary">Search</button>
Expand Down
2 changes: 2 additions & 0 deletions app/views/search/results.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<%= content_for(:title, "Search Results | MIT Libraries") %>

<div class="space-wrap">

<%= render partial: "shared/site_title" %>
<%= render partial: "form" %>
<%= render partial: "search_summary" %>

Expand Down
6 changes: 6 additions & 0 deletions app/views/shared/_site_title.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<% if Flipflop.enabled?(:gdt) %>
<h1 class="hd-2">Search for Geographic/GIS data</h1>
<p>Find GIS data held at MIT and other universities</p>
<% else %>
<h1>Search the MIT Libraries</h1>
<% end %>
2 changes: 1 addition & 1 deletion app/views/static/_forms.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%
label = "Search the MIT Libraries"
label = "Enter your search"
button = "Search"
%>
<form id="basic-search" class="form-horizontal basic-search" action="/results" method="get">
Expand Down

0 comments on commit e2d7575

Please sign in to comment.