From 4435673acebe9d1e7823207008163c5ebc574194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 16 Oct 2023 14:17:41 +0200 Subject: [PATCH 1/2] Move admin index to a component This way we make it easier to modify. Note that, since the title of the page is "Administration" and it's in the "Admin" section, we're adding an option to the `header` method in order to avoid having a confusing title like "Administration - Admin". Also note that, by removing the `title` HTML class, we avoid inheriting styles from the `dashboard.scss` stylesheet, and now the heading is displayed in the position it was meant to. Finally, the concept of using a `main-class` for the current page comes from a branch (currently in development) which will replace the
tag with the `admin-content` class with a `main` tag. --- app/assets/stylesheets/admin.scss | 4 ---- app/assets/stylesheets/admin/dashboard/index.scss | 6 ++++++ app/components/admin/dashboard/index_component.html.erb | 4 ++++ app/components/admin/dashboard/index_component.rb | 7 +++++++ app/components/concerns/header.rb | 4 ++-- app/views/admin/dashboard/index.html.erb | 4 +--- app/views/layouts/admin.html.erb | 2 +- 7 files changed, 21 insertions(+), 10 deletions(-) create mode 100644 app/assets/stylesheets/admin/dashboard/index.scss create mode 100644 app/components/admin/dashboard/index_component.html.erb create mode 100644 app/components/admin/dashboard/index_component.rb diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index 542a765a7..90aa479ad 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -38,10 +38,6 @@ $table-header: #ecf1f6; small { color: $text-medium; } - - &.title { - text-transform: uppercase; - } } h3 { diff --git a/app/assets/stylesheets/admin/dashboard/index.scss b/app/assets/stylesheets/admin/dashboard/index.scss new file mode 100644 index 000000000..c5e6810a9 --- /dev/null +++ b/app/assets/stylesheets/admin/dashboard/index.scss @@ -0,0 +1,6 @@ +.admin-dashboard-index { + > header h2 { + text-transform: uppercase; + border-bottom: 1px solid $border; + } +} diff --git a/app/components/admin/dashboard/index_component.html.erb b/app/components/admin/dashboard/index_component.html.erb new file mode 100644 index 000000000..3328ee99a --- /dev/null +++ b/app/components/admin/dashboard/index_component.html.erb @@ -0,0 +1,4 @@ +<% provide :main_class, "admin-dashboard-index" %> +<%= header(skip_section_title: true) %> + +

<%= t("admin.dashboard.index.description", org: setting["org_name"]) %>

diff --git a/app/components/admin/dashboard/index_component.rb b/app/components/admin/dashboard/index_component.rb new file mode 100644 index 000000000..85b579d63 --- /dev/null +++ b/app/components/admin/dashboard/index_component.rb @@ -0,0 +1,7 @@ +class Admin::Dashboard::IndexComponent < ApplicationComponent + include Header + + def title + t("admin.dashboard.index.title") + end +end diff --git a/app/components/concerns/header.rb b/app/components/concerns/header.rb index aa9700c0d..25ca5b3ae 100644 --- a/app/components/concerns/header.rb +++ b/app/components/concerns/header.rb @@ -1,10 +1,10 @@ module Header extend ActiveSupport::Concern - def header(before: nil, &block) + def header(before: nil, skip_section_title: false, &block) provide(:title) do [ - t("#{namespace}.header.title", default: ""), + (t("#{namespace}.header.title", default: "") unless skip_section_title), strip_tags(title), setting["org_name"] ].reject(&:blank?).join(" - ") diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index efcc29472..a6f1752fb 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -1,3 +1 @@ -

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

- -

<%= t("admin.dashboard.index.description", org: setting["org_name"]) %>

+<%= render Admin::Dashboard::IndexComponent.new %> diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index e8514de96..7f434cde3 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb @@ -21,7 +21,7 @@ <% end %> -
+
<%= label_tag :show_menu, t("admin.menu.admin"), "aria-hidden": true, class: "button hollow expanded" %> From b5c13d63d1b329f12ce7cdcedc0d0b879a870594 Mon Sep 17 00:00:00 2001 From: jensconsul <145969776+jensconsul@users.noreply.github.com> Date: Wed, 11 Oct 2023 14:59:24 +0200 Subject: [PATCH 2/2] Add information about the project to admin index MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This way it'll be easier for people to know how to contact the Consul Democracy Foundation. Co-Authored-By: Javi Martín --- .../stylesheets/admin/dashboard/index.scss | 25 +++++++++++++++++++ .../admin/dashboard/index_component.html.erb | 7 ++++++ .../admin/dashboard/index_component.rb | 14 +++++++++++ config/locales/en/admin.yml | 10 ++++++++ config/locales/es/admin.yml | 10 ++++++++ 5 files changed, 66 insertions(+) diff --git a/app/assets/stylesheets/admin/dashboard/index.scss b/app/assets/stylesheets/admin/dashboard/index.scss index c5e6810a9..78fe1aec3 100644 --- a/app/assets/stylesheets/admin/dashboard/index.scss +++ b/app/assets/stylesheets/admin/dashboard/index.scss @@ -3,4 +3,29 @@ text-transform: uppercase; border-bottom: 1px solid $border; } + + address { + > :not(:last-child) { + &::after { + content: ""; + display: block; + margin-bottom: $line-height / 3; + } + } + + a { + &[href^="mailto:"] { + @include has-fa-icon(envelope, regular); + } + + &[href^="http"] { + @include has-fa-icon(globe, solid); + } + + &::before { + margin-#{$global-right}: 0.2em; + transform: translateY(-0.2em); + } + } + } } diff --git a/app/components/admin/dashboard/index_component.html.erb b/app/components/admin/dashboard/index_component.html.erb index 3328ee99a..1a5ded131 100644 --- a/app/components/admin/dashboard/index_component.html.erb +++ b/app/components/admin/dashboard/index_component.html.erb @@ -2,3 +2,10 @@ <%= header(skip_section_title: true) %>

<%= t("admin.dashboard.index.description", org: setting["org_name"]) %>

+ +<%= info %> + +
+ <%= email_link %> + <%= website_link %> +
diff --git a/app/components/admin/dashboard/index_component.rb b/app/components/admin/dashboard/index_component.rb index 85b579d63..0288646e3 100644 --- a/app/components/admin/dashboard/index_component.rb +++ b/app/components/admin/dashboard/index_component.rb @@ -4,4 +4,18 @@ class Admin::Dashboard::IndexComponent < ApplicationComponent def title t("admin.dashboard.index.title") end + + private + + def info + sanitize t("admin.dashboard.index.info") + end + + def email_link + mail_to "info@consulfoundation.org" + end + + def website_link + link_to "https://consuldemocracy.org", "https://consuldemocracy.org" + end end diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 031a9759c..c5589ba63 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -451,6 +451,16 @@ en: back: Go back to %{org} title: Administration description: Welcome to the %{org} admin panel. + info: |- +

This is the place where you, as an administrator, implement and oversee the citizen participation process in your city or region.

+ +

You are now one of hundreds of governments and municipalities worldwide that are using the CONSUL DEMOCRACY platform to put citizen participation into practice. Congratulations!

+ +

The CONSUL DEMOCRACY Foundation is at the heart of the global user community. We'd like to ask you to get in touch so we get a grasp of who's using the software and see how we might assist with implementation or use. We can't wait to welcome you to the community.

+ +

Happy administrating!

+ +

Greetings from the CONSUL DEMOCRACY Foundation team.

actions: index: description: "When users create proposals they can access a dashboard of their proposal, where you can propose resources and recommendations to get support for their idea." diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 1c317d3a3..783f2c3ef 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -451,6 +451,16 @@ es: back: Volver a %{org} title: Administración description: Bienvenido al panel de administración de %{org}. + info: |- +

Este es el lugar donde tú, como administrador, implementas y supervisas el proceso de participación ciudadana en tu ciudad o región.

+ +

Ahora eres uno de los cientos de gobiernos y municipios de todo el mundo que están utilizando la plataforma CONSUL DEMOCRACY para poner en práctica la participación ciudadana. ¡Enhorabuena!

+ +

La Fundación CONSUL DEMOCRACY está en el centro de la comunidad mundial de usuarios. Nos gustaría pedirte que te pongas en contacto con nosotros para saber quién utiliza el software y ver cómo podemos ayudar en su implantación o uso. Estamos deseando darte la bienvenida a la comunidad.

+ +

¡Feliz administración!

+ +

Saludos del equipo de la Fundación CONSUL DEMOCRACY.

actions: index: description: "Cuando los usuarios crean propuestas pueden acceder a un panel de progreso de su propuesta, donde se le puede proponer recursos y recomendaciones para conseguir apoyos a su idea."