Skip to content

Commit

Permalink
Display Finder Organisation
Browse files Browse the repository at this point in the history
In order for the user to be able to navigate back to the Org, this
commit displays a link back to the Finder's tagged Org. This commit also
styles it to look like the metadata in the rest of GOV.UK and adds a
CSS reset to fix some browser stylesheet margins going on. I also fixed
a spacing issue this introduced on the Filter Results button.
  • Loading branch information
tommyp committed Jun 30, 2014
1 parent 0d98538 commit ee71a6f
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 7 deletions.
32 changes: 32 additions & 0 deletions app/assets/stylesheets/_reset.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// flatten all browser defaults and styles inherited from gov.uk header

/* Borrowed from http://meyerweb.com/eric/tools/css/reset/ */
div, span,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark {
border: none;
margin: 0;
padding: 0;
}

h1, h2, h3, h4, h5, h6, p, blockquote, pre,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
input, textarea,
table, caption, tbody, tfoot, thead, tr, th, td {
font-size: inherit;
font-family: inherit;
line-height: inherit;
font-weight: normal;
}

47 changes: 40 additions & 7 deletions app/assets/stylesheets/finder_frontend.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@import "design-patterns/buttons";
@import "not-ie-conditional";

@import "reset";

#wrapper {
display: block;
Expand Down Expand Up @@ -43,14 +44,45 @@
}
}

header h1 {
@include heading-48;
@include bold-48;
margin: 0 $gutter-half $gutter;

header {
width: $full-width;
margin-bottom: $gutter;
@include media(tablet) {
margin: $gutter;
width: $two-thirds;
margin-bottom: $gutter
}

h1 {
@include heading-48;
font-weight: bold;
margin: $gutter-one-third $gutter-half;

@include media(tablet) {
margin: $gutter-half $gutter;
width: $two-thirds;
}
}
.metadata {
position: relative;
@include core-14;
@extend %contain-floats;
width: 100%;

dt {
float: left;
clear: left;
width: auto;
min-width: 120px;
@include media(tablet) {
padding-right: $gutter-one-third;
}
}
dd {
float: left;
width: 57%;
@include media(tablet) {
width: 70%;
}
}
}
}

Expand Down Expand Up @@ -222,6 +254,7 @@
@include core-16;
vertical-align: baseline;
border-bottom: solid 1px $border-colour;
margin: $gutter-half 0;
padding-bottom: $gutter-half;

.result-count {
Expand Down
10 changes: 10 additions & 0 deletions app/views/finders/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

<header>
<h1><%= raw(finder.name) %></h1>
<% if finder.primary_organisation %>
<div class="metadata">
<dl class="inner-block">
<dt>From:</dt>
<dd>
<%= link_to finder.primary_organisation.title, finder.primary_organisation.web_url %>
</dd>
</dl>
</div>
<% end %>
</header>

<%= render finder.facets %>
Expand Down
4 changes: 4 additions & 0 deletions features/step_definitions/filtering_steps.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Given(/^a collection of cases exist$/) do
stub_finder_artefact_api_request
stub_case_collection_api_request
end

Then(/^I can get a list of all merger inquiries$/) do
stub_finder_artefact_api_request
visit finder_path('cma-cases')
page.should have_content('2 cases')
page.should have_css('a', text: 'Competition and Markets Authority')
page.should have_css('.filtered-results .document', count: 2)

within '.filtered-results .document:nth-child(1)' do
Expand All @@ -20,6 +23,7 @@
end

When(/^I search cases by keyword$/) do
stub_finder_artefact_api_request
stub_keyword_search_api_request

visit finder_path('cma-cases')
Expand Down
37 changes: 37 additions & 0 deletions features/support/case_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
require 'gds_api/test_helpers/content_api'

module CaseHelper
include GdsApi::TestHelpers::ContentApi

def stub_case_collection_api_request
stub_request(:get, finder_api_all_cases_url).to_return(
body: all_cases_json,
Expand All @@ -23,6 +27,11 @@ def stub_keyword_search_api_request
)
end

def stub_finder_artefact_api_request
artefact_data = artefact_for_slug('cma-cases').merge(cma_case_artefact)
content_api_has_an_artefact('cma-cases', artefact_data)
end

def finder_api_all_cases_url
"#{Plek.current.find('finder-api')}/finders/cma-cases/documents.json"
end
Expand Down Expand Up @@ -224,6 +233,34 @@ def schema_json
|
end

def cma_case_artefact
{
:id => "http://contentapi.dev.gov.uk/cma-cases.json",
:web_url => "http://finder-frontend.dev.gov.uk/cma-cases",
:title => "Competition and Markets Authority cases",
:format => "finder",
:updated_at => "2014-06-26T13:44:57+01:00",
:tags => [
{
:id => "http://contentapi.dev.gov.uk/tags/organisation/competition-and-markets-authority.json",
:slug => "competition-and-markets-authority",
:web_url => "http://www.dev.gov.uk/government/organisations/competition-and-markets-authority",
:title => "Competition and Markets Authority ",
:details => {
:description => nil,
:short_description => nil,
:type => "organisation"
},
:content_with_tag => {
:id => "http://contentapi.dev.gov.uk/with_tag.json?organisation=competition-and-markets-authority",
:web_url => nil
},
:parent => nil
}
]
}
end

def select_filters(facets = {})
within ".filter-form form" do
facets.values.each do |value|
Expand Down

0 comments on commit ee71a6f

Please sign in to comment.