From 31aac21a2b1f6453c36456fcd093916317a844cd Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 29 Mar 2016 11:38:04 +0200 Subject: [PATCH 1/2] redirect to login when creating new spending proposal --- app/controllers/spending_proposals_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/spending_proposals_controller.rb b/app/controllers/spending_proposals_controller.rb index 9b64c462d..1c2c83047 100644 --- a/app/controllers/spending_proposals_controller.rb +++ b/app/controllers/spending_proposals_controller.rb @@ -1,9 +1,10 @@ class SpendingProposalsController < ApplicationController include FeatureFlags + before_action :authenticate_user!, except: [:index] + load_and_authorize_resource - before_action :authenticate_user!, except: [:index] before_action :verify_access, only: [:show] before_filter -> { flash.now[:notice] = flash[:notice].html_safe if flash[:html_safe] && flash[:notice] } From 595c5485d6aa25511676546ad86281c9505a4e78 Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 29 Mar 2016 11:38:54 +0200 Subject: [PATCH 2/2] adds code to email body --- app/views/mailer/unfeasible_spending_proposal.html.erb | 2 +- config/locales/mailers.en.yml | 2 +- config/locales/mailers.es.yml | 2 +- spec/features/emails_spec.rb | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/mailer/unfeasible_spending_proposal.html.erb b/app/views/mailer/unfeasible_spending_proposal.html.erb index fa4e3cf96..1e55106f1 100644 --- a/app/views/mailer/unfeasible_spending_proposal.html.erb +++ b/app/views/mailer/unfeasible_spending_proposal.html.erb @@ -20,7 +20,7 @@

- <%= t("mailers.unfeasible_spending_proposal.reconsider_html") %> + <%= t("mailers.unfeasible_spending_proposal.reconsider_html", code: @spending_proposal.code) %>

diff --git a/config/locales/mailers.en.yml b/config/locales/mailers.en.yml index 9e18435dd..16cc762d6 100755 --- a/config/locales/mailers.en.yml +++ b/config/locales/mailers.en.yml @@ -24,7 +24,7 @@ en: hi: "Dear user," new_html: "For all these, we invite you to elaborate a new proposal that ajusts to the conditions of this process. You can do it following this link: %{url}." new_href: "new investment project" - reconsider_html: "If you believe that the rejected proposal meets the requirements to be an investment proposal, you can communicate this, within 48 hours, responding to the email address preparticipativos@madrid.es. Please include all relevant information to reconsider the proposal as valid." + reconsider_html: "If you believe that the rejected proposal meets the requirements to be an investment proposal, you can communicate this, within 48 hours, responding to the email address preparticipativos@madrid.es. Including the code %{code} in the subject of the email." sincerely: "Sincerely" signatory: "DEPARTMENT OF PUBLIC PARTICIPATION" sorry: "Sorry for the inconvenience and we again thank you for your invaluable participation." diff --git a/config/locales/mailers.es.yml b/config/locales/mailers.es.yml index 2e11604a3..8a16c00ec 100644 --- a/config/locales/mailers.es.yml +++ b/config/locales/mailers.es.yml @@ -24,7 +24,7 @@ es: hi: "Estimado usuario," new_html: "Por todo ello, te invitamos a que elabores una nueva propuesta que se ajuste a las condiciones de este proceso. Esto lo puedes hacer en este enlace: %{url}." new_href: "nueva propuesta de inversión" - reconsider_html: "Si consideras que la propuesta rechazada cumple los requisitos para mantenerla como propuesta de inversión, podrás comunicarlo, en el plazo de 48 horas, al correo preparticipativos@madrid.es. Por favor incluye toda la información relevante para reconsiderar la propuesta como válida." + reconsider_html: "Si consideras que la propuesta rechazada cumple los requisitos para mantenerla como propuesta de inversión, podrás comunicarlo, en el plazo de 48 horas, al correo preparticipativos@madrid.es, indicando necesariamente para su tramitación el código %{code} como asunto del correo, correspondiente a tu propuesta." sincerely: "Atentamente" signatory: "DIRECCIÓN GENERAL DE PARTICIPACIÓN CIUDADANA" sorry: "Sentimos las molestias ocasionadas y volvemos a darte las gracias por tu inestimable participación." diff --git a/spec/features/emails_spec.rb b/spec/features/emails_spec.rb index c6d675a73..4d813493d 100644 --- a/spec/features/emails_spec.rb +++ b/spec/features/emails_spec.rb @@ -144,6 +144,7 @@ feature 'Emails' do expect(email).to have_subject("Your investment project '#{spending_proposal.id}-A#{spending_proposal.administrator.id}' has been marked as unfeasible") expect(email).to deliver_to(spending_proposal.author.email) expect(email).to have_body_text(spending_proposal.title) + expect(email).to have_body_text(spending_proposal.code) expect(email).to have_body_text(spending_proposal.feasible_explanation) end