adds option to receive email digest

This commit is contained in:
rgarcia
2016-06-14 18:08:27 +02:00
parent 6e800c5120
commit 9f19a5d143
6 changed files with 20 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ class AccountController < ApplicationController
if @account.organization?
params.require(:account).permit(:phone_number, :email_on_comment, :email_on_comment_reply, :newsletter, organization_attributes: [:name, :responsible_name])
else
params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :newsletter)
params.require(:account).permit(:username, :public_activity, :email_on_comment, :email_on_comment_reply, :email_on_proposal_notification, :email_digest, :newsletter)
end
end

View File

@@ -78,6 +78,15 @@
<% end %>
</div>
<div>
<%= f.label :email_digest do %>
<%= f.check_box :email_digest, title: t('account.show.email_digest_label'), label: false %>
<span class="checkbox">
<%= t("account.show.email_digest_label") %>
</span>
<% end %>
</div>
<%= f.submit t("account.show.save_changes_submit"), class: "button" %>
</div>

View File

@@ -16,6 +16,7 @@ en:
save_changes_submit: Save changes
subscription_to_website_newsletter_label: Receive by email website relevant information
email_on_proposal_notification_label: Receive by email notifications about proposals
email_digest_label: Receive a summary of proposal notifications
title: My account
user_permission_debates: Participate on debates
user_permission_info: With your account you can...

View File

@@ -16,6 +16,7 @@ es:
save_changes_submit: Guardar cambios
subscription_to_website_newsletter_label: Recibir emails con información interesante sobre la web
email_on_proposal_notification_label: Recibir emails con notificaciones sobre propuestas
email_digest_label: Recibir resumen de notificaciones sobre propuestas
title: Mi cuenta
user_permission_debates: Participar en debates
user_permission_info: Con tu cuenta ya puedes...

View File

@@ -36,6 +36,7 @@ feature 'Account' do
check 'account_email_on_comment'
check 'account_email_on_comment_reply'
uncheck 'account_email_on_proposal_notification'
uncheck 'account_email_digest'
click_button 'Save changes'
expect(page).to have_content "Changes saved"
@@ -45,7 +46,7 @@ feature 'Account' do
expect(page).to have_selector("input[value='Larry Bird']")
expect(find("#account_email_on_comment")).to be_checked
expect(find("#account_email_on_comment_reply")).to be_checked
expect(find("#account_email_on_proposal_notification")).to_not be_checked
expect(find("#account_email_digest")).to_not be_checked
end
scenario 'Edit Organization' do

View File

@@ -89,6 +89,12 @@ describe User do
expect(subject.email_on_proposal_notification).to eq(true)
end
end
describe 'email_digest' do
it 'should be true by default' do
expect(subject.email_digest).to eq(true)
end
end
end
describe "administrator?" do