diff --git a/app/assets/images/logo_email.png b/app/assets/images/logo_email.png index 09bc18d63..e8ca37d37 100644 Binary files a/app/assets/images/logo_email.png and b/app/assets/images/logo_email.png differ 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/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/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/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/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/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/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/config/locales/en/admin.yml b/config/locales/en/admin.yml index 762a7d5ce..8bb6c2e7e 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" @@ -781,6 +781,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: @@ -795,7 +797,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 @@ -951,6 +953,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" @@ -1507,7 +1510,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 @@ -1601,6 +1604,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/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/config/locales/es/admin.yml b/config/locales/es/admin.yml index b7d2b99bf..ffbc3a295 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -780,6 +780,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: @@ -794,7 +796,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 @@ -950,6 +952,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" @@ -999,7 +1002,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?" @@ -1600,6 +1603,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 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/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) 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/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 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/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/fixtures/files/logo_email_custom.png b/spec/fixtures/files/logo_email_custom.png new file mode 100644 index 000000000..af31d4d97 Binary files /dev/null and b/spec/fixtures/files/logo_email_custom.png differ 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