Skip to content

Commit

Permalink
Merge pull request #353 from alphagov/content-changes-3
Browse files Browse the repository at this point in the history
Content changes
  • Loading branch information
alanth committed Jul 30, 2015
2 parents 6ed8434 + 7d12e1b commit 73bd48d
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 36 deletions.
6 changes: 5 additions & 1 deletion app/assets/stylesheets/petitions/views/_petition-show.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@
@include bold-24;
margin-bottom: $gutter-two-thirds;
}
.label {
.label, .note {
display: block;
@include core-16;
margin-bottom: 5px;
}
.note {
color: $secondary-text-colour;
margin-top: 10px;
}
}
8 changes: 0 additions & 8 deletions app/views/admin/petitions/_petition_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
<dt>Status</dt>
<dd class="petition-meta-state"><%= @petition.state.capitalize %></dd>

<% if @petition.rejected? or @petition.hidden? -%>
<dt>Rejection reason</dt>
<dd><p><%= rejection_reason(@petition.rejection.code) %> </dd>

<dt>Rejection text</dt>
<dd><%= @petition.rejection.details %> </dd>
<% end -%>

<% unless @petition.in_todo_list? %>
<dt>Signatures</dt>
<dd class="petition-meta-signature-count"><%= number_with_delimiter(@petition.signature_count) %> </dd>
Expand Down
2 changes: 1 addition & 1 deletion app/views/local_petitions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<% if @constituency.present? %>

<% if @constituency.mp %>
<p>Your MP is <%= link_to @constituency.mp.name, @constituency.mp.url, rel: 'external' %></p>
<p class="lede">Your member of parliament is <%= link_to @constituency.mp.name, @constituency.mp.url, rel: 'external' %></p>
<% end %>

<div class="section-panel local-petitions">
Expand Down
7 changes: 4 additions & 3 deletions app/views/petitions/_open_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
<%= render 'share_petition', petition: petition %>

<ul class="petition-meta">
<li class="meta-deadline">
<span class="label">Deadline</span> <%= short_date_format petition.deadline %>
</li>
<li class="meta-created-by">
<span class="label">Created by</span> <%= petition.creator_signature.name %>
</li>
<li class="meta-deadline">
<span class="label">Deadline</span> <%= short_date_format petition.deadline %>
<span class="note">All petitions run for 6 months</span>
</li>
</ul>
<% end %>
2 changes: 1 addition & 1 deletion app/views/petitions/_rejected_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h2>Reasons for rejection</h2>
<%= rejection_description(petition.rejection.code) %>
<% if petition.rejection.details? %>
<p><%= petition.rejection.details %></p>
<p><%= auto_link(simple_format(petition.rejection.details)) %></p>
<% end %>

<ul class="petition-meta">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
<h3><%= link_to petition.action, petition_path(petition) %></h3>
<p><%= signature_count(:default, petition.signature_count) %></p>
<% case petition.state %>
<% when "open" %>
<p><%= signature_count(:default, petition.signature_count) %></p>
<% when "closed" %>
<p><%= signature_count(:default, petition.signature_count) %>, now closed</p>
<% when "rejected" %>
<p>Rejected</p>
<% end %>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<h3><%= link_to petition.action, petition_path(petition) %></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>
<p>Responded <%= short_date_format(petition.government_response_at) %></p>
6 changes: 3 additions & 3 deletions config/locales/petitions.en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ en-GB:
signoff_suffix: "UK Government and Parliament"

waiting_for_in_words:
zero: "Waiting less than a day"
one: "Waiting 1 day"
other: "Waiting %{formatted_count} days"
zero: "Waiting for less than a day"
one: "Waiting for 1 day"
other: "Waiting for %{formatted_count} days"

signature_counts:
default:
Expand Down
6 changes: 3 additions & 3 deletions config/locales/rejections.en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ en-GB:
<p>There is already a petition about this issue.</p>
libellous: |-
<p>Petitions will not be accepted if they:</p>
<ul>
<ul class="list-bullet">
<li>contain information which may be protected by an injunction or court order</li>
<li>contain material that is potentially confidential, commercially sensitive or which may cause personal distress or loss</li>
<li>include the names of individuals if they have been accused of a crime or information that may identify them</li>
Expand All @@ -23,15 +23,15 @@ en-GB:
</ul>
offensive: |-
<p>Petitions will not be accepted if they:</p>
<ul>
<ul class="list-bullet">
<li>contain offensive, joke or nonsense content</li>
<li>use language which may cause offence, is provocative or extreme in its views</li>
<li>use wording that is impossible to understand</li>
<li>include statements that amount to advertisements</li>
</ul>
irrelevant: |-
<p>Petitions cannot be used to request action on issues that are outside the responsibility of the government. This includes:</p>
<ul>
<ul class="list-bullet">
<li>party political material</li>
<li>commercial endorsements including the promotion of any product, service or publication</li>
<li>issues that are dealt with by devolved bodies, eg The Scottish Parliament</li>
Expand Down
8 changes: 4 additions & 4 deletions features/suzie_views_a_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ Feature: Suzie views a petition
Then I should see "Defence is the best Offence"

Scenario: Suzie sees reason for rejection if appropriate
Given a petition "Please bring back Eldorado" has been rejected with the reason "<i>We<i> like http://www.google.com and [email protected]"
Given a petition "Please bring back Eldorado" has been rejected with the reason "We like http://www.google.com and [email protected]"
When I view the petition
Then I should see the petition details
And I should see the reason for rejection
And I should see "<i>We<i>"
And I should not see a link called "http://www.google.com" linking to "http://www.google.com"
And I should not see a link called "[email protected]" linking to "mailto:[email protected]"
And I should see "We like http://www.google.com and [email protected]"
And I should see a link called "http://www.google.com" linking to "http://www.google.com"
And I should see a link called "[email protected]" linking to "mailto:[email protected]"
And I should not see the vote count
And I should see submitted date
And I cannot sign the petition
Expand Down
20 changes: 10 additions & 10 deletions spec/helpers/date_time_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,40 +45,40 @@
context "when the date is today" do
let(:date) { 2.hours.ago(now) }

it "returns 'Waiting less than a day'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting less than a day")
it "returns 'Waiting for less than a day'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting for less than a day")
end
end

context "when the date is yesterday" do
let(:date) { 1.day.ago(now) }

it "returns 'Waiting 1 day'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting 1 day")
it "returns 'Waiting for 1 day'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting for 1 day")
end
end

context "when the date is last week" do
let(:date) { 7.days.ago(now) }

it "returns 'Waiting 7 days'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting 7 days")
it "returns 'Waiting for 7 days'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting for 7 days")
end
end

context "when the response threshold was reached last month" do
let(:date) { 30.days.ago(now) }

it "returns 'Waiting 30 days'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting 30 days")
it "returns 'Waiting for 30 days'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting for 30 days")
end
end

context "when the response threshold was reached 3 years ago" do
let(:date) { 1095.days.ago(now) }

it "returns 'Waiting 1,095 days'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting 1,095 days")
it "returns 'Waiting for 1,095 days'" do
expect(helper.waiting_for_in_words(date)).to eq("Waiting for 1,095 days")
end
end
end
Expand Down

0 comments on commit 73bd48d

Please sign in to comment.