Skip to content

Commit

Permalink
Merge pull request #367 from alphagov/must-use-real-name
Browse files Browse the repository at this point in the history
Admin improvements
  • Loading branch information
alanth committed Aug 4, 2015
2 parents 7904a8e + 8da610f commit 6b54fd0
Show file tree
Hide file tree
Showing 15 changed files with 50 additions and 59 deletions.
6 changes: 2 additions & 4 deletions app/assets/stylesheets/petitions/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ select.form-control:hover {
}

.form-label {
margin-bottom: em(13, 19);
margin-bottom: 10px;

.optional {
color: $secondary-text-colour;
Expand All @@ -81,7 +81,5 @@ select.form-control:hover {
}

.form-hint {
@include media (tablet) {
margin-top: 5px;
}
margin-top: 10px;
}
2 changes: 1 addition & 1 deletion app/assets/stylesheets/petitions/admin/_meta.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.admin {
.petition-meta {
padding-top: $gutter-two-thirds;
padding-top: $gutter *1.5;

dl {
dt {
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/notes/_petition_action_notes.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<%= form_row :for => [f.object, :admin_notes] do %>
<%= f.label :details, 'Notes', class: 'form-label petition-action-heading' %>
<%= error_messages_for_field f.object, :admin_notes %>
<%= f.text_area :details, tabindex: increment, class: 'form-control' %>
<%= f.text_area :details, tabindex: increment, rows: 10, class: 'form-control' %>
<div class="form-group-help">
<details>
<summary class="summary">How to use tags</summary>
Expand Down
6 changes: 6 additions & 0 deletions app/views/admin/petitions/_petition_content.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
</details>
<% end %>
<% end %>

<% if @petition.rejected? or @petition.hidden? -%>
<h2>This petition was rejected</h2>
<p><%= rejection_reason(@petition.rejection.code) %></p>
<%= auto_link(simple_format(@petition.rejection.details)) %>
<% end -%>
3 changes: 2 additions & 1 deletion app/views/petitions/_rejected_petition_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

<p class="flash-notice">This petition was rejected</p>

<h2>Reasons for rejection</h2>
<h2>Why was this petition rejected?</h2>
<%= rejection_description(petition.rejection.code) %>
<% if petition.rejection.details? %>
<p><%= auto_link(simple_format(petition.rejection.details)) %></p>
<% end %>
<p>We only reject petitions that don’t meet the <%= link_to 'petition standards', help_url(anchor: 'standards') %>.</p>

<ul class="petition-meta">
<li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/petitions/create/_your_details_ui.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<%= render :partial => 'signatures/form', :locals => { :f => csf, :signature => csf.object, :context => 'create-petition' } %>
<% end %>

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

<section class="secondary">
<p>Your name will be published on this petition as the petition creator.</p>
Expand Down
3 changes: 3 additions & 0 deletions app/views/signatures/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
<%= f.label :name, :class => 'form-label' %>
<%= 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>
<% end %>
<% end %>

<%= render 'signatures/email', f: f, signature: signature, hide_label: false %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/signatures/create/_signer_ui.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<%= render 'signatures/form', f: f, signature: signature, context: 'sign' %>

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

<section class="secondary">
<p>We won't publish your personal details anywhere or use them for anything other than this petition.</p>
Expand Down
49 changes: 16 additions & 33 deletions config/locales/rejections.en-GB.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,26 @@
en-GB:
rejections:
titles:
no-action: "Does not include a request for action"
duplicate: "Duplicate of an existing petition"
libellous: "Confidential, libellous, false or defamatory statements"
offensive: "Offensive, joke or nonsense petitions"
irrelevant: "Matters which are not the responsibility of HM Government"
honours: "Matters relating to honours or appointments"
no-action: "Action unclear"
duplicate: "Duplicate petition"
libellous: "Confidential, libellous, false or defamatory"
offensive: "Offensive, joke or nonsense"
irrelevant: "Not the government’s responsibility"
honours: "Honours or appointments"
fake-name: "Fake name"
descriptions:
no-action: |-
<p>It did not have a clear statement explaining what action you want the government to take.</p>
<p>It’s not clear what action the petition is asking for.</p>
duplicate: |-
<p>There is already a petition about this issue.</p>
<p>There’s already a petition about this issue.</p>
fake-name: |-
<p>It was created using a fake name.</p>
libellous: |-
<p>Petitions will not be accepted if they:</p>
<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>
<li>include the names of individual officials who work for public bodies, unless they are part of the senior management of those organisations</li>
<li>include the names of family members of elected representatives, eg MPs, or officials who work for public bodies</li>
</ul>
<p>It included confidential, libellous, false or defamatory information.</p>
offensive: |-
<p>Petitions will not be accepted if they:</p>
<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>
<p>It’s offensive, nonsense or a joke</p>
irrelevant: |-
<p>Petitions cannot be used to request action on issues that are outside the responsibility of the government. This includes:</p>
<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>
<li>correspondence on personal issues</li>
</ul>
<p>Petitions cannot be used for freedom of information requests.</p>
<p>It’s about something that the UK Government or Parliament is not responsible for</p>
honours: |-
<p>Petitions cannot include information about honours or appointments.</p>
<p>Find information about nominations for honours at: <a href="https://www.gov.uk/honours" rel="external">https://www.gov.uk/honours</a></p>
<p>It’s about honours or appointments.</p>
<p>There’s a different way to nominate someone for an honour: <a href="https://www.gov.uk/honours" rel="external">https://www.gov.uk/honours</a></p>
8 changes: 4 additions & 4 deletions features/admin/moderator_responds_to_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Feature: Moderator respond to petition
Scenario: Moderator rejects petition with a suitable reason code
Given I am logged in as a moderator
When I look at the next petition on my list
And I reject the petition with a reason code "Matters which are not the responsibility of HM Government"
And I reject the petition with a reason code "Not the government’s responsibility"
Then the petition is not available for signing
But the petition is still available for searching or viewing

Expand All @@ -72,14 +72,14 @@ Feature: Moderator respond to petition
Scenario: Moderator rejects petition with a suitable reason code and text
Given I am logged in as a moderator
When I look at the next petition on my list
And I reject the petition with a reason code "Duplicate of an existing petition" and some explanatory text
And I reject the petition with a reason code "Duplicate petition" and some explanatory text
Then the explanation is displayed on the petition for viewing by the public
And the creator should receive a rejection notification email

Scenario: Moderator rejects petition with a reason code which precludes public searching or viewing
Given I am logged in as a moderator
When I look at the next petition on my list
And I reject the petition with a reason code "Confidential, libellous, false or defamatory statements (will be hidden)"
And I reject the petition with a reason code "Confidential, libellous, false or defamatory (will be hidden)"
And the creator should receive a libel/profanity rejection notification email
And the petition is not available for searching or viewing
But the petition will still show up in the back-end reporting
Expand All @@ -96,7 +96,7 @@ Feature: Moderator respond to petition
And I am logged in as a moderator
And a petition "actually libellous" has been rejected with the reason "duplicate"
When I go to the admin petition page for "actually libellous"
And I change the rejection status of the petition with a reason code "Confidential, libellous, false or defamatory statements (will be hidden)"
And I change the rejection status of the petition with a reason code "Confidential, libellous, false or defamatory (will be hidden)"
Then the petition is not available for searching or viewing
But the petition will still show up in the back-end reporting

Expand Down
4 changes: 2 additions & 2 deletions features/admin/takedown.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Feature: Terry (or Sheila) takes down a petition
Given I am logged in as a sysadmin
When I view all petitions
And I follow "Mistakenly published petition"
And I take down the petition with a reason code "Duplicate of an existing petition"
And I take down the petition with a reason code "Duplicate petition"
Then the petition is not available for signing
And I should not be able to take down the petition

Scenario: A moderator can take down a petition
Given I am logged in as a moderator
When I view all petitions
And I follow "Mistakenly published petition"
And I take down the petition with a reason code "Duplicate of an existing petition"
And I take down the petition with a reason code "Duplicate petition"
Then the petition is not available for signing
And I should not be able to take down the petition
10 changes: 5 additions & 5 deletions features/charlie_creates_a_petition.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Scenario: Charlie creates a petition
And I press "Preview petition"
And I press "This looks good"
And I fill in my details
When I press "Sign this petition"
When I press "Continue"
Then the markup should be valid
And I am asked to review my email address
When I press "Yes – this is my email address"
Expand All @@ -49,7 +49,7 @@ Scenario: Charlie creates a petition with invalid postcode SW14 9RQ
And I press "Preview petition"
And I press "This looks good"
And I fill in my details with postcode "SW14 9RQ"
And I press "Sign this petition"
And I press "Continue"
Then I should not see the text "Your constituency is"

@javascript
Expand Down Expand Up @@ -91,21 +91,21 @@ Scenario: Charlie tries to submit an invalid petition

Then I should see a heading called "Sign your petition"

When I press "Sign this petition"
When I press "Continue"
Then I should see "Name must be completed"
And I should see "Email must be completed"
And I should see "You must be a British citizen"
And I should see "Postcode must be completed"

When I fill in my details
And I press "Sign this petition"
And I press "Continue"

Then I should see a heading called "Make sure this is right"

And I press "Back"
And I fill in "Name" with "Mr. Wibbledon"

And I press "Sign this petition"
And I press "Continue"

Then I should see a heading called "Make sure this is right"

Expand Down
6 changes: 3 additions & 3 deletions features/step_definitions/moderation_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@

Then /^I see relevant reason descriptions when I browse different reason codes$/ do
choose "Reject"
select "Duplicate of an existing petition", :from => :petition_rejection_code
select "Duplicate petition", :from => :petition_rejection_code
expect(page).to have_content "already a petition"
select "Confidential, libellous, false or defamatory statements", :from => :petition_rejection_code
expect(page).to have_content "injunction or court order"
select "Confidential, libellous, false or defamatory", :from => :petition_rejection_code
expect(page).to have_content "It included confidential, libellous, false or defamatory information."
end

Given(/^a moderator responds to the petition$/) do
Expand Down
2 changes: 1 addition & 1 deletion features/step_definitions/signature_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
end

When /^I try to sign$/ do
click_button "Sign this petition"
click_button "Continue"
end

Then /^I am told to check my inbox to complete signing$/ do
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/rejection_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@

describe "#rejection_reason" do
it "gives rejection reason from the locale file" do
expect(helper.rejection_reason(code)).to eq("Duplicate of an existing petition")
expect(helper.rejection_reason(code)).to eq("Duplicate petition")
end
end

describe "#rejection_description" do
it "gives rejection description from the locale file" do
expect(helper.rejection_description(code)).to eq('<p>There is already a petition about this issue.</p>')
expect(helper.rejection_description(code)).to eq('<p>There’s already a petition about this issue.</p>')
end

it "is HTML safe" do
Expand Down

0 comments on commit 6b54fd0

Please sign in to comment.