Move HTML settings to content blocks settings page

- Rename html settings keys
- Show html settings next to content blocks page
- Hide html settings from configuration tab
This commit is contained in:
Julian Herrero
2019-03-13 12:49:50 +01:00
parent 89d4ea5aa3
commit 4df9a1a1b4
8 changed files with 23 additions and 14 deletions

View File

@@ -9,6 +9,8 @@ class Admin::SiteCustomization::ContentBlocksController < Admin::SiteCustomizati
def index def index
@content_blocks = SiteCustomization::ContentBlock.order(:name, :locale) @content_blocks = SiteCustomization::ContentBlock.order(:name, :locale)
@headings_content_blocks = Budget::ContentBlock.all @headings_content_blocks = Budget::ContentBlock.all
all_settings = Setting.all.group_by { |setting| setting.type }
@html_settings = all_settings["html"]
end end
def create def create

View File

@@ -6,6 +6,8 @@
<h2 class="inline-block"><%= t("admin.site_customization.content_blocks.index.title") %></h2> <h2 class="inline-block"><%= t("admin.site_customization.content_blocks.index.title") %></h2>
<%= render "admin/settings/settings_table", settings: @html_settings %>
<h3><%= t("admin.site_customization.content_blocks.information") %></h3> <h3><%= t("admin.site_customization.content_blocks.information") %></h3>
<p><%= t("admin.site_customization.content_blocks.about") %></p> <p><%= t("admin.site_customization.content_blocks.about") %></p>

View File

@@ -14,10 +14,10 @@
type: "image/png" %> type: "image/png" %>
<%= content_for :social_media_meta_tags %> <%= content_for :social_media_meta_tags %>
<%= setting["per_page_code_head"].try(:html_safe) %> <%= setting["html.per_page_code_head"].try(:html_safe) %>
</head> </head>
<body class="<%= yield (:body_class) %>"> <body class="<%= yield (:body_class) %>">
<%= setting["per_page_code_body"].try(:html_safe) %> <%= setting["html.per_page_code_body"].try(:html_safe) %>
<h1 class="show-for-sr"><%= setting["org_name"] %></h1> <h1 class="show-for-sr"><%= setting["org_name"] %></h1>

View File

@@ -3,9 +3,11 @@
<head> <head>
<%= render "layouts/common_head", default_title: "Gobierno abierto" %> <%= render "layouts/common_head", default_title: "Gobierno abierto" %>
<%= render "layouts/meta_tags" %> <%= render "layouts/meta_tags" %>
<%= setting["html.per_page_code_head"].try(:html_safe) %>
</head> </head>
<body class="auth-page"> <body class="auth-page">
<%= setting["html.per_page_code_body"].try(:html_safe) %>
<div class="wrapper"> <div class="wrapper">
<div class="auth-image small-12 medium-3 column"> <div class="auth-image small-12 medium-3 column">
<h1 class="logo margin"> <h1 class="logo margin">

View File

@@ -28,10 +28,6 @@ en:
months_to_archive_proposals_description: "After this number of months the Proposals will be archived and will no longer be able to receive supports" months_to_archive_proposals_description: "After this number of months the Proposals will be archived and will no longer be able to receive supports"
email_domain_for_officials: "Email domain for public officials" email_domain_for_officials: "Email domain for public officials"
email_domain_for_officials_description: "All users registered with this domain will have their account verified at registration" email_domain_for_officials_description: "All users registered with this domain will have their account verified at registration"
per_page_code_head: "Code to be included on every page (<head>)"
per_page_code_head_description: "This code will appear inside the <head> label. Useful for entering custom scripts, analytics..."
per_page_code_body: "Code to be included on every page (<body>)"
per_page_code_body_description: "This code will appear inside the <body> label. Useful for entering custom scripts, analytics..."
twitter_handle: "Twitter handle" twitter_handle: "Twitter handle"
twitter_handle_description: "If filled in it will appear in the footer" twitter_handle_description: "If filled in it will appear in the footer"
twitter_hashtag: "Twitter hashtag" twitter_hashtag: "Twitter hashtag"
@@ -126,3 +122,8 @@ en:
budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the budget" budgets_description: "With participatory budgets, citizens decide which projects presented by their neighbours will receive a part of the budget"
legislation: "Legislation" legislation: "Legislation"
legislation_description: "In participatory processes, citizens are offered the opportunity to participate in the drafting and modification of regulations that affect the society and to give their opinion on certain actions that are planned to be carried out" legislation_description: "In participatory processes, citizens are offered the opportunity to participate in the drafting and modification of regulations that affect the society and to give their opinion on certain actions that are planned to be carried out"
html:
per_page_code_head: "Code to be included on every page (<head>)"
per_page_code_head_description: "This code will appear inside the <head> label. Useful for entering custom scripts, analytics..."
per_page_code_body: "Code to be included on every page (<body>)"
per_page_code_body_description: "This code will appear inside the <body> label. Useful for entering custom scripts, analytics..."

View File

@@ -28,10 +28,6 @@ es:
months_to_archive_proposals_description: "Pasado este número de meses las Propuestas se archivarán y ya no podrán recoger apoyos" months_to_archive_proposals_description: "Pasado este número de meses las Propuestas se archivarán y ya no podrán recoger apoyos"
email_domain_for_officials: "Dominio de email para cargos públicos" email_domain_for_officials: "Dominio de email para cargos públicos"
email_domain_for_officials_description: "Todos los usuarios registrados con este dominio tendrán su cuenta verificada al registrarse" email_domain_for_officials_description: "Todos los usuarios registrados con este dominio tendrán su cuenta verificada al registrarse"
per_page_code_head: "Código a incluir en cada página (<head>)"
per_page_code_head_description: "Esté código aparecerá dentro de la etiqueta <head>. Útil para introducir scripts personalizados, analitycs..."
per_page_code_body: "Código a incluir en cada página (<body>)"
per_page_code_body_description: "Esté código aparecerá dentro de la etiqueta <body>. Útil para introducir scripts personalizados, analitycs..."
twitter_handle: "Usuario de Twitter" twitter_handle: "Usuario de Twitter"
twitter_handle_description: "Si está rellenado aparecerá en el pie de página" twitter_handle_description: "Si está rellenado aparecerá en el pie de página"
twitter_hashtag: "Hashtag para Twitter" twitter_hashtag: "Hashtag para Twitter"
@@ -126,3 +122,8 @@ es:
budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto" budgets_description: "Con los presupuestos participativos la ciudadanía decide a qué proyectos presentados por los vecinos y vecinas va destinada una parte del presupuesto"
legislation: "Legislación" legislation: "Legislación"
legislation_description: "En los procesos participativos se ofrece a la ciudadanía la oportunidad de participar en la elaboración y modificación de normativa que afecta a la sociedad y de dar su opinión sobre ciertas actuaciones que se tiene previsto llevar a cabo" legislation_description: "En los procesos participativos se ofrece a la ciudadanía la oportunidad de participar en la elaboración y modificación de normativa que afecta a la sociedad y de dar su opinión sobre ciertas actuaciones que se tiene previsto llevar a cabo"
html:
per_page_code_head: "Código a incluir en cada página (<head>)"
per_page_code_head_description: "Esté código aparecerá dentro de la etiqueta <head>. Útil para introducir scripts personalizados, analitycs..."
per_page_code_body: "Código a incluir en cada página (<body>)"
per_page_code_body_description: "Esté código aparecerá dentro de la etiqueta <body>. Útil para introducir scripts personalizados, analitycs..."

View File

@@ -51,8 +51,9 @@ section "Creating Settings" do
Setting.create(key: "feature.public_stats", value: "true") Setting.create(key: "feature.public_stats", value: "true")
Setting.create(key: "feature.help_page", value: "true") Setting.create(key: "feature.help_page", value: "true")
Setting.create(key: "per_page_code_head", value: "") Setting.create(key: "html.per_page_code_head", value: "")
Setting.create(key: "per_page_code_body", value: "") Setting.create(key: "html.per_page_code_body", value: "")
Setting.create(key: "comments_body_max_length", value: "1000") Setting.create(key: "comments_body_max_length", value: "1000")
Setting.create(key: "mailer_from_name", value: "CONSUL") Setting.create(key: "mailer_from_name", value: "CONSUL")
Setting.create(key: "mailer_from_address", value: "noreply@consul.dev") Setting.create(key: "mailer_from_address", value: "noreply@consul.dev")

View File

@@ -41,10 +41,10 @@ Setting["months_to_archive_proposals"] = 12
Setting["email_domain_for_officials"] = "" Setting["email_domain_for_officials"] = ""
# Code to be included at the top (inside <head>) of every page (useful for tracking) # Code to be included at the top (inside <head>) of every page (useful for tracking)
Setting["per_page_code_head"] = "" Setting["html.per_page_code_head"] = ""
# Code to be included at the top (inside <body>) of every page # Code to be included at the top (inside <body>) of every page
Setting["per_page_code_body"] = "" Setting["html.per_page_code_body"] = ""
# Social settings # Social settings
Setting["twitter_handle"] = nil Setting["twitter_handle"] = nil