Skip to content

Commit

Permalink
Merge pull request #407 from alphagov/design-tweaks
Browse files Browse the repository at this point in the history
Link to json endpoints, petitions map, and directly to debates and responses
  • Loading branch information
alanth committed Oct 30, 2015
2 parents 29abb34 + 24efc06 commit 2969970
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 17 deletions.
15 changes: 13 additions & 2 deletions app/assets/stylesheets/petitions/views/_petition-show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@
}
}

.signatures-on-a-map, .signature-count-goal {
margin: $gutter-half 0 $gutter-half *-1;
@include media(desktop) {
margin-bottom: $gutter-half 0 $gutter-one-third *-1;
}
}
.signatures-on-a-map {
float: left;
@extend %contain-floats;
}
.signature-count-goal {
color: $secondary-text-colour;
width: 30%;
float: right;
text-align: right;
margin: $gutter-one-third 0 $gutter *-1;
color: $secondary-text-colour;
@extend %contain-floats;
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/stylesheets/petitions/views/_shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ input.back-page {
background-position: 0 26px;
@include background-image("graphics/graphic_crown", 36px, 25px);
}
.about-item-count-debate {
.about-item-count-debate, .about-item-other-business {
background-position: 4px 20px;
@include background-image("graphics/graphic_portcullis", 26px, 32px);
}
Expand Down
2 changes: 2 additions & 0 deletions app/views/application/_social_meta.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!-- Facebook analytics access -->
<meta property="fb:admins" content="204502059" />
<!-- Open Graph -->
<%= open_graph_tag 'site_name', :site_name %>
<%= open_graph_tag 'locale', 'en_GB' %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/pages/_home_debated_petitions.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<ol class="threshold-petitions">
<% actioned[:with_debated_outcome][:list].each.with_index do |petition, index| %>
<li class="petition-item">
<h3><%= link_to petition.action, petition_path(petition) %></h3>
<h3><%= link_to petition.action, petition_path(petition, anchor: 'debate-threshold') %></h3>
<p class="intro">This topic was debated on <%= short_date_format petition.debate_outcome.debated_on %></p>
<% if index == 0 && petition.debate_outcome.video_url? -%>
<%= link_to petition.debate_outcome.video_url, rel: 'external' do %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/petitions/_closed_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@
<li>
<span class="label">Date closed</span> <%= short_date_format petition.closed_at %>
</li>
<li class="meta-json">
<span class="note"><%= link_to "Get petition data (json format)", petition_path(petition, :json) %></span>
</li>
</ul>
<% end %>
2 changes: 1 addition & 1 deletion app/views/petitions/_debate_threshold.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section class="about-item about-item-count-debate" aria-labelledby="debate-threshold-heading">
<section class="about-item about-item-count-debate" id="debate-threshold" aria-labelledby="debate-threshold-heading">
<%# Has debate outcome details #%>
<% if debate_outcome = petition.debate_outcome? -%>
<% if debate_outcome.debated? %>
Expand Down
10 changes: 9 additions & 1 deletion app/views/petitions/_open_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
<%= link_to "Sign this petition", new_petition_signature_path(petition), :class => 'button button-sign-petition', :tabindex => increment(5) %>

<div class="signature-count">
<p class="signature-count-number"><%= signature_count(:default, petition.signature_count) %></p>
<p class="signature-count-number">
<%= signature_count(:default, petition.signature_count) %>
</p>
<div class="signature-count-graph" aria-hidden="true">
<span class="signature-count-current" style="width: <%= signatures_threshold_percentage(petition) %>"></span>
</div>
<p class="signatures-on-a-map">
<a href="http://petitionmap.unboxedconsulting.com/?petition=<%= petition.id %>">Show on a map</a>
</p>
<p class="signature-count-goal">
<%= number_with_delimiter(current_threshold(petition)) %>
</p>
Expand All @@ -36,5 +41,8 @@
<span class="label">Deadline</span> <%= short_date_format petition.deadline %>
<span class="note">All petitions run for 6 months</span>
</li>
<li class="meta-json">
<span class="note"><%= link_to "Get petition data (json format)", petition_path(petition, :json) %></span>
</li>
</ul>
<% end %>
2 changes: 1 addition & 1 deletion app/views/petitions/_other_business_details.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% unless petition.emails.empty? %>
<section aria-labelledby="other-business-heading">
<section class="about-item about-item-other-business" id="other-business" aria-labelledby="other-business-heading">
<h2 id="other-business-heading">Other parliamentary business</h2>

<% petition.emails.each do |email| %>
Expand Down
3 changes: 3 additions & 0 deletions app/views/petitions/_rejected_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,8 @@
<li>
<span class="label">Date submitted</span> <%= short_date_format petition.created_at %>
</li>
<li class="meta-json">
<span class="note"><%= link_to "Get petition data (json format)", petition_path(petition, :json) %></span>
</li>
</ul>
<% end %>
2 changes: 2 additions & 0 deletions app/views/petitions/create/_replay_petition_ui.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
<%= f.submit 'This looks good', :name => 'move:next', :class => 'button', :tabindex => increment %>

<%= f.submit 'Go back and make changes', :name => 'move:back', :class => 'button-secondary', :tabindex => increment %>

<p class="secondary">You can’t change your petition after this point.</p>
4 changes: 2 additions & 2 deletions app/views/petitions/create/_your_details_ui.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

<%= f.submit 'Continue', :name => 'move:next', :class => 'button', :tabindex => increment %>

<section class="secondary">
<div class="secondary">
<p>Your name will be published on this petition as the petition creator.</p>
<p>Other than that, we won’t publish your personal details anywhere or use them for anything other than this petition.</p>
<p>We will email you about this petition, and nothing else. You can unsubscribe at any time.</p>
</section>
</div>
1 change: 1 addition & 0 deletions app/views/petitions/search/_results.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
<% end -%>
</ol>
<%= render 'petitions/search/result_list_footer', petitions: @petitions %>
<p><%= link_to "Get this data (json format)", petitions_path(:json, params.slice(:page, :state)) %></p>
<% end %>
</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h3><%= link_to petition.action, petition_path(petition) %></h3>
<h3><%= link_to petition.action, petition_path(petition, anchor: 'debate-threshold') %></h3>
<p><%= signature_count(:default, petition.signature_count) %></p>
<% if debate_outcome = petition.debate_outcome %>
<p>Debated <%= short_date_format(debate_outcome.debated_on) %></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h3><%= link_to petition.action, petition_path(petition) %></h3>
<h3><%= link_to petition.action, petition_path(petition, reveal_response: "yes", anchor: 'response-threshold') %></h3>
<p>Government responded – <%= short_date_format(petition.government_response_at) %></p>
<p><%= petition.government_response.summary %></p>
<p><%= signature_count(:default, petition.signature_count) %></p>
2 changes: 1 addition & 1 deletion app/views/signatures/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<%= error_messages_for_field signature, :name %>
<%= f.text_field :name, :tabindex => increment, :maxlength => 255, :size => nil, :class => 'form-control' %>
<% if context == 'create-petition' %>
<span class="form-hint">You must use your real name</span>
<span class="form-hint">You must use your full name</span>
<% end %>
<% end %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<p><%= @sponsor.signature.name %> supported your petition – “<%= @petition.action %>”.</p>

<p><%= @supporting_sponsors_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it.</p>
<p><%= @supporting_sponsors_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less.</p>

<p>Find out how we check petitions before we publish them:<br />
<%= link_to nil, help_url(anchor: 'standards') %></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Your petition is nearly ready to go.

<%= @sponsor.signature.name %> supported your petition – "<%= @petition.action %>".

<%= @supporting_sponsors_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it.
<%= @supporting_sponsors_count %> people have supported your petition so far. We’re checking your petition to make sure it meets the petition standards. If it does, we’ll publish it. This usually takes a week or less.

Find out how we check petitions before we publish them:
<%= help_url(anchor: 'standards') %>
Expand Down
2 changes: 1 addition & 1 deletion config/locales/activerecord.en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ en-GB:
email:
blank: "Email must be completed"
invalid: "Email '%{value}' not recognised"
disposable: "Email must not be disposable"
disposable: "You can’t use a disposable email address"
action:
blank: "Action must be completed"
too_long: "Action is too long"
Expand Down
2 changes: 1 addition & 1 deletion features/suzie_signs_a_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Feature: Suzie signs a petition
And I fill in my details with email "[email protected]"
And I try to sign
Then I should see an error
And I should see "Email must not be disposable"
And I should see "You can’t use a disposable email address"

Scenario: Suzie sees notice that she has already signed when she validates more than once
When I fill in my details and sign a petition
Expand Down
1 change: 1 addition & 0 deletions public/google2c72409b182ebce8.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
google-site-verification: google2c72409b182ebce8.html
2 changes: 1 addition & 1 deletion spec/models/signature_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
it "does not allow emails from disposable addresses" do
signature = FactoryGirl.build(:signature, email: '[email protected]')
expect(signature).not_to have_valid(:email)
expect(signature.errors.full_messages).to include("Email must not be disposable")
expect(signature.errors.full_messages).to include("You can’t use a disposable email address")
end

describe "uniqueness of email" do
Expand Down

0 comments on commit 2969970

Please sign in to comment.