Merge pull request #3508 from consul/admin-ui

Improve help texts on Admin UI
This commit is contained in:
Alberto
2019-05-21 12:53:43 +02:00
committed by GitHub
24 changed files with 117 additions and 49 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -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

View File

@@ -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

View File

@@ -47,7 +47,7 @@
id: "budget_investment_visible_to_valuators" %>
<% end %>
</td>
<td class="small text-center">
<td id="selection" class="small text-center">
<% if investment.selected? %>
<%= link_to_unless investment.budget.finished?,
t("admin.budget_investments.index.selected"),
@@ -63,8 +63,8 @@
remote: true,
class: "button small expanded" %>
<% elsif investment.feasible? && investment.valuation_finished? %>
<%= link_to_unless investment.budget.finished?,
t("admin.budget_investments.index.select"),
<% unless investment.budget.finished? %>
<%= link_to t("admin.budget_investments.index.select"),
toggle_selection_admin_budget_budget_investment_path(@budget,
investment,
filter: params[:filter],
@@ -77,6 +77,7 @@
remote: true,
class: "button small hollow expanded" %>
<% end %>
<% end %>
</td>
<% if params[:filter] == "selected" %>
<td class="small text-center">

View File

@@ -1,4 +1,9 @@
<%= back_link_to %>
<h2><%= t("admin.newsletters.new.title") %></h2>
<p>
<%= t("admin.newsletters.new.header_footer_help_text_html",
link: link_to(t("admin.newsletters.new.image_link"),
admin_site_customization_images_path)) %>
</p>
<%= render "form" %>

View File

@@ -1,3 +1,5 @@
<p><%= t("admin.poll_officers.search.help") %></p>
<%= form_tag search_admin_officers_path, method: :get, remote: true do %>
<div class="input-group">
<%= text_field_tag :email, "",

View File

@@ -4,6 +4,7 @@
<tr>
<th><%= t("admin.poll_shifts.new.date") %></th>
<th><%= t("admin.poll_shifts.new.officer") %></th>
<th><%= t("admin.poll_shifts.new.table_email") %></th>
<th><%= t("admin.poll_shifts.new.task") %></th>
<th class="small-3"><%= t("admin.poll_shifts.new.shift") %></th>
</tr>
@@ -13,6 +14,7 @@
<tr id="shift_<%= shift.id %>" class="shift">
<td><%= l(shift.date.to_date, format: :long) %></td>
<td><%= shift.officer_name %></td>
<td><%= shift.officer_email %></td>
<td><%= t("admin.poll_shifts.#{shift.task}") %></td>
<td>
<%= link_to t("admin.poll_shifts.new.remove_shift"),

View File

@@ -18,22 +18,22 @@
<hr>
</div>
<div class="small-12 medium-5 column">
<div class="small-12 medium-4 column">
<h3><%= t("admin.site_customization.pages.form.options") %></h3>
<%= f.check_box :more_info_flag, class: "small" %>
<%= f.check_box :print_content_flag %>
</div>
<div class="small-12 medium-3 column">
<%= 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}") %>
<br>
<% end %>
<%= f.check_box :more_info_flag, class: "small" %>
<%= f.check_box :print_content_flag %>
</div>
<div class="small-12 medium-4 column">
<div class="small-12 medium-6 column">
<%= f.label :slug %>
<p class="help-text"><%= t("admin.site_customization.pages.new.slug_help_html") %>
<%= f.text_field :slug, label: false, size: 80, maxlength: 80 %>
</div>
<div class="small-12 column">

View File

@@ -5,7 +5,9 @@
<tr>
<td style="border-bottom: 1px solid #dadfe1; padding: 20px 0;">
<a href="#" target="_blank">
<%= 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"]) %>
</a>
</td>
</tr>

View File

@@ -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 <code>app/views/layouts/mailer_header</code> and <code>app/views/layouts/mailer_footer</code>.<br>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 <code>https://consulproject.org/page-slug</code>"
page:
created_at: Created at
status: Status

View File

@@ -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"

View File

@@ -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}

View File

@@ -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}

View File

@@ -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 <code>app/views/layouts/mailer_header</code> y <code>app/views/layouts/mailer_footer</code>.<br>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 <code>https://consulproject.org/slug-de-pagina</code>"
page:
created_at: Creada
status: Estado

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -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