From 435747764caf5cc7f4b1f657e889620728f87a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 18 Feb 2021 23:39:59 +0100 Subject: [PATCH 1/5] Group links to create budgets with the heading We're going to add help content here and having a floating button would make the button disappear when creating content for mobile phones. I'm not sure having the link in the
tag is semantically correct, but is consistent to what we did to create local targets in the SDG content section. Note we're changing the style of the link to create local targets so it's consistent with the link to create budgets/groups/headings. --- app/assets/stylesheets/admin.scss | 2 +- app/views/admin/budget_groups/index.html.erb | 9 ++++----- app/views/admin/budget_headings/index.html.erb | 9 ++++----- app/views/admin/budgets/index.html.erb | 9 ++++----- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 0e53b4abf..428390f91 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -659,7 +659,7 @@ code { display: flex; a { - @include hollow-button; + @include regular-button; margin-left: auto; } } diff --git a/app/views/admin/budget_groups/index.html.erb b/app/views/admin/budget_groups/index.html.erb index 195642d43..74185970c 100644 --- a/app/views/admin/budget_groups/index.html.erb +++ b/app/views/admin/budget_groups/index.html.erb @@ -2,11 +2,10 @@
-

<%= @budget.name %>

- -<%= link_to t("admin.budget_groups.form.create"), - new_admin_budget_group_path, - class: "button float-right" %> +
+

<%= @budget.name %>

+ <%= link_to t("admin.budget_groups.form.create"), new_admin_budget_group_path %> +
<% if @groups.any? %>

<%= t("admin.budget_groups.amount", count: @groups.count) %>

diff --git a/app/views/admin/budget_headings/index.html.erb b/app/views/admin/budget_headings/index.html.erb index 7ffd37ff7..e609af000 100644 --- a/app/views/admin/budget_headings/index.html.erb +++ b/app/views/admin/budget_headings/index.html.erb @@ -1,10 +1,9 @@ <%= back_link_to admin_budget_groups_path(@budget), t("admin.budget_headings.index.back") %> -
-

<%= "#{@budget.name} / #{@group.name}" %>

-<%= link_to t("admin.budget_headings.form.create"), - new_admin_budget_group_heading_path, - class: "button float-right" %> +
+

<%= "#{@budget.name} / #{@group.name}" %>

+ <%= link_to t("admin.budget_headings.form.create"), new_admin_budget_group_heading_path %> +
<% if @headings.any? %>

<%= t("admin.budget_headings.amount", count: @headings.count) %>

diff --git a/app/views/admin/budgets/index.html.erb b/app/views/admin/budgets/index.html.erb index 9140973af..448a55215 100644 --- a/app/views/admin/budgets/index.html.erb +++ b/app/views/admin/budgets/index.html.erb @@ -1,8 +1,7 @@ -

<%= t("admin.budgets.index.title") %>

- -<%= link_to t("admin.budgets.index.new_link"), - new_admin_budget_path, - class: "button float-right" %> +
+

<%= t("admin.budgets.index.title") %>

+ <%= link_to t("admin.budgets.index.new_link"), new_admin_budget_path %> +
<%= render "shared/filter_subnav", i18n_namespace: "admin.budgets.index" %> From b1cb981980e3670e25d37dd15bc551e3eac3c686 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Mon, 16 Mar 2020 12:54:00 +0100 Subject: [PATCH 2/5] Add help text in budgets admin index Co-authored-by: decabeza --- .../stylesheets/admin/budgets/help.scss | 42 +++++++++++++++++++ app/assets/stylesheets/application.scss | 2 +- .../admin/budgets/help_component.html.erb | 3 ++ .../admin/budgets/help_component.rb | 12 ++++++ app/views/admin/budgets/index.html.erb | 1 + config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + 7 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 app/assets/stylesheets/admin/budgets/help.scss create mode 100644 app/components/admin/budgets/help_component.html.erb create mode 100644 app/components/admin/budgets/help_component.rb diff --git a/app/assets/stylesheets/admin/budgets/help.scss b/app/assets/stylesheets/admin/budgets/help.scss new file mode 100644 index 000000000..16f692830 --- /dev/null +++ b/app/assets/stylesheets/admin/budgets/help.scss @@ -0,0 +1,42 @@ +.admin .budgets-help { + $padding: $line-height / 2; + $quote-size: 1em; + $quote-padding: 2 * $quote-size / 5; + $quote-width: $quote-size + 2 * $quote-padding; + + @include has-fa-icon(quote-right, solid, after); + background: $table-header; + border-radius: rem-calc(6); + color: $admin-text; + margin-bottom: $line-height; + padding: $padding; + padding-right: calc(2 * #{$padding} + #{$quote-width}); + position: relative; + + @include breakpoint(medium) { + width: 50%; + } + + p { + font-size: $small-font-size; + font-style: italic; + } + + &::before { + background: #ccd8e4; + content: ""; + height: 100%; + position: absolute; + right: $padding; + top: 0; + width: $quote-width; + } + + &::after { + bottom: $padding / 2; + color: $white; + margin-right: 0; + position: absolute; + right: calc(#{$padding} + #{$quote-padding}); + } +} diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 44dc26563..149facb82 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -31,7 +31,7 @@ @import "leaflet"; @import "sticky_overrides"; @import "tags"; -@import "admin/*"; +@import "admin/**/*"; @import "sdg/**/*"; @import "sdg_management/*"; @import "sdg_management/**/*"; diff --git a/app/components/admin/budgets/help_component.html.erb b/app/components/admin/budgets/help_component.html.erb new file mode 100644 index 000000000..1790ff86a --- /dev/null +++ b/app/components/admin/budgets/help_component.html.erb @@ -0,0 +1,3 @@ +
+

<%= text %>

+
diff --git a/app/components/admin/budgets/help_component.rb b/app/components/admin/budgets/help_component.rb new file mode 100644 index 000000000..6b57af1c3 --- /dev/null +++ b/app/components/admin/budgets/help_component.rb @@ -0,0 +1,12 @@ +class Admin::Budgets::HelpComponent < ApplicationComponent + + private + + def i18n_namespace + "admin.budgets.index" + end + + def text + t("#{i18n_namespace}.help") + end +end diff --git a/app/views/admin/budgets/index.html.erb b/app/views/admin/budgets/index.html.erb index 448a55215..74463748f 100644 --- a/app/views/admin/budgets/index.html.erb +++ b/app/views/admin/budgets/index.html.erb @@ -3,6 +3,7 @@ <%= link_to t("admin.budgets.index.new_link"), new_admin_budget_path %>
+<%= render Admin::Budgets::HelpComponent.new %> <%= render "shared/filter_subnav", i18n_namespace: "admin.budgets.index" %> <% if @budgets.any? %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 27e289370..9e6d33379 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -70,6 +70,7 @@ en: filters: open: Open finished: Finished + help: "Participatory budgets allow citizens to propose and decide directly how to spend part of the budget, with monitoring and rigorous evaluation of proposals by the institution." budget_investments: Manage projects table_name: Name table_phase: Phase diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 9cb6d311a..ed4a7137c 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -70,6 +70,7 @@ es: filters: open: Abiertos finished: Terminados + help: "Los presupuestos participativos permiten que los ciudadanos propongan y decidan de manera directa cómo gastar parte del presupuesto, con un seguimiento y evaluación riguroso de las propuestas por parte de la institución." budget_investments: Gestionar proyectos de gasto table_name: Nombre table_phase: Fase From ef6940c3e78b04244434dbbae9bce920cbf16b9d Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Mon, 16 Mar 2020 12:54:00 +0100 Subject: [PATCH 3/5] Add help text in budget groups admin index Co-authored-by: decabeza --- app/components/admin/budgets/help_component.rb | 11 ++++++----- app/views/admin/budget_groups/index.html.erb | 2 ++ app/views/admin/budgets/index.html.erb | 2 +- config/locales/en/admin.yml | 1 + config/locales/es/admin.yml | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/components/admin/budgets/help_component.rb b/app/components/admin/budgets/help_component.rb index 6b57af1c3..ecde7a43d 100644 --- a/app/components/admin/budgets/help_component.rb +++ b/app/components/admin/budgets/help_component.rb @@ -1,12 +1,13 @@ class Admin::Budgets::HelpComponent < ApplicationComponent + attr_reader :i18n_namespace + + def initialize(i18n_namespace) + @i18n_namespace = i18n_namespace + end private - def i18n_namespace - "admin.budgets.index" - end - def text - t("#{i18n_namespace}.help") + t("admin.#{i18n_namespace}.index.help") end end diff --git a/app/views/admin/budget_groups/index.html.erb b/app/views/admin/budget_groups/index.html.erb index 74185970c..2e20ac1ac 100644 --- a/app/views/admin/budget_groups/index.html.erb +++ b/app/views/admin/budget_groups/index.html.erb @@ -7,6 +7,8 @@ <%= link_to t("admin.budget_groups.form.create"), new_admin_budget_group_path %> +<%= render Admin::Budgets::HelpComponent.new("budget_groups") %> + <% if @groups.any? %>

<%= t("admin.budget_groups.amount", count: @groups.count) %>

diff --git a/app/views/admin/budgets/index.html.erb b/app/views/admin/budgets/index.html.erb index 74463748f..841bcb0da 100644 --- a/app/views/admin/budgets/index.html.erb +++ b/app/views/admin/budgets/index.html.erb @@ -3,7 +3,7 @@ <%= link_to t("admin.budgets.index.new_link"), new_admin_budget_path %> -<%= render Admin::Budgets::HelpComponent.new %> +<%= render Admin::Budgets::HelpComponent.new("budgets") %> <%= render "shared/filter_subnav", i18n_namespace: "admin.budgets.index" %> <% if @budgets.any? %> diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 9e6d33379..5398b76b0 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -134,6 +134,7 @@ en: submit: "Save group" index: back: "Go back to budgets" + help: "Groups are meant to organize headings. After a group is created and it contais headings, it's possible to determine in how many headings a user can vote per group." budget_headings: no_headings: "There are no headings." amount: diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index ed4a7137c..86a4e7735 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -134,6 +134,7 @@ es: submit: "Guardar grupo" index: back: "Volver a presupuestos" + help: "Los grupos sirven para organizar las partidas del presupuesto. Después de que un grupo sea creado y éste contenga partidas, es posible determinar el número de partidas a las que un usuario puede votar por grupo." budget_headings: no_headings: "No hay partidas." amount: From 0019974ccc27c72b2c859bb22f29d73d39dcc6a0 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Mon, 16 Mar 2020 12:54:00 +0100 Subject: [PATCH 4/5] Add help text in budget headings admin index Co-authored-by: decabeza --- app/views/admin/budget_headings/index.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/budget_headings/index.html.erb b/app/views/admin/budget_headings/index.html.erb index e609af000..4487a8f4b 100644 --- a/app/views/admin/budget_headings/index.html.erb +++ b/app/views/admin/budget_headings/index.html.erb @@ -5,6 +5,8 @@ <%= link_to t("admin.budget_headings.form.create"), new_admin_budget_group_heading_path %> +<%= render Admin::Budgets::HelpComponent.new("budget_headings") %> + <% if @headings.any? %>

<%= t("admin.budget_headings.amount", count: @headings.count) %>

diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 5398b76b0..682284b99 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -157,6 +157,7 @@ en: submit: "Save heading" index: back: "Go back to groups" + help: "Headings are meant to divide the money of the participatory budget. Here you can add headings for this group and assign the amount of money that will be used for each heading." budget_phases: edit: summary_help_text: This text will inform the user about the phase. To show it even if the phase is not active, select the checkbox below diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 86a4e7735..043df71d3 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -157,6 +157,7 @@ es: submit: "Guardar partida" index: back: "Volver a grupos" + help: "Las partidas sirven para dividir el dinero del presupuesto participativo. Aquí puedes ir añadiendo partidas para cada grupo y establecer la cantidad de dinero que se gastará en cada partida." budget_phases: edit: summary_help_text: Este texto informará al usuario sobre la fase. Para mostrarlo aunque la fase no esté activa, marca la opción de más abajo. From 6cec263d67b1df0916ef6dc6879b870d11bc3d99 Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Mon, 16 Mar 2020 12:54:00 +0100 Subject: [PATCH 5/5] Add help text in budget phases Co-authored-by: decabeza --- app/views/admin/budgets/_form.html.erb | 2 ++ config/locales/en/admin.yml | 2 ++ config/locales/es/admin.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/app/views/admin/budgets/_form.html.erb b/app/views/admin/budgets/_form.html.erb index ec1c4ccf1..628f4a96e 100644 --- a/app/views/admin/budgets/_form.html.erb +++ b/app/views/admin/budgets/_form.html.erb @@ -42,6 +42,8 @@ <%= render "/admin/budgets/association", assignable_type: "valuators", assignables: @valuators, form: f %> + <%= render Admin::Budgets::HelpComponent.new("budget_phases") %> + <% if @budget.phases.present? %>
diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 682284b99..332cd31b6 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -164,6 +164,8 @@ en: description_help_text: This text will appear in the header when the phase is active enabled_help_text: This phase will be public in the budget's phases timeline, as well as active for any other purpose save_changes: Save changes + index: + help: "Participatory budgets have different phases. Here you can enable or disable phases and also customize each individual phase." budget_investments: index: heading_filter_all: All headings diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 043df71d3..58d5c4ada 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -164,6 +164,8 @@ es: description_help_text: Este texto aparecerá en la cabecera cuando la fase esté activa enabled_help_text: Esta fase será pública en el calendario de fases del presupuesto y estará activa para otros propósitos save_changes: Guardar cambios + index: + help: "Los presupuestos participativos tienen distintas fases. Aquí puedes habilitar o deshabilitar fases y también personalizar cada una de las fases." budget_investments: index: heading_filter_all: Todas las partidas