Skip to content

Commit c12b7e3

Browse files
author
j-corry
committed
- Rename 'narrow' layout to 'landing'
- Move '/examples' to its own controller, with its own content - Welcome page now shows landing page information only - Standardise appearance of search bar used on welcome page with that on the search page - Add ability to pass html classes through search_link helper method (link_helper.rb) - Convert claw partials over to bootstrap - Remove back-to-top button - Update all object pages & partials - Tweak some margins on search results page
1 parent 87edcc1 commit c12b7e3

File tree

136 files changed

+1432
-1832
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

136 files changed

+1432
-1832
lines changed

app/controllers/content_type_objects_controller.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
class ContentTypeObjectsController < ApplicationController
22

3-
layout 'narrow'
4-
5-
def index
6-
# used as landing page during development
7-
@page_title = 'Examples - Parliamentary Search'
8-
end
9-
103
def show
114
@response = SolrQuery.new(object_uri: params[:object]).all_data['response']
125

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class ExamplesController < ApplicationController
2+
3+
def index
4+
@page_title = 'Parliamentary Search'
5+
end
6+
7+
end

app/controllers/welcome_controller.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
class WelcomeController < ApplicationController
22

3-
layout "narrow"
4-
53
def index
64
@page_title = 'Parliamentary Search'
75
end

app/helpers/link_helper.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def object_show_link(string, uri)
88
link_to(string, object_show_url(object: uri[:value]))
99
end
1010

11-
def search_link(data, singular: false, reading_order: true)
11+
def search_link(data, singular: false, reading_order: true, html_class: nil)
1212
# Accepts either a string or a SES ID, which it resolves into a string
1313
# Either option requires a field reference (standard data hash)
1414

@@ -40,7 +40,11 @@ def search_link(data, singular: false, reading_order: true)
4040
searchable_field_name = substitute_field_name(data[:field_name])
4141
value = data[:value]
4242

43-
link_to(formatted_name(data, ses_data, singular, reading_order), search_path(filter: { searchable_field_name => [value] }))
43+
if html_class
44+
link_to(formatted_name(data, ses_data, singular, reading_order), search_path(filter: { searchable_field_name => [value] }), class: html_class)
45+
else
46+
link_to(formatted_name(data, ses_data, singular, reading_order), search_path(filter: { searchable_field_name => [value] }))
47+
end
4448
end
4549

4650
def substitute_field_name(field_name)
Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,34 @@
1-
<section hidden id="about-this-result" class="object-claw claw">
2-
<h3 class="content-heading-small">Librarians' tools</h3>
3-
<div class="claw-grid-container">
4-
<b class="grid-item about-search-time">Search time</b>
5-
<span class="grid-item"><%= "#{(Time.now - @start_time).round(3)} seconds" %></span>
6-
<b class="grid-item about-query-time">Solr query time</b>
7-
<span class="grid-item"><%= "#{@search_data.query_time} seconds" %></span>
8-
<b class="grid-item about-query">Search query</b>
9-
<span class="grid-item"><%= @search_data.query %></span>
10-
<b class="grid-item about-searched-on">We actually searched for</b>
11-
<span class="grid-item"><%= @search_data.query_as_submitted %></span>
1+
<section hidden id="about-this-result" class="row my-4 py-3 border border-dark claw">
2+
<div class="col">
3+
<h3>Librarians' tools</h3>
4+
<dl>
5+
<dt>
6+
Search time
7+
</dt>
8+
<dd>
9+
<%= "#{(Time.now - @start_time).round(3)} seconds" %>
10+
</dd>
11+
12+
<dt>
13+
Solr query time
14+
</dt>
15+
<dd>
16+
<%= "#{@search_data.query_time} seconds" %>
17+
</dd>
18+
19+
<dt>
20+
Search query
21+
</dt>
22+
<dd>
23+
<%= @search_data.query %>
24+
</dd>
25+
26+
<dt>
27+
We actually searched for
28+
</dt>
29+
<dd>
30+
<%= @search_data.query_as_submitted %>
31+
</dd>
32+
</dl>
1233
</div>
1334
</section>
Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,39 @@
1-
<section hidden data-controller="claw" data-action="keydown@document->claw#handleKeyDown" id="about-this-result" class="object-claw claw">
2-
<h3 class="content-heading-small">Librarians' tools</h3>
3-
<div class="claw-grid-container">
4-
<% unless object.date.blank? %>
5-
<b class="grid-item about-timestamp">Timestamp</b>
6-
<span class="grid-item"><%= object.timestamp[:value] %></span>
7-
<% end %>
1+
<section hidden data-controller="claw" data-action="keydown@document->claw#handleKeyDown" id="about-this-result" class="row my-4 py-3 border border-dark claw">
2+
<div class="col">
3+
<h3>Librarians' tools</h3>
4+
<dl>
5+
<% unless object.date.blank? %>
6+
<dt>Timestamp</dt>
7+
<dd><%= object.timestamp[:value] %></dd>
8+
<% end %>
89

9-
<% unless object.object_uri.blank? %>
10-
<b class="grid-item" id="about-uri">URI</b>
11-
<div class="grid-item"><%= object.object_uri[:value] %>
12-
<div data-controller="clipboard" class="mini-button-container">
13-
<div hidden data-clipboard-target="source" data-clipboard-text="<%= object.object_uri[:value] %>"></div>
14-
<button data-action="click->clipboard#copy" title="Copy text to clipboard" class="page-button">
15-
Copy URI to clipboard
16-
</button>
17-
</div>
18-
</div>
19-
<% end %>
10+
<% unless object.object_uri.blank? %>
11+
<dt>URI</dt>
12+
<dd>
13+
<%= object.object_uri[:value] %>
14+
<span data-controller="clipboard" class="font-size-milli">
15+
<span hidden data-clipboard-target="source" data-clipboard-text="<%= object.object_uri[:value] %>"></span>
16+
<button data-action="click->clipboard#copy" title="Copy text to clipboard" class="btn btn-secondary">
17+
Copy URI to clipboard
18+
</button>
19+
</span>
20+
</dd>
21+
<% end %>
2022

21-
<% unless object.indexing_link.blank? %>
22-
<b class="grid-item" id="about-uri">In Indexing</b>
23-
<span class="grid-item"><%= link_to object.indexing_link, object.indexing_link, target: :_blank %></span>
24-
<% end %>
23+
<% unless object.indexing_link.blank? %>
24+
<dt>In Indexing</dt>
25+
<dd><%= link_to object.indexing_link, object.indexing_link, target: :_blank %></dd>
26+
<% end %>
2527

26-
<% unless object.solr_deep_link.blank? %>
27-
<b class="grid-item" id="about-uri">In Solr</b>
28-
<span class="grid-item"><%= link_to object.solr_deep_link, object.solr_deep_link, target: :_blank %></span>
29-
<% end %>
28+
<% unless object.solr_deep_link.blank? %>
29+
<dt>In Solr</dt>
30+
<dd><%= link_to object.solr_deep_link, object.solr_deep_link, target: :_blank %></dd>
31+
<% end %>
3032

31-
<% unless object.internal_location_uri.blank? %>
32-
<b class="grid-item" id="about-internal-uri">Internal location</b>
33-
<span class="grid-item"><%= link_to object.internal_location_uri[:value], object.internal_location_uri[:value], target: :_blank %></span>
34-
<% end %>
33+
<% unless object.internal_location_uri.blank? %>
34+
<dt>Internal location</dt>
35+
<dd><%= link_to object.internal_location_uri[:value], object.internal_location_uri[:value], target: :_blank %></dd>
36+
<% end %>
37+
</dl>
3538
</div>
3639
</section>
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<% unless object.answer_text.blank? %>
2-
<div class="about-item">
3-
<h3 class="content-heading" id="answer"><%= object.corrected? ? 'Original answer' : 'Answer' %></h3>
4-
<p class="html-content">
5-
<%= raw(object.answer_text[:value]) %>
6-
</p>
7-
</div>
2+
<dt><%= object.corrected? ? 'Original answer' : 'Answer' %></dt>
3+
<dd>
4+
<%= raw(object.answer_text[:value]) %>
5+
</dd>
86
<% end %>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% unless assessment.blank? %>
2-
<div class="about-item">
3-
<div class="content-heading-small" id="assessment">Assessment</div>
2+
<dt>Assessment</dt>
3+
<dd>
44
<%= assessment[:value] %>
5-
</div>
5+
</dd>
66
<% end %>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<% unless attachments.blank? %>
2-
<div class="about-item">
3-
<div class="content-heading-small" id="attachment">Attachment</div>
2+
<dt>Attachment</dt>
3+
<dd>
44
<%= attachments.pluck(:value).join('; ') %>
5-
</div>
5+
</dd>
66
<% end %>

app/views/content_type_objects/fragments/_back_to_top_button.html.erb

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)