Skip to content

Commit

Permalink
Initial pass at updating emails for the new parliament
Browse files Browse the repository at this point in the history
These can be done after opening:

- Debate outcomes
- Petition emails
- Petition mailshots
- Petitions closing early
- Petitions being stopped
  • Loading branch information
pixeltrix committed Oct 29, 2024
1 parent e480e21 commit 4e05285
Show file tree
Hide file tree
Showing 59 changed files with 535 additions and 664 deletions.
2 changes: 1 addition & 1 deletion app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class ApplicationMailer < ActionMailer::Base
default_url_options[:protocol] = Site.email_protocol
default from: ->(email){ Site.email_from }

helper :date_time, :rejection, :auto_link, :markdown, :moderation
helper :date_time, :rejection, :auto_link, :markdown, :moderation, :number

layout 'default_mail'
end
7 changes: 7 additions & 0 deletions app/mailers/sponsor_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class SponsorMailer < ApplicationMailer
include NumberHelper

def sponsor_signed_email_below_threshold(sponsor)
@petition, @sponsor = sponsor.petition, sponsor
@sponsor_count = @petition.sponsor_count
Expand Down Expand Up @@ -37,10 +39,15 @@ def subject_for(key, options = {})
def i18n_options
{}.tap do |options|
options[:scope] = :"petitions.emails.subjects"
options[:threshold] = number_to_word(Site.threshold_for_moderation)

if defined?(@sponsor)
options[:name] = @sponsor.name
end

if defined?(@petition)
options[:action] = @petition.action
end
end
end
end
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<%= render "reason" %>
<p>Dear <%= @signature.name %>,</p>

<p>Parliament is going to debate your petition – “<%= @petition.action %>”.</p>

<p><%= link_to nil, archived_petition_url(@petition) %></p>
<p>MPs are going to debate your petition – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.</p>

<p>The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.</p>

<p>Once the debate has happened, we’ll email you a video and transcript.</p>
<p>You can watch the debate live on <a href="http://www.youtube.com/ukparliament">Youtube</a> or <a href="https://parliamentlive.tv/Commons">parliamentlive.tv</a>.</p>

<p>You can read a <a href="https://hansard.parliament.uk/">transcript of the debate</a> a few hours after it ends.</p>

<p>After the debate, we’ll email you a video and transcript.</p>

<h3>Petition debates</h3>

<p>Petition debates allow MPs from all parties to discuss the issues raised by petitions.</p>

<p>They don’t end with a vote to implement the request of a petition.</p>

<p><a href="https://committees.parliament.uk/committee/326/petitions-committee/content/194347/how-petitions-debates-work/">Find out more</a></p>

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
<%= render "reason" %>
Dear <%= @signature.name %>,

Parliament is going to debate your petition – “<%= @petition.action %>”.

<%= archived_petition_url(@petition) %>
MPs are going to debate your petition – “<%= @petition.action %>”.

The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.

Once the debate has happened, we’ll email you a video and transcript.
You can watch the debate live on [Youtube][1] or [parliamentlive.tv][2].

You can read a [transcript of the debate][3] a few hours after it ends.

After the debate, we’ll email you a video and transcript.

### Petition debates

Petition debates allow MPs from all parties to discuss the issues raised by petitions.

They don’t end with a vote to implement the request of a petition.

[Find out more][4]

[1]: http://www.youtube.com/ukparliament
[2]: https://parliamentlive.tv/Commons
[3]: https://hansard.parliament.uk/
[4]: https://committees.parliament.uk/committee/326/petitions-committee/content/194347/how-petitions-debates-work/

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<%= render "reason" %>
<p>Dear <%= @signature.name %>,</p>

<p>The Government has responded to your petition – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.</p>

<p>Government responded:</p>
The <%= link_to "Government has responded", archived_petition_url(@petition, reveal_response: "yes") %> to your petition: “<%= @petition.action %>”.

<blockquote><%= auto_link(simple_format(h(@government_response.summary))) %></blockquote>

<blockquote><%= auto_link(simple_format(h(@government_response.details))) %></blockquote>

<p>Click this link to view the response online:</p>

<p><%= link_to nil, archived_petition_url(@petition, reveal_response: "yes") %></p>

<% if @petition.signature_count < @parliament.threshold_for_debate %>
<p>The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= @parliament.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.</p>
<% else %>
<p>This petition has over <%= @parliament.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.</p>
<% end %>

<p>The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %></p>
<p>If it reaches <%= Site.formatted_threshold_for_debate %> signatures, the Petitions Committee will consider whether MPs debate it in the House of Commons.</p>

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
<%= render "reason" %>
Dear <%= @signature.name %>,

The Government has responded to your petition – “<%= @petition.action %>”.

Government responded:
The Government has responded to your petition: “<%= @petition.action %>”.
<%= archived_petition_url(@petition, reveal_response: "yes") %>
<%= h(@government_response.summary) %>
<%= h(@government_response.details) %>

Click this link to view the response online:

<%= archived_petition_url(@petition, reveal_response: "yes") %>
<% if @petition.signature_count < Site.threshold_for_debate %>
The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= Site.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.
<% else %>
This petition has over <%= Site.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.
<% end %>

The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
If it reaches <%= Site.formatted_threshold_for_debate %> signatures, the Petitions Committee will consider whether MPs debate it in the House of Commons.

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
<%= render "reason" %>
<p>Dear <%= @signature.name %>,</p>

<p>Parliament is going to debate the petition you signed – “<%= @petition.action %>”.</p>

<p><%= link_to nil, archived_petition_url(@petition) %></p>
<p>MPs are going to debate the petition you signed: “<%= link_to @petition.action, archived_petition_url(@petition) %>”.</p>

<p>The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.</p>

<p>Once the debate has happened, we’ll email you a video and transcript.</p>
<p>You can watch the debate live on <a href="http://www.youtube.com/ukparliament">Youtube</a> or <a href="https://parliamentlive.tv/Commons">parliamentlive.tv</a>.</p>

<p>You can read a <a href="https://hansard.parliament.uk/">transcript of the debate</a> a few hours after it ends.</p>

<p>After the debate, we’ll email you a video and transcript.</p>

<h3>Petition debates</h3>

<p>Petition debates allow MPs from all parties to discuss the issues raised by petitions.</p>

<p>They don’t end with a vote to implement the request of a petition.</p>

<p><a href="https://committees.parliament.uk/committee/326/petitions-committee/content/194347/how-petitions-debates-work/">Find out more</a></p>

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
<%= render "reason" %>
Dear <%= @signature.name %>,

Parliament is going to debate the petition you signed – “<%= @petition.action %>”.

<%= archived_petition_url(@petition) %>
MPs are going to debate the petition you signed: “<%= @petition.action %>”.

The debate is scheduled for <%= short_date_format(@petition.scheduled_debate_date) %>.

Once the debate has happened, we’ll email you a video and transcript.
You can watch the debate live on [Youtube][1] or [parliamentlive.tv][2].

You can read a [transcript of the debate][3] a few hours after it ends.

After the debate, we’ll email you a video and transcript.

### Petition debates

Petition debates allow MPs from all parties to discuss the issues raised by petitions.

They don’t end with a vote to implement the request of a petition.

[Find out more][4]

[1]: http://www.youtube.com/ukparliament
[2]: https://parliamentlive.tv/Commons
[3]: https://hansard.parliament.uk/
[4]: https://committees.parliament.uk/committee/326/petitions-committee/content/194347/how-petitions-debates-work/

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
<%= render "reason" %>
<p>Dear <%= @signature.name %>,</p>

<p>The Government has responded to the petition you signed – “<%= link_to @petition.action, archived_petition_url(@petition) %>”.</p>

<p>Government responded:</p>
<p>The Government has responded to the petition you signed.</p>

<blockquote><%= auto_link(simple_format(h(@government_response.summary))) %></blockquote>

<blockquote><%= auto_link(simple_format(h(@government_response.details))) %></blockquote>

<p>Click this link to view the response online:</p>

<p><%= link_to nil, archived_petition_url(@petition, reveal_response: "yes") %></p>

<% if @petition.signature_count < @parliament.threshold_for_debate %>
<p>The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= @parliament.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.</p>
<% else %>
<p>This petition has over <%= @parliament.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.</p>
<% end %>
<p><%= link_to "Read the full response", archived_petition_url(@petition, reveal_response: "yes") %>.</p>

<p>The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= link_to nil, help_url(anchor: 'petitions-committee') %></p>
<p>If <%= Site.formatted_threshold_for_debate %> people sign the petition, the Petitions Committee will consider whether MPs debate it in Parliament.</p>

<%= render "footer" %>
<%= render "unsubscribe" %>
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
<%= render "reason" %>
Dear <%= @signature.name %>,

The Government has responded to the petition you signed – “<%= @petition.action %>”.

Government responded:
The Government has responded to the petition you signed.

<%= h(@government_response.summary) %>

<%= h(@government_response.details) %>

Click this link to view the response online:

Read the full response:
<%= archived_petition_url(@petition, reveal_response: "yes") %>

<% if @petition.signature_count < @parliament.threshold_for_debate %>
The Petitions Committee will take a look at this petition and its response. They can press the government for action and gather evidence. If this petition reaches <%= @parliament.formatted_threshold_for_debate %> signatures, the Committee will consider it for a debate.
<% else %>
This petition has over <%= @parliament.formatted_threshold_for_debate %> signatures. The Petitions Committee will consider it for a debate. They can also gather further evidence and press the government for action.
<% end %>

The Committee is made up of 11 MPs, from political parties in government and in opposition. It is entirely independent of the Government. Find out more about the Committee: <%= help_url(anchor: 'petitions-committee') %>
If <%= Site.formatted_threshold_for_debate %> people sign the petition, the Petitions Committee will consider whether MPs debate it in Parliament.

<%= render "footer" %>
<%= render "unsubscribe" %>
39 changes: 33 additions & 6 deletions app/views/layouts/default_mail.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,39 @@
<html>
<head>
<style type="text/css">
p, li {
font-family: arial;
line-height: 1.55em;
margin-bottom: 18px;
}
h3 {
font-family: arial;
line-height: 1.55em;
margin-top: 24px;
margin-bottom: 6px;
}

hr {
background-color: #666;
border: none;
height: 1px;
margin: 18px 0;
}

p, ul, ol, li {
font-family: arial;
line-height: 1.55em;
margin: 0;
}

p {
margin-top: 12px;
margin-bottom: 18px;
}

li {
margin-bottom: 6px;
}

ul, ol {
margin-bottom: 18px;
padding-left: 1.5em;
}
</style>
</head>

Expand Down Expand Up @@ -37,4 +65,3 @@
</table>
</body>
</html>

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p>Click this link to sign the petition "<%= @petition.action %>"</p>
<p>Dear <%= @signature.name %>,</p>

<p><%= link_to nil, verify_signature_url(@signature, token: @signature.perishable_token) %></p>
<p>Please <%= link_to "confirm your email", verify_signature_url(@signature, token: @signature.perishable_token) %> to sign the petition: “<%= link_to @petition.action, petition_url(@petition) %>”.</p>

<%= render "footer" %>
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Click this link to sign the petition "<%= @petition.action %>"
Dear <%= @signature.name %>,

Please confirm your email:
<%= verify_signature_url(@signature, token: @signature.perishable_token) %>

to sign the petition “<%= @petition.action %>”:
<%= petition_url(@petition) %>
<%= render "footer" %>
7 changes: 4 additions & 3 deletions app/views/petition_mailer/email_duplicate_signatures.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<p>You're receiving this email because your email has been used to sign the petition “<%= @petition.action %>”, but you have already signed this petition.</p>
<p>Dear <%= @signature.name %>,</p>

<p>View the petition “<%= @petition.action %>” at: <br />
<%= link_to nil, petition_url(@petition) %></p>
<p>Your email has been used to sign the petition: “<%= link_to @petition.action, petition_url(@petition) %>”.</p>

<p>You have already signed it, so your signature cannot be accepted.</p>

<%= render "footer" %>
6 changes: 4 additions & 2 deletions app/views/petition_mailer/email_duplicate_signatures.text.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
You're receiving this email because your email has been used to sign the petition “<%= @petition.action %>”, but you have already signed this petition.
Dear <%= @signature.name %>,

View the petition “<%= @petition.action %>” at:
Your email has been used to sign the petition “<%= @petition.action %>":
<%= petition_url(@petition) %>

You have already signed it, so your signature cannot be accepted.

<%= render "footer" %>
Loading

0 comments on commit 4e05285

Please sign in to comment.