Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from openpolitics/emails
Add email notification for new votes
- Loading branch information
Showing
25 changed files
with
287 additions
and
626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
class ProposalsMailer < ApplicationMailer | ||
|
||
def new_proposal(recipient, proposal) | ||
@recipient = recipient | ||
@proposal = proposal | ||
mail to: recipient.email, subject: t("proposals_mailer.new.subject") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Hi, | ||
|
||
<p> | ||
A new proposal has been submitted to the OpenPolitics Manifesto, and as a | ||
previous contributor you can vote on whether or not it's accepted. | ||
</p> | ||
|
||
<h2> | ||
<strong>Proposal:</strong> <%= link_to @proposal.title, @proposal.url %> | ||
</h2> | ||
|
||
<p> | ||
Up-to-date voting instructions can be found in the comments. | ||
</p> | ||
|
||
<p> | ||
thanks,<br/> | ||
The OpenPolitics Team | ||
</p> | ||
|
||
<p> | ||
P.S. You are receiving this email because you are a contributor to the OpenPolitics | ||
Manifesto. If you don't want to receive notifications like this in future, | ||
please update your email preferences on | ||
<a href="<%= ENV['SITE_URL'] %>/users/<%= @recipient.login %>/edit">your settings page</a>. | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Hi, | ||
|
||
A new proposal has been submitted to the OpenPolitics Manifesto, and as a | ||
previous contributor you can vote on whether or not it's accepted. | ||
|
||
<%= @proposal.title %>: <%= @proposal.url %> | ||
|
||
Up-to-date voting instructions can be found in the comments. | ||
|
||
thanks, | ||
The OpenPolitics Team | ||
|
||
P.S. You are receiving this email because you are a contributor to the | ||
OpenPolitics Manifesto. If you don't want to receive notifications like this | ||
in future, please update your email settings at | ||
<%= ENV['SITE_URL'] %>/users/<%= @recipient.login %>/edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
task :update => :environment do | ||
Rails.logger = ActiveSupport::Logger.new(STDOUT) | ||
User.update_all_from_github! | ||
Proposal.recreate_all_from_github! | ||
Proposal.update_all_from_github! | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
FactoryGirl.define do | ||
|
||
factory :proposal do | ||
number { Faker::Number.number(3) } | ||
state "waiting" | ||
title { Faker::Book.title } | ||
#proposer - send this in | ||
opened_at { Time.now } | ||
|
||
# Don't run load_from_github callback when creating from factory, but put it back after | ||
after(:build) do |x| | ||
x.class.skip_callback(:validation, :before, :load_from_github) | ||
x.class.skip_callback(:create, :after, :count_votes!) | ||
end | ||
after(:create) do |x| | ||
x.class.set_callback(:create, :after, :count_votes!) | ||
x.class.set_callback(:validation, :before, :load_from_github, on: :create) | ||
end | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FactoryGirl.define do | ||
|
||
factory :user do | ||
login { Faker::Internet.user_name } | ||
contributor true | ||
email { Faker::Internet.email } | ||
avatar_url { Faker::Internet.url } | ||
provider "github" | ||
|
||
# Don't run load_from_github callback when creating from factory, but put it back after | ||
after(:build) { |x| x.class.skip_callback(:validation, :before, :load_from_github) } | ||
after(:create) { |x| x.class.set_callback(:validation, :before, :load_from_github, on: :create)} | ||
end | ||
|
||
end |
Oops, something went wrong.