Skip to content

Commit

Permalink
Add search box to dataset page
Browse files Browse the repository at this point in the history
  • Loading branch information
deborahchua committed Oct 8, 2024
1 parent 42a6b83 commit cc6e5d8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/views/solr_datasets/_meta_data.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@
<%= "All datasets from #{@dataset.organisation["title"]}" %>
<% end %>
</div>

<h3 class="heading-small"><%= t('.search_gov_data') %></h3>
<form action="/search/solr" method="GET" class="dgu-search-box">
<label for="q" class="visuallyhidden"><%= t('.accessibility.search_box_label') %></label>
<input id="q"
name="q"
type="text"
class="form-control dgu-search-box__input"/><button type="submit"
class="dgu-search-box__button">
<%= t('.accessibility.search_box_button')%>
</button>
</form>
</div>
</div>
</section>
4 changes: 4 additions & 0 deletions config/locales/views/datasets/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ en:
no_licence: "None"
other_licence: "Other Licence"
publisher_datasets: "More from this publisher"
search_gov_data: "Search"
accessibility:
search_box_label: "Search"
search_box_button: "Find data"
breadcrumb:
home: "Home"
search: "Search"
7 changes: 7 additions & 0 deletions spec/features/solr_dataset_show_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,11 @@
expect(page).to have_css("a", text: "All datasets from #{dataset.organisation['title']}")
end
end

scenario "Displays the search box" do
expect(page).to have_css("h3", text: "Search")
within("form.dgu-search-box") do
expect(page).to have_content("Search")
end
end
end

0 comments on commit cc6e5d8

Please sign in to comment.