From 8fda0bfb6c4f6323e6fdae8938291f3c53891c67 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 14 May 2019 11:35:24 +0200 Subject: [PATCH 1/8] Add help text to slug on admin new site customization pages --- .../admin/site_customization/pages/_form.html.erb | 12 ++++++------ config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/views/admin/site_customization/pages/_form.html.erb b/app/views/admin/site_customization/pages/_form.html.erb index 5dbbe651e..90075a24b 100644 --- a/app/views/admin/site_customization/pages/_form.html.erb +++ b/app/views/admin/site_customization/pages/_form.html.erb @@ -18,22 +18,22 @@
-
+

<%= t("admin.site_customization.pages.form.options") %>

- <%= f.check_box :more_info_flag, class: "small" %> - <%= f.check_box :print_content_flag %> -
-
<%= f.label :status %> <% ::SiteCustomization::Page::VALID_STATUSES.each do |status| %> <%= f.radio_button :status, status, label: false %> <%= f.label "status_#{status}", t("admin.site_customization.pages.page.status_#{status}") %>
<% end %> + + <%= f.check_box :more_info_flag, class: "small" %> + <%= f.check_box :print_content_flag %>
-
+
<%= f.label :slug %> +

<%= t("admin.site_customization.pages.new.slug_help_html") %> <%= f.text_field :slug, label: false, size: 80, maxlength: 80 %>

diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 1d7c110f3..db1722d05 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -1600,6 +1600,7 @@ en: see_page: See page new: title: Create new custom page + slug_help_html: "Text to identify this page on URL, for example https://consulproject.org/page-slug" page: created_at: Created at status: Status diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 659e0fcb3..e6bbf7d24 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -1599,6 +1599,7 @@ es: see_page: Ver página new: title: Página nueva + slug_help_html: "Texto que identifica esta página en la URL, por ejemplo https://consulproject.org/slug-de-pagina" page: created_at: Creada status: Estado From 33c06ea0d31cf8aad6882e2c23a28e1472fe29e4 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 14 May 2019 12:27:19 +0200 Subject: [PATCH 2/8] Add help text to admin poll officers search --- app/views/admin/poll/officers/_search.html.erb | 2 ++ config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + 3 files changed, 4 insertions(+) diff --git a/app/views/admin/poll/officers/_search.html.erb b/app/views/admin/poll/officers/_search.html.erb index 92e8a2de5..4e5574d07 100644 --- a/app/views/admin/poll/officers/_search.html.erb +++ b/app/views/admin/poll/officers/_search.html.erb @@ -1,3 +1,5 @@ +

<%= t("admin.poll_officers.search.help") %>

+ <%= form_tag search_admin_officers_path, method: :get, remote: true do %>
<%= text_field_tag :email, "", diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index db1722d05..9193f84db 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -950,6 +950,7 @@ en: email_placeholder: Search user by email search: Search user_not_found: User not found + help: "To add or remove Poll officers use the search form below." poll_officer_assignments: index: officers_title: "List of officers" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index e6bbf7d24..09af28447 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -949,6 +949,7 @@ es: email_placeholder: Buscar usuario por email search: Buscar user_not_found: Usuario no encontrado + help: "Para añadir o eliminar Presidentes de mesa utiliza el buscador a continuación." poll_officer_assignments: index: officers_title: "Listado de presidentes de mesa asignados" From 0c704c2f06f3f92bb1de2f734799fd77c8dec083 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 14 May 2019 16:28:38 +0200 Subject: [PATCH 3/8] Replace i18n destroy to delete --- config/locales/en/admin.yml | 10 +++++----- config/locales/en/community.yml | 2 +- config/locales/en/documents.yml | 4 ++-- config/locales/en/images.yml | 2 +- spec/features/admin/budget_groups_spec.rb | 2 +- spec/features/admin/budget_headings_spec.rb | 2 +- spec/features/admin/budgets_spec.rb | 4 ++-- spec/features/admin/tags_spec.rb | 4 ++-- spec/features/topics_specs.rb | 4 ++-- spec/shared/features/documentable.rb | 14 +++++++------- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 9193f84db..1c2ca77f1 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -106,8 +106,8 @@ en: blank_dates: Dates are blank destroy: success_notice: Budget deleted successfully - unable_notice: You cannot destroy a budget that has associated investments - unable_notice_polls: You cannot destroy a budget that has an associated poll + unable_notice: You cannot delete a budget that has associated investments + unable_notice_polls: You cannot delete a budget that has an associated poll new: title: New participatory budget winners: @@ -130,7 +130,7 @@ en: notice: "Group updated successfully" destroy: success_notice: "Group deleted successfully" - unable_notice: "You cannot destroy a Group that has associated headings" + unable_notice: "You cannot delete a Group that has associated headings" form: create: "Create new group" edit: "Edit group" @@ -150,7 +150,7 @@ en: notice: "Heading updated successfully" destroy: success_notice: "Heading deleted successfully" - unable_notice: "You cannot destroy a Heading that has associated investments" + unable_notice: "You cannot delete a Heading that has associated investments" form: name: "Heading name" amount: "Amount" @@ -1507,7 +1507,7 @@ en: origin_total: Total participants tags: create: Create topic - destroy: Destroy topic + destroy: Delete topic index: add_tag: Add a new proposal topic title: Proposal topics diff --git a/config/locales/en/community.yml b/config/locales/en/community.yml index bcda80b6c..3e46a0685 100644 --- a/config/locales/en/community.yml +++ b/config/locales/en/community.yml @@ -26,7 +26,7 @@ en: new_topic: Create topic topic: edit: Edit topic - destroy: Destroy topic + destroy: Delete topic comments: one: 1 comment other: "%{count} comments" diff --git a/config/locales/en/documents.yml b/config/locales/en/documents.yml index 8aa127a9f..d2a6f75b3 100644 --- a/config/locales/en/documents.yml +++ b/config/locales/en/documents.yml @@ -14,11 +14,11 @@ en: actions: destroy: notice: Document was deleted successfully. - alert: Cannot destroy document. + alert: Cannot delete document. confirm: Are you sure you want to delete the document? This action cannot be undone! buttons: download_document: Download file - destroy_document: Destroy document + destroy_document: Delete document errors: messages: in_between: must be in between %{min} and %{max} diff --git a/config/locales/en/images.yml b/config/locales/en/images.yml index 14ca43c2d..a059f185b 100644 --- a/config/locales/en/images.yml +++ b/config/locales/en/images.yml @@ -14,7 +14,7 @@ en: actions: destroy: notice: Image was deleted successfully. - alert: Cannot destroy image. + alert: Cannot delete image. errors: messages: in_between: must be in between %{min} and %{max} diff --git a/spec/features/admin/budget_groups_spec.rb b/spec/features/admin/budget_groups_spec.rb index f719dc6a8..14f76c319 100644 --- a/spec/features/admin/budget_groups_spec.rb +++ b/spec/features/admin/budget_groups_spec.rb @@ -91,7 +91,7 @@ feature "Admin budget groups" do visit admin_budget_groups_path(budget) within("#budget_group_#{group.id}") { click_link "Delete" } - expect(page).to have_content "You cannot destroy a Group that has associated headings" + expect(page).to have_content "You cannot delete a Group that has associated headings" expect(page).to have_selector "#budget_group_#{group.id}" end diff --git a/spec/features/admin/budget_headings_spec.rb b/spec/features/admin/budget_headings_spec.rb index 2429b1ad4..dac63ba04 100644 --- a/spec/features/admin/budget_headings_spec.rb +++ b/spec/features/admin/budget_headings_spec.rb @@ -94,7 +94,7 @@ feature "Admin budget headings" do visit admin_budget_group_headings_path(budget, group) within("#budget_heading_#{heading.id}") { click_link "Delete" } - expect(page).to have_content "You cannot destroy a Heading that has associated investments" + expect(page).to have_content "You cannot delete a Heading that has associated investments" expect(page).to have_selector "#budget_heading_#{heading.id}" end diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index a4c1620a6..3bc827caf 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -148,7 +148,7 @@ feature "Admin budgets" do click_link "Edit budget" click_link "Delete budget" - expect(page).to have_content("You cannot destroy a budget that has associated investments") + expect(page).to have_content("You cannot delete a budget that has associated investments") expect(page).to have_content("There is 1 budget") end @@ -158,7 +158,7 @@ feature "Admin budgets" do visit edit_admin_budget_path(budget) click_link "Delete budget" - expect(page).to have_content("You cannot destroy a budget that has an associated poll") + expect(page).to have_content("You cannot delete a budget that has an associated poll") expect(page).to have_content("There is 1 budget") end end diff --git a/spec/features/admin/tags_spec.rb b/spec/features/admin/tags_spec.rb index 5580ad7b7..3102df400 100644 --- a/spec/features/admin/tags_spec.rb +++ b/spec/features/admin/tags_spec.rb @@ -40,7 +40,7 @@ feature "Admin tags" do expect(page).to have_content tag2.name within("#tag_#{tag2.id}") do - click_link "Destroy topic" + click_link "Delete topic" end visit admin_tags_path @@ -59,7 +59,7 @@ feature "Admin tags" do expect(page).to have_content tag2.name within("#tag_#{tag2.id}") do - click_link "Destroy topic" + click_link "Delete topic" end visit admin_tags_path diff --git a/spec/features/topics_specs.rb b/spec/features/topics_specs.rb index 0169af157..6af83bb2e 100644 --- a/spec/features/topics_specs.rb +++ b/spec/features/topics_specs.rb @@ -137,7 +137,7 @@ feature "Topics" do login_as(user) visit community_topic_path(community, topic) - click_link "Destroy topic" + click_link "Delete topic" expect(page).to have_content "Topic deleted successfully." expect(page).not_to have_content topic.title @@ -153,7 +153,7 @@ feature "Topics" do visit community_path(community) - expect(page).not_to have_link "Destroy" + expect(page).not_to have_link "Delete" end end diff --git a/spec/shared/features/documentable.rb b/spec/shared/features/documentable.rb index e3be2c869..64387420d 100644 --- a/spec/shared/features/documentable.rb +++ b/spec/shared/features/documentable.rb @@ -42,28 +42,28 @@ shared_examples "documentable" do |documentable_factory_name, scenario "Should not be able when no user logged in" do visit send(documentable_path, arguments) - expect(page).not_to have_link("Destroy document") + expect(page).not_to have_link("Delete document") end scenario "Should be able when documentable author is logged in" do login_as documentable.author visit send(documentable_path, arguments) - expect(page).to have_link("Destroy document") + expect(page).to have_link("Delete document") end scenario "Administrators cannot destroy documentables they have not authored" do login_as(administrator) visit send(documentable_path, arguments) - expect(page).not_to have_link("Destroy document") + expect(page).not_to have_link("Delete document") end scenario "Users cannot destroy documentables they have not authored" do login_as(create(:user)) visit send(documentable_path, arguments) - expect(page).not_to have_link("Destroy document") + expect(page).not_to have_link("Delete document") end end @@ -122,7 +122,7 @@ shared_examples "documentable" do |documentable_factory_name, visit send(documentable_path, arguments) within "#document_#{document.id}" do - click_on "Destroy document" + click_on "Delete document" end expect(page).to have_content "Document was deleted successfully." @@ -134,7 +134,7 @@ shared_examples "documentable" do |documentable_factory_name, visit send(documentable_path, arguments) within "#document_#{document.id}" do - click_on "Destroy document" + click_on "Delete document" end expect(page).not_to have_content "Documents (0)" @@ -146,7 +146,7 @@ shared_examples "documentable" do |documentable_factory_name, visit send(documentable_path, arguments) within "#document_#{document.id}" do - click_on "Destroy document" + click_on "Delete document" end within "##{dom_id(documentable)}" do From 625c34bac2520221aa816c15e99c4e26879a4c83 Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 14 May 2019 16:28:50 +0200 Subject: [PATCH 4/8] Add officer email on admin poll shifts table --- app/views/admin/poll/shifts/_shifts.html.erb | 2 ++ spec/features/admin/poll/shifts_spec.rb | 3 +++ 2 files changed, 5 insertions(+) diff --git a/app/views/admin/poll/shifts/_shifts.html.erb b/app/views/admin/poll/shifts/_shifts.html.erb index 66d64ed22..51ceb731d 100644 --- a/app/views/admin/poll/shifts/_shifts.html.erb +++ b/app/views/admin/poll/shifts/_shifts.html.erb @@ -4,6 +4,7 @@ <%= t("admin.poll_shifts.new.date") %> <%= t("admin.poll_shifts.new.officer") %> + <%= t("admin.poll_shifts.new.table_email") %> <%= t("admin.poll_shifts.new.task") %> <%= t("admin.poll_shifts.new.shift") %> @@ -13,6 +14,7 @@ <%= l(shift.date.to_date, format: :long) %> <%= shift.officer_name %> + <%= shift.officer_email %> <%= t("admin.poll_shifts.#{shift.task}") %> <%= link_to t("admin.poll_shifts.new.remove_shift"), diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 35efc2927..a4b1cbed9 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -22,12 +22,14 @@ feature "Admin shifts" do expect(page).to have_css(".shift", count: 1) expect(page).to have_content I18n.l(Date.current, format: :long) expect(page).to have_content officer.name + expect(page).to have_content officer.email visit new_admin_booth_shift_path(booth2) expect(page).to have_css(".shift", count: 1) expect(page).to have_content I18n.l(Time.zone.tomorrow, format: :long) expect(page).to have_content officer.name + expect(page).to have_content officer.email end scenario "Create Vote Collection Shift and Recount & Scrutiny Shift on same date", :js do @@ -229,6 +231,7 @@ feature "Admin shifts" do expect(page).to have_css(".shift", count: 1) expect(page).to have_content(officer.name) + expect(page).to have_content(officer.email) end scenario "Empty" do From bec550e84353591073c2ba17b981044499282eec Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 14 May 2019 16:28:58 +0200 Subject: [PATCH 5/8] Fix typo on booth unassign spanish translation --- config/locales/es/admin.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 09af28447..e5334340e 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -999,7 +999,7 @@ es: unassigned: No asignada actions: assign: Asignar urna - unassign: Asignar urna + unassign: Desasignar urna poll_booth_assignments: alert: shifts: "Hay turnos asignados para esta urna. Si la desasignas, esos turnos se eliminarán. ¿Deseas continuar?" From 035b11c460952d2e5e47290760f1ffbc9518dbb1 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 17 May 2019 12:00:22 +0200 Subject: [PATCH 6/8] Hide select text if budget finished --- .../_select_investment.html.erb | 29 ++++++++++--------- .../features/admin/budget_investments_spec.rb | 26 +++++++++++++++++ 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/app/views/admin/budget_investments/_select_investment.html.erb b/app/views/admin/budget_investments/_select_investment.html.erb index 040d128e1..788d9824b 100644 --- a/app/views/admin/budget_investments/_select_investment.html.erb +++ b/app/views/admin/budget_investments/_select_investment.html.erb @@ -47,7 +47,7 @@ id: "budget_investment_visible_to_valuators" %> <% end %> - + <% if investment.selected? %> <%= link_to_unless investment.budget.finished?, t("admin.budget_investments.index.selected"), @@ -63,19 +63,20 @@ remote: true, class: "button small expanded" %> <% elsif investment.feasible? && investment.valuation_finished? %> - <%= link_to_unless investment.budget.finished?, - t("admin.budget_investments.index.select"), - toggle_selection_admin_budget_budget_investment_path(@budget, - investment, - filter: params[:filter], - sort_by: params[:sort_by], - min_total_supports: params[:min_total_supports], - max_total_supports: params[:max_total_supports], - advanced_filters: params[:advanced_filters], - page: params[:page]), - method: :patch, - remote: true, - class: "button small hollow expanded" %> + <% unless investment.budget.finished? %> + <%= link_to t("admin.budget_investments.index.select"), + toggle_selection_admin_budget_budget_investment_path(@budget, + investment, + filter: params[:filter], + sort_by: params[:sort_by], + min_total_supports: params[:min_total_supports], + max_total_supports: params[:max_total_supports], + advanced_filters: params[:advanced_filters], + page: params[:page]), + method: :patch, + remote: true, + class: "button small hollow expanded" %> + <% end %> <% end %> <% if params[:filter] == "selected" %> diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index bfc8e7881..79bdd3483 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -1407,6 +1407,32 @@ feature "Admin budget investments" do end end + scenario "Show only selected text when budget is finished" do + budget.update(phase: "finished") + + visit admin_budget_budget_investments_path(budget) + + within("#budget_investment_#{unfeasible_bi.id} #selection") do + expect(page).not_to have_content("Select") + expect(page).not_to have_content("Selected") + end + + within("#budget_investment_#{feasible_bi.id} #selection") do + expect(page).not_to have_content("Select") + expect(page).not_to have_content("Selected") + end + + within("#budget_investment_#{feasible_vf_bi.id} #selection") do + expect(page).not_to have_content("Select") + expect(page).not_to have_content("Selected") + end + + within("#budget_investment_#{selected_bi.id} #selection") do + expect(page).not_to contain_exactly("Select") + expect(page).to have_content("Selected") + end + end + scenario "Selecting an investment", :js do visit admin_budget_budget_investments_path(budget) From 30cd7ec9b2900fad3c113b7bc8aa71e818b69ee2 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 17 May 2019 12:53:21 +0200 Subject: [PATCH 7/8] Add help text to admin newsletter new --- app/views/admin/newsletters/new.html.erb | 5 +++++ config/locales/en/admin.yml | 4 +++- config/locales/es/admin.yml | 4 +++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/views/admin/newsletters/new.html.erb b/app/views/admin/newsletters/new.html.erb index d84cac6bf..1c58eaf44 100644 --- a/app/views/admin/newsletters/new.html.erb +++ b/app/views/admin/newsletters/new.html.erb @@ -1,4 +1,9 @@ <%= back_link_to %>

<%= t("admin.newsletters.new.title") %>

+

+ <%= t("admin.newsletters.new.header_footer_help_text_html", + link: link_to(t("admin.newsletters.new.image_link"), + admin_site_customization_images_path)) %> +

<%= render "form" %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 1c2ca77f1..a4915a4ee 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -780,6 +780,8 @@ en: new: title: New newsletter from: E-mail address that will appear as sending the newsletter + header_footer_help_text_html: "The heading and footer are the same for all emails, you can modify them on app/views/layouts/mailer_header and app/views/layouts/mailer_footer.
You can replace header image on %{link}." + image_link: "custom images" edit: title: Edit newsletter show: @@ -794,7 +796,7 @@ en: segment_recipient: Recipients from: E-mail address that will appear as sending the newsletter body: Email content - body_help_text: This is how the users will see the email + body_help_text: This is how the users will see the email. send_alert: Are you sure you want to send this newsletter to %{n} users? admin_notifications: create_success: Notification created successfully diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index e5334340e..69560ff06 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -779,6 +779,8 @@ es: new: title: Nueva newsletter from: Dirección de correo electrónico que aparecerá como remitente de la newsletter + header_footer_help_text_html: "El encabezado y pie son los mismos en todos los emails, puedes modificarlos en app/views/layouts/mailer_header y app/views/layouts/mailer_footer.
Puedes reemplazar la imagen del encabezado en %{link}." + image_link: "personalizar imágenes" edit: title: Editar newsletter show: @@ -793,7 +795,7 @@ es: segment_recipient: Destinatarios from: Dirección de correo electrónico que aparecerá como remitente de la newsletter body: Contenido del email - body_help_text: Así es como verán el email los usuarios + body_help_text: Así es como verán el email los usuarios. send_alert: "¿Estás seguro/a de que quieres enviar esta newsletter a %{n} usuarios?" admin_notifications: create_success: Notificación creada correctamente From 43dd3d21697506098be31d819b95e829962ffb3a Mon Sep 17 00:00:00 2001 From: decabeza Date: Tue, 21 May 2019 11:22:04 +0200 Subject: [PATCH 8/8] Include mailer header logo on custom images list --- app/assets/images/logo_email.png | Bin 2605 -> 2781 bytes app/mailers/application_mailer.rb | 1 + app/models/site_customization/image.rb | 3 ++- app/views/layouts/_mailer_header.html.erb | 4 +++- .../admin/site_customization/images_spec.rb | 17 +++++++++++++++++ spec/fixtures/files/logo_email_custom.png | Bin 0 -> 3339 bytes 6 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 spec/fixtures/files/logo_email_custom.png diff --git a/app/assets/images/logo_email.png b/app/assets/images/logo_email.png index 09bc18d633b3b45b975fbb160b1f461f5f170bf8..e8ca37d379490f03318aff297123798f0093b250 100644 GIT binary patch delta 2071 zcmb7_dpr|*AIE`Tp~+*xI{occ!O1 zT3HFE1OQNW#-O|afY4TFPsO#X-Aq&Kb@lFf$T0_F^TYNQW_D%EyDr>)d5gMDiZb~NwsY)stK#Y)`V z09D<`!yWV9NB1aX;(n^`65Chp4ANGUVaHX zF>Tb)*ysvCh6x-AfV?6|1rVU32>?|7uOL$aAS`CqE1MXZFdh&eX%fLB#$0q7S?eBkVY1lm;>6qhh64awu^Xvlq%J9Sz(o%zb^Pv(21)#qd=^`?mA?v~k8dnFyzM^e* z2_t^B&Kd~1h7gIyh+6~u(mAF-HDIrfN95Bxxgg?O1by1S(Ifa?ellC>ifhVq$cCs4 z3tHYjYg5kGWobvOY)xCFF=^|89>G%`6T14jpMLji8R%Bs$;mimjg!?(l+r)4R>FNV zw9gP=Ndp_lzWLARk{k50Ntr^f8|mo2z`EjzHbpRvC23lQ#V7|=VB?OkL}BmRWp1-^ z;qTm&Hh-Sxvva&(&Z6nlI{Es_W8UnZ2Z#IP0#f^i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Wzo ztys$tr$1V@epplInO1?s&GJ5$`93AN_dAFRtrV>s5#6uiSMWNi*-mK(3Q*$@94<$! zlysHHLdOGz8!Hm8j%X}4hmd^VOEC2_j(R>k+sz1!%N~o;uvCz0n^bo@ zzG-}d-;t`md|&Unh|7|mmVlB+7*Vy;y6+4ibn}-PXdniCf0?B2(SJkemskD+v%xkf ZKM;SnD}G5_H1Qw{kO-!Dny$m6zXADta>@Vz diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index f7928ff7e..f002cedd6 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,5 +1,6 @@ class ApplicationMailer < ActionMailer::Base helper :settings + helper :application default from: "#{Setting["mailer_from_name"]} <#{Setting["mailer_from_address"]}>" layout "mailer" end diff --git a/app/models/site_customization/image.rb b/app/models/site_customization/image.rb index 12a61dad8..c800e21b1 100644 --- a/app/models/site_customization/image.rb +++ b/app/models/site_customization/image.rb @@ -5,7 +5,8 @@ class SiteCustomization::Image < ApplicationRecord "social_media_icon_twitter" => [246, 246], "apple-touch-icon-200" => [200, 200], "budget_execution_no_image" => [800, 600], - "map" => [420, 500] + "map" => [420, 500], + "logo_email" => [400, 80] } has_attached_file :image diff --git a/app/views/layouts/_mailer_header.html.erb b/app/views/layouts/_mailer_header.html.erb index ee37d4be9..894ea9610 100644 --- a/app/views/layouts/_mailer_header.html.erb +++ b/app/views/layouts/_mailer_header.html.erb @@ -5,7 +5,9 @@ - <%= image_tag("logo_email.png", style: "border: 0; display: block; width: 100%;max-width: 370px", alt: setting["org_name"]) %> + <%= image_tag(image_path_for("logo_email.png"), + style: "border: 0;display: block;width: 100%;max-width: 400px", + alt: setting["org_name"]) %> diff --git a/spec/features/admin/site_customization/images_spec.rb b/spec/features/admin/site_customization/images_spec.rb index a8dd454a5..8a5a00c28 100644 --- a/spec/features/admin/site_customization/images_spec.rb +++ b/spec/features/admin/site_customization/images_spec.rb @@ -72,6 +72,23 @@ feature "Admin custom images" do end end + scenario "Image is replaced on admin newsletters" do + newsletter = create(:newsletter, segment_recipient: "all_users") + + visit admin_site_customization_images_path + + within("tr#image_logo_email") do + attach_file "site_customization_image_image", "spec/fixtures/files/logo_email_custom.png" + click_button "Update" + end + + visit admin_newsletter_path(newsletter) + + within(".newsletter-body-content") do + expect(page).to have_css("img[src*='logo_email_custom.png']") + end + end + scenario "Upload invalid image" do visit admin_root_path diff --git a/spec/fixtures/files/logo_email_custom.png b/spec/fixtures/files/logo_email_custom.png new file mode 100644 index 0000000000000000000000000000000000000000..af31d4d97646642123c4b41edb06a75731eb8a1f GIT binary patch literal 3339 zcmaJ@c|25m8$W1qOCiNX7&F?g%px)~&19LyzGT-jHO7g#%nV~NcJXe+mqu%5RedGc?poc!9{%GO@dHa9unKtAodBY43t-VX%A97(5!Qt%<=BFn9t63;%W@ zpxt<`#|SnQ+PA%+6$#crNm*rk-<6dYMs8%s4bT*jJkeE19w6I{l!{=!oJFP1>& zfeb#EXUFAwE_ct`oy+I?xO2VWWb#tCbl?^YCX2J=TPp82wIGk>2fEUDTsHh`eF&_7 z(V(M+!_n}x-8fw=1=6o;Kq2dpp|utjt4+mHFo~#m#G)ZF=%wcVt=Y>i zXo8l^@1qMXz7IdhfhL{@jW(h0Z5sgm6l6j%uoHBRW>`5W8OcPiuHB-KH;AYVzhmZb z?oO;ijNC>1@z$Th<-)Dt-r_=p^QwU4QPE0Fk{ktpylth9NTtfHYA8W%GGwAz?%cJY zoP#!tRe6C`xA&x3hy#F3qf!<0?#ajifWAIth=~EfiWPq|eu(^#@;&n1SOzaSzOwuy zvcw-AKi3;{csNB`b@d?V89zJtYi&?_SkZLF+`Fk+YQ}t+%Hq#67GB5@E{BkgH?EIr?BX{M@kC~|-20!WT zNn2N|53Iyg%rsMu${F47xOlBkw%b3T`&iB& z_Wvmt1Bh|qF@o#wm2|J?6wyNaus2Kly<^nR71OUADgA?y{P@Mjgqn{>`cd%{eRqwB!E~dXnK9>%^CP~8ABXIDPkFi*_Et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