Add default site customization pages
From now on these static pages: `/privacy' `/conditions' `/accesibility' `/help/faq' `/welcome' have been moved to the DB and can be modified easily by any administrator in `/admin/site_customization/pages'
This commit is contained in:
@@ -98,7 +98,7 @@ CKEDITOR.editorConfig = function( config )
|
|||||||
];
|
];
|
||||||
|
|
||||||
config.toolbar_admin = config.toolbar_mini.concat([
|
config.toolbar_admin = config.toolbar_mini.concat([
|
||||||
{ name: 'insert', items: [ 'Image' ] }
|
{ name: 'insert', items: [ 'Image', 'Table' ] }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
config.toolbar = "mini";
|
config.toolbar = "mini";
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ class WelcomeController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def welcome
|
def welcome
|
||||||
|
if current_user.level_three_verified?
|
||||||
|
redirect_to page_path("welcome_level_three_verified")
|
||||||
|
elsif current_user.level_two_or_three_verified?
|
||||||
|
redirect_to page_path("welcome_level_two_verified")
|
||||||
|
else
|
||||||
|
redirect_to page_path("welcome_not_verified")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def verification
|
def verification
|
||||||
|
|||||||
@@ -1,114 +0,0 @@
|
|||||||
<% provide :title do %><%= t("pages.titles.accessibility") %><% end %>
|
|
||||||
<% content_for :canonical do %>
|
|
||||||
<%= render "shared/canonical", href: page_url("accessibility") %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 column">
|
|
||||||
|
|
||||||
<h1><%= t("pages.accessibility.title") %></h1>
|
|
||||||
<%= simple_format(t("pages.accessibility.description")) %>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<% t("pages.accessibility.examples").each do |example| %>
|
|
||||||
<li><%= example %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2><%= t("pages.accessibility.keyboard_shortcuts.title") %></h2>
|
|
||||||
|
|
||||||
<p><%= t("pages.accessibility.keyboard_shortcuts.navigation_table.description") %></p>
|
|
||||||
|
|
||||||
<div class="small-12 medium-6">
|
|
||||||
<table>
|
|
||||||
<caption class="show-for-sr">
|
|
||||||
<%= t("pages.accessibility.keyboard_shortcuts.navigation_table.caption") %>
|
|
||||||
</caption>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col" class="text-center">
|
|
||||||
<%= t("pages.accessibility.keyboard_shortcuts.navigation_table.key_header") %>
|
|
||||||
</th>
|
|
||||||
<th scope="col">
|
|
||||||
<%= t("pages.accessibility.keyboard_shortcuts.navigation_table.page_header") %>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% t("pages.accessibility.keyboard_shortcuts.navigation_table.rows").each do |row| %>
|
|
||||||
<tr>
|
|
||||||
<td class="text-center"><%= row[:key_column] %></td>
|
|
||||||
<td><%= row[:page_column] %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p><%= t("pages.accessibility.keyboard_shortcuts.browser_table.description") %></p>
|
|
||||||
|
|
||||||
<div class="small-12 medium-6">
|
|
||||||
<table>
|
|
||||||
<caption class="show-for-sr">
|
|
||||||
<%= t("pages.accessibility.keyboard_shortcuts.browser_table.caption") %>
|
|
||||||
</caption>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">
|
|
||||||
<%= t("pages.accessibility.keyboard_shortcuts.browser_table.browser_header") %>
|
|
||||||
</th>
|
|
||||||
<th scope="col">
|
|
||||||
<%= t("pages.accessibility.keyboard_shortcuts.browser_table.key_header") %>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% t("pages.accessibility.keyboard_shortcuts.browser_table.rows").each do |row| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= row[:browser_column] %></td>
|
|
||||||
<td><%= row[:key_column] %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h2><%= t("pages.accessibility.textsize.title") %></h2>
|
|
||||||
<p><%= t("pages.accessibility.textsize.browser_settings_table.description") %></p>
|
|
||||||
|
|
||||||
<div class="small-12 medium-6">
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">
|
|
||||||
<%= t("pages.accessibility.textsize.browser_settings_table.browser_header") %>
|
|
||||||
</th>
|
|
||||||
<th scope="col">
|
|
||||||
<%= t("pages.accessibility.textsize.browser_settings_table.action_header") %>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<% t("pages.accessibility.textsize.browser_settings_table.rows").each do |row| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= row[:browser_column] %></td>
|
|
||||||
<td><%= row[:action_column] %></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<p><%= t("pages.accessibility.textsize.browser_shortcuts_table.description") %></p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<% t("pages.accessibility.textsize.browser_shortcuts_table.rows").each do |row| %>
|
|
||||||
<li><code><%= row[:shortcut_column] %></code> <%= row[:description_column] %></li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<h2><%= t("pages.accessibility.compatibility.title") %></h2>
|
|
||||||
|
|
||||||
<p><%= t("pages.accessibility.compatibility.description_html") %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<% provide :title do %><%= t("pages.titles.conditions") %><% end %>
|
|
||||||
<% content_for :canonical do %>
|
|
||||||
<%= render "shared/canonical", href: page_url("conditions") %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="row margin-top">
|
|
||||||
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<h1><%= t("pages.conditions.title") %></h1>
|
|
||||||
<h2><%= t("pages.conditions.subtitle") %></h2>
|
|
||||||
<p><%= t("pages.conditions.description") %></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<%= render '/shared/print' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<% content_for :canonical do %>
|
|
||||||
<%= render "shared/canonical", href: faq_url %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="row margin-top">
|
|
||||||
<div class="menu small-12 medium-3 column">
|
|
||||||
<%= back_link_to %>
|
|
||||||
|
|
||||||
<ul class="menu vertical margin-top">
|
|
||||||
<li><a href="#1"><strong><%= t("pages.help.faq.page.faq_1_title") %></strong></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="text small-12 medium-9 column">
|
|
||||||
<h1 class="clear"><%= t("pages.help.faq.page.title") %></h1>
|
|
||||||
<p><%= t("pages.help.faq.page.description") %></p>
|
|
||||||
|
|
||||||
<h2 id="1"><%= t("pages.help.faq.page.faq_1_title") %></h2>
|
|
||||||
<p><%= t("pages.help.faq.page.faq_1_description") %></p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<% provide :title do %><%= t("pages.titles.privacy") %><% end %>
|
|
||||||
<% content_for :canonical do %>
|
|
||||||
<%= render "shared/canonical", href: page_url("privacy") %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="row margin-top">
|
|
||||||
|
|
||||||
<div class="small-12 medium-9 column">
|
|
||||||
<h1><%= t("pages.privacy.title") %></h1>
|
|
||||||
<h2><%= t("pages.privacy.subtitle") %></h2>
|
|
||||||
|
|
||||||
<ol>
|
|
||||||
<% t("pages.privacy.info_items").each do |item| %>
|
|
||||||
<% if item.key? :text %>
|
|
||||||
<li><%= item[:text] %></li>
|
|
||||||
<% else %>
|
|
||||||
<ul>
|
|
||||||
<% item[:subitems].each do |subitem| %>
|
|
||||||
<li>
|
|
||||||
<strong> <%= subitem[:field] %></strong>
|
|
||||||
<%= subitem[:description] %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</ol>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="small-12 medium-3 column">
|
|
||||||
<%= render '/shared/print' %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
<h2><%= t("welcome.welcome.title") %></h2>
|
|
||||||
|
|
||||||
<div class="user-permissions">
|
|
||||||
<p><%= t("welcome.welcome.user_permission_info") %></p>
|
|
||||||
<ul>
|
|
||||||
<li><span class="icon-check"></span> <%= t("welcome.welcome.user_permission_debates") %></li>
|
|
||||||
<li><span class="icon-check"></span> <%= t("welcome.welcome.user_permission_proposal") %></li>
|
|
||||||
<li>
|
|
||||||
<% if current_user.level_two_or_three_verified? %>
|
|
||||||
<span class="icon-check"></span>
|
|
||||||
<% else %>
|
|
||||||
<span class="icon-x"></span>
|
|
||||||
<% end %>
|
|
||||||
<%= t("welcome.welcome.user_permission_support_proposal") %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<% if current_user.level_three_verified? %>
|
|
||||||
<span class="icon-check"></span>
|
|
||||||
<% else %>
|
|
||||||
<span class="icon-x"></span>
|
|
||||||
<% end %>
|
|
||||||
<%= t("welcome.welcome.user_permission_votes") %>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<span><%= t("welcome.welcome.user_permission_verify_info") %></span>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<%= t("welcome.welcome.user_permission_verify") %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<% if current_user.level_three_verified? %>
|
|
||||||
<p class="already-verified">
|
|
||||||
<span class="icon-check"></span>
|
|
||||||
<%= t("account.show.verified_account") %>
|
|
||||||
</p>
|
|
||||||
<% else %>
|
|
||||||
<%= link_to(t("welcome.welcome.user_permission_verify_my_account"), verification_path, class: "button success radius expand") %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<% if feature?(:help_page) %>
|
|
||||||
<%= link_to t("welcome.welcome.go_to_index"), help_path %>
|
|
||||||
<% else %>
|
|
||||||
<%= link_to t("welcome.welcome.go_to_index"), root_path %>
|
|
||||||
<% end %>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
@@ -73,8 +73,9 @@ data:
|
|||||||
# Find translate calls
|
# Find translate calls
|
||||||
search:
|
search:
|
||||||
## Paths or `File.find` patterns to search in:
|
## Paths or `File.find` patterns to search in:
|
||||||
# paths:
|
paths:
|
||||||
# - app/
|
- app/
|
||||||
|
- db/pages/
|
||||||
|
|
||||||
## Root directories for relative keys resolution.
|
## Root directories for relative keys resolution.
|
||||||
# relative_roots:
|
# relative_roots:
|
||||||
|
|||||||
@@ -799,13 +799,14 @@ en:
|
|||||||
question: Do you already have an account in %{org_name}?
|
question: Do you already have an account in %{org_name}?
|
||||||
title: Account verification
|
title: Account verification
|
||||||
welcome:
|
welcome:
|
||||||
go_to_index: See proposals and debates
|
go_to_index: Not now, go to index page
|
||||||
|
start_using_consul: Go to index page
|
||||||
title: Participate
|
title: Participate
|
||||||
user_permission_debates: Participate on debates
|
user_permission_debates: Participate on debates
|
||||||
user_permission_info: With your account you can...
|
user_permission_info: With your account you can...
|
||||||
user_permission_proposal: Create new proposals
|
user_permission_proposal: Create new proposals
|
||||||
user_permission_support_proposal: Support proposals*
|
user_permission_support_proposal: Support proposals*
|
||||||
user_permission_verify: To perform all the actions verify your account.
|
user_permission_verify: "To perform the following actions verify your account."
|
||||||
user_permission_verify_info: "* Only for users on Census."
|
user_permission_verify_info: "* Only for users on Census."
|
||||||
user_permission_verify_my_account: Verify my account
|
user_permission_verify_my_account: Verify my account
|
||||||
user_permission_votes: Participate on final voting
|
user_permission_votes: Participate on final voting
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ en:
|
|||||||
page:
|
page:
|
||||||
title: "Frequently Asked Questions"
|
title: "Frequently Asked Questions"
|
||||||
description: "Use this page to resolve the common FAQs to the users of site."
|
description: "Use this page to resolve the common FAQs to the users of site."
|
||||||
faq_1_title: "Question 1"
|
|
||||||
faq_1_description: "This is an example for the description of question one."
|
|
||||||
other:
|
other:
|
||||||
title: "Other information of interest"
|
title: "Other information of interest"
|
||||||
how_to_use: "Use %{org_name} in your city"
|
how_to_use: "Use %{org_name} in your city"
|
||||||
@@ -67,18 +65,7 @@ en:
|
|||||||
how_to_use: Use it in your local government
|
how_to_use: Use it in your local government
|
||||||
privacy:
|
privacy:
|
||||||
title: Privacy Policy
|
title: Privacy Policy
|
||||||
subtitle: INFORMATION REGARDING DATA PRIVACY
|
subtitle: "Information page on privacy"
|
||||||
info_items:
|
|
||||||
- text: The navigation through the information available in the Open Government Portal is anonymous.
|
|
||||||
- text: To use the services contained in the Open Government Portal, the user must register and previously provide personal data according to the specific information included in each type of registration.
|
|
||||||
- text: 'The data provided will be incorporated and processed by the City Council in accordance with the description of the following file:'
|
|
||||||
- subitems:
|
|
||||||
- field: 'File name:'
|
|
||||||
description: NAME OF THE FILE
|
|
||||||
- field: 'Purpose of the file:'
|
|
||||||
description: Managing participatory processes to control the qualification of the people participating in them and merely numerical and statistical recount of the results derived from citizen participation processes.
|
|
||||||
- field: 'Institution in charge of the file:'
|
|
||||||
description: INSTITUTION IN CHARGE OF THE FILE
|
|
||||||
accessibility:
|
accessibility:
|
||||||
title: Accessibility
|
title: Accessibility
|
||||||
description: |-
|
description: |-
|
||||||
@@ -154,10 +141,7 @@ en:
|
|||||||
title: Compatibility with standards and visual design
|
title: Compatibility with standards and visual design
|
||||||
description_html: 'All pages of this website comply with the <strong>Accessibility Guidelines</strong> or General Principles of Accessible Design established by the Working Group <abbr title="Web Accessibility Initiative" lang="en">WAI</abbr> belonging to W3C.'
|
description_html: 'All pages of this website comply with the <strong>Accessibility Guidelines</strong> or General Principles of Accessible Design established by the Working Group <abbr title="Web Accessibility Initiative" lang="en">WAI</abbr> belonging to W3C.'
|
||||||
titles:
|
titles:
|
||||||
accessibility: Accessibility
|
|
||||||
conditions: Terms of use
|
|
||||||
help: "What is %{org}? - Citizen participation"
|
help: "What is %{org}? - Citizen participation"
|
||||||
privacy: Privacy Policy
|
|
||||||
verify:
|
verify:
|
||||||
code: Code you received in letter
|
code: Code you received in letter
|
||||||
email: Email
|
email: Email
|
||||||
|
|||||||
@@ -798,13 +798,14 @@ es:
|
|||||||
question: '¿Tienes ya una cuenta en %{org_name}?'
|
question: '¿Tienes ya una cuenta en %{org_name}?'
|
||||||
title: Verificación de cuenta
|
title: Verificación de cuenta
|
||||||
welcome:
|
welcome:
|
||||||
go_to_index: Ahora no, ver propuestas
|
go_to_index: Ahora no, ir a la página de inicio
|
||||||
|
start_using_consul: Ir a la página de inicio
|
||||||
title: Empieza a participar
|
title: Empieza a participar
|
||||||
user_permission_debates: Participar en debates
|
user_permission_debates: Participar en debates
|
||||||
user_permission_info: Con tu cuenta ya puedes...
|
user_permission_info: Con tu cuenta ya puedes...
|
||||||
user_permission_proposal: Crear nuevas propuestas
|
user_permission_proposal: Crear nuevas propuestas
|
||||||
user_permission_support_proposal: Apoyar propuestas*
|
user_permission_support_proposal: Apoyar propuestas*
|
||||||
user_permission_verify: Para poder realizar todas las acciones, verifica tu cuenta.
|
user_permission_verify: "Para poder realizar las siguientes acciones, verifica tu cuenta."
|
||||||
user_permission_verify_info: "* Sólo usuarios empadronados."
|
user_permission_verify_info: "* Sólo usuarios empadronados."
|
||||||
user_permission_verify_my_account: Verificar mi cuenta
|
user_permission_verify_my_account: Verificar mi cuenta
|
||||||
user_permission_votes: Participar en las votaciones finales*
|
user_permission_votes: Participar en las votaciones finales*
|
||||||
|
|||||||
@@ -51,8 +51,6 @@ es:
|
|||||||
page:
|
page:
|
||||||
title: "Preguntas Frecuentes"
|
title: "Preguntas Frecuentes"
|
||||||
description: "Utiliza esta página para resolver las Preguntas frecuentes a los usuarios del sitio."
|
description: "Utiliza esta página para resolver las Preguntas frecuentes a los usuarios del sitio."
|
||||||
faq_1_title: "Pregunta 1"
|
|
||||||
faq_1_description: "Este es un ejemplo para la descripción de la pregunta uno."
|
|
||||||
other:
|
other:
|
||||||
title: "Otra información de interés"
|
title: "Otra información de interés"
|
||||||
how_to_use: "Utiliza %{org_name} en tu municipio"
|
how_to_use: "Utiliza %{org_name} en tu municipio"
|
||||||
@@ -67,25 +65,7 @@ es:
|
|||||||
how_to_use: Utilízalo en tu municipio
|
how_to_use: Utilízalo en tu municipio
|
||||||
privacy:
|
privacy:
|
||||||
title: Política de privacidad
|
title: Política de privacidad
|
||||||
subtitle: AVISO DE PROTECCIÓN DE DATOS
|
subtitle: Página de información de protección de datos
|
||||||
info_items:
|
|
||||||
-
|
|
||||||
text: La navegación por la informacion disponible en el Portal de Gobierno Abierto es anónima.
|
|
||||||
-
|
|
||||||
text: Para utilizar los servicios contenidos en el Portal de Gobierno Abierto el usuario deberá darse de alta y proporcionar previamente los datos de carácter personal segun la informacion especifica que consta en cada tipo de alta.
|
|
||||||
-
|
|
||||||
text: 'Los datos aportados serán incorporados y tratados por el Ayuntamiento de acuerdo con la descripción del fichero siguiente:'
|
|
||||||
-
|
|
||||||
subitems:
|
|
||||||
-
|
|
||||||
field: 'Nombre del fichero/tratamiento:'
|
|
||||||
description: NOMBRE DEL FICHERO
|
|
||||||
-
|
|
||||||
field: 'Finalidad del fichero/tratamiento:'
|
|
||||||
description: Gestionar los procesos participativos para el control de la habilitación de las personas que participan en los mismos y recuento meramente numérico y estadístico de los resultados derivados de los procesos de participación ciudadana.
|
|
||||||
-
|
|
||||||
field: 'Órgano responsable:'
|
|
||||||
description: ÓRGANO RESPONSABLE
|
|
||||||
accessibility:
|
accessibility:
|
||||||
title: Accesibilidad
|
title: Accesibilidad
|
||||||
description: |-
|
description: |-
|
||||||
@@ -179,10 +159,7 @@ es:
|
|||||||
title: Compatibilidad con estándares y diseño visual
|
title: Compatibilidad con estándares y diseño visual
|
||||||
description_html: 'Todas las páginas de este sitio web cumplen con las <strong>Pautas de Accesibilidad</strong> o Principios Generales de Diseño Accesible establecidas por el Grupo de Trabajo <abbr title="Web Accessibility Initiative" lang="en">WAI</abbr> perteneciente al W3C.'
|
description_html: 'Todas las páginas de este sitio web cumplen con las <strong>Pautas de Accesibilidad</strong> o Principios Generales de Diseño Accesible establecidas por el Grupo de Trabajo <abbr title="Web Accessibility Initiative" lang="en">WAI</abbr> perteneciente al W3C.'
|
||||||
titles:
|
titles:
|
||||||
accessibility: Accesibilidad
|
|
||||||
conditions: Condiciones de uso
|
|
||||||
help: "¿Qué es %{org}? - Participación ciudadana"
|
help: "¿Qué es %{org}? - Participación ciudadana"
|
||||||
privacy: Política de privacidad
|
|
||||||
verify:
|
verify:
|
||||||
code: Código que has recibido en tu carta
|
code: Código que has recibido en tu carta
|
||||||
email: Email
|
email: Email
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ Rails.application.routes.draw do
|
|||||||
# More info pages
|
# More info pages
|
||||||
get 'help', to: 'pages#show', id: 'help/index', as: 'help'
|
get 'help', to: 'pages#show', id: 'help/index', as: 'help'
|
||||||
get 'help/how-to-use', to: 'pages#show', id: 'help/how_to_use/index', as: 'how_to_use'
|
get 'help/how-to-use', to: 'pages#show', id: 'help/how_to_use/index', as: 'how_to_use'
|
||||||
get 'help/faq', to: 'pages#show', id: 'help/faq/index', as: 'faq'
|
get "help/faq", to: "pages#show", id: "faq", as: "faq"
|
||||||
|
|
||||||
# Static pages
|
# Static pages
|
||||||
resources :pages, path: '/', only: [:show]
|
resources :pages, path: '/', only: [:show]
|
||||||
|
|||||||
7
db/pages.rb
Normal file
7
db/pages.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
load Rails.root.join("db", "pages", "welcome_level_three_verified.rb")
|
||||||
|
load Rails.root.join("db", "pages", "welcome_level_two_verified.rb")
|
||||||
|
load Rails.root.join("db", "pages", "welcome_not_verified.rb")
|
||||||
|
load Rails.root.join("db", "pages", "accessibility.rb")
|
||||||
|
load Rails.root.join("db", "pages", "conditions.rb")
|
||||||
|
load Rails.root.join("db", "pages", "privacy.rb")
|
||||||
|
load Rails.root.join("db", "pages", "faq.rb")
|
||||||
96
db/pages/accessibility.rb
Normal file
96
db/pages/accessibility.rb
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("accessibility").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "accessibility", status: "published")
|
||||||
|
page.title = I18n.t("pages.accessibility.title")
|
||||||
|
|
||||||
|
content = ""
|
||||||
|
I18n.t("pages.accessibility.description").each_line do |line|
|
||||||
|
content << "<p>#{line}</p>"
|
||||||
|
end
|
||||||
|
content << "<ul>"
|
||||||
|
I18n.t("pages.accessibility.examples").each do |example|
|
||||||
|
content << "<li>#{example}</li>"
|
||||||
|
end
|
||||||
|
content << "</ul>
|
||||||
|
<h2>#{I18n.t("pages.accessibility.keyboard_shortcuts.title")}</h2>
|
||||||
|
<p>#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.description")}</p>
|
||||||
|
<table>
|
||||||
|
<caption class='show-for-sr'>
|
||||||
|
#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.caption")}
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope='col' class='text-center'>
|
||||||
|
#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.key_header")}
|
||||||
|
</th>
|
||||||
|
<th scope='col'>
|
||||||
|
#{I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.page_header")}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>"
|
||||||
|
I18n.t("pages.accessibility.keyboard_shortcuts.navigation_table.rows").each do |row|
|
||||||
|
content << " <tr>
|
||||||
|
<td class='text-center'>#{row[:key_column]}</td>
|
||||||
|
<td>#{row[:page_column]}</td>
|
||||||
|
</tr>"
|
||||||
|
end
|
||||||
|
content << " </tbody>
|
||||||
|
</table>
|
||||||
|
<p>#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.description")}</p>
|
||||||
|
<table>
|
||||||
|
<caption class='show-for-sr'>
|
||||||
|
#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.caption")}
|
||||||
|
</caption>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope='col'>
|
||||||
|
#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.browser_header")}
|
||||||
|
</th>
|
||||||
|
<th scope='col'>
|
||||||
|
#{I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.key_header")}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>"
|
||||||
|
I18n.t("pages.accessibility.keyboard_shortcuts.browser_table.rows").each do |row|
|
||||||
|
content << " <tr>
|
||||||
|
<td>#{row[:browser_column]}</td>
|
||||||
|
<td>#{row[:key_column]}</td>
|
||||||
|
</tr>"
|
||||||
|
end
|
||||||
|
content << " </tbody>
|
||||||
|
</table>
|
||||||
|
<h2>#{I18n.t("pages.accessibility.textsize.title")}</h2>
|
||||||
|
<p>#{I18n.t("pages.accessibility.textsize.browser_settings_table.description")}</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope='col'>
|
||||||
|
#{I18n.t("pages.accessibility.textsize.browser_settings_table.browser_header")}
|
||||||
|
</th>
|
||||||
|
<th scope='col'>
|
||||||
|
#{I18n.t("pages.accessibility.textsize.browser_settings_table.action_header")}
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>"
|
||||||
|
I18n.t("pages.accessibility.textsize.browser_settings_table.rows").each do |row|
|
||||||
|
content << " <tr>
|
||||||
|
<td>#{row[:browser_column]}</td>
|
||||||
|
<td>#{row[:action_column]}</td>
|
||||||
|
</tr>"
|
||||||
|
end
|
||||||
|
content << " </tbody>
|
||||||
|
</table>"
|
||||||
|
content << "<p>#{I18n.t("pages.accessibility.textsize.browser_shortcuts_table.description")}</p>
|
||||||
|
<ul>"
|
||||||
|
I18n.t("pages.accessibility.textsize.browser_shortcuts_table.rows").each do |row|
|
||||||
|
content << "<li><strong>#{row[:shortcut_column]}</strong> #{row[:description_column]}</li>"
|
||||||
|
end
|
||||||
|
content << "</ul>
|
||||||
|
<h2>#{I18n.t("pages.accessibility.compatibility.title")}</h2>
|
||||||
|
<p>#{I18n.t("pages.accessibility.compatibility.description_html")}</p>"
|
||||||
|
|
||||||
|
page.content = content
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
8
db/pages/conditions.rb
Normal file
8
db/pages/conditions.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("conditions").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "conditions", status: "published")
|
||||||
|
page.print_content_flag = true
|
||||||
|
page.title = I18n.t("pages.conditions.title")
|
||||||
|
page.subtitle = I18n.t("pages.conditions.subtitle")
|
||||||
|
page.content = "<p>#{I18n.t("pages.conditions.description")}</p>"
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
6
db/pages/faq.rb
Normal file
6
db/pages/faq.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("faq").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "faq", status: "published")
|
||||||
|
page.title = I18n.t("pages.help.faq.page.title")
|
||||||
|
page.content = "<p>#{I18n.t("pages.help.faq.page.description")}</p>"
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
7
db/pages/privacy.rb
Normal file
7
db/pages/privacy.rb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("privacy").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "privacy", status: "published")
|
||||||
|
page.print_content_flag = true
|
||||||
|
page.title = I18n.t("pages.privacy.title")
|
||||||
|
page.content = I18n.t("pages.privacy.subtitle")
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
19
db/pages/welcome_level_three_verified.rb
Normal file
19
db/pages/welcome_level_three_verified.rb
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("welcome_level_three_verified").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "welcome_level_three_verified", status: "published")
|
||||||
|
page.title = I18n.t("welcome.welcome.title")
|
||||||
|
|
||||||
|
page.content = "<p>#{I18n.t("welcome.welcome.user_permission_info")}</p>
|
||||||
|
<ul>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_debates")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_proposal")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_support_proposal")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_votes")}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>#{I18n.t("welcome.welcome.user_permission_verify_info")}</p>
|
||||||
|
|
||||||
|
<p>#{I18n.t("account.show.verified_account")}</p>
|
||||||
|
|
||||||
|
<p><a href='/'>#{I18n.t("welcome.welcome.start_using_consul")}</a></p>"
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
25
db/pages/welcome_level_two_verified.rb
Normal file
25
db/pages/welcome_level_two_verified.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("welcome_level_two_verified").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "welcome_level_two_verified", status: "published")
|
||||||
|
page.title = I18n.t("welcome.welcome.title")
|
||||||
|
|
||||||
|
page.content = "<p>#{I18n.t("welcome.welcome.user_permission_info")}</p>
|
||||||
|
<ul>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_debates")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_proposal")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_support_proposal")}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>#{I18n.t("welcome.welcome.user_permission_verify")}</p>
|
||||||
|
<ul>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_votes")}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>#{I18n.t("welcome.welcome.user_permission_verify_info")}</p>
|
||||||
|
|
||||||
|
<a href='/verification' class='button success radius expand'>
|
||||||
|
#{I18n.t("welcome.welcome.user_permission_verify_my_account")}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<p><a href='/'>#{I18n.t("welcome.welcome.go_to_index")}</a></p>"
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
25
db/pages/welcome_not_verified.rb
Normal file
25
db/pages/welcome_not_verified.rb
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
if SiteCustomization::Page.find_by_slug("welcome_not_verified").nil?
|
||||||
|
page = SiteCustomization::Page.new(slug: "welcome_not_verified", status: "published")
|
||||||
|
page.title = I18n.t("welcome.welcome.title")
|
||||||
|
|
||||||
|
page.content = "<p>#{I18n.t("welcome.welcome.user_permission_info")}</p>
|
||||||
|
<ul>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_debates")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_proposal")}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>#{I18n.t("welcome.welcome.user_permission_verify")}</p>
|
||||||
|
<ul>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_support_proposal")}</li>
|
||||||
|
<li>#{I18n.t("welcome.welcome.user_permission_votes")}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>#{I18n.t("welcome.welcome.user_permission_verify_info")}</p>
|
||||||
|
|
||||||
|
<a href='/verification' class='button success radius expand'>
|
||||||
|
#{I18n.t("welcome.welcome.user_permission_verify_my_account")}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<p><a href='/'>#{I18n.t("welcome.welcome.go_to_index")}</a></p>"
|
||||||
|
page.save!
|
||||||
|
end
|
||||||
@@ -126,3 +126,6 @@ WebSection.create(name: "debates")
|
|||||||
WebSection.create(name: "proposals")
|
WebSection.create(name: "proposals")
|
||||||
WebSection.create(name: "budgets")
|
WebSection.create(name: "budgets")
|
||||||
WebSection.create(name: "help_page")
|
WebSection.create(name: "help_page")
|
||||||
|
|
||||||
|
# Default custom pages
|
||||||
|
load Rails.root.join("db", "pages.rb")
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
class AdminWYSIWYGSanitizer < WYSIWYGSanitizer
|
class AdminWYSIWYGSanitizer < WYSIWYGSanitizer
|
||||||
def allowed_tags
|
def allowed_tags
|
||||||
super + %w[img]
|
super + %w[img table caption thead tbody tr th td]
|
||||||
end
|
end
|
||||||
|
|
||||||
def allowed_attributes
|
def allowed_attributes
|
||||||
super + %w[alt src style]
|
super + %w[alt src align border cellpadding cellspacing dir style class summary scope id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,4 +4,9 @@ namespace :db do
|
|||||||
@avoid_log = args[:print_log] == "avoid_log"
|
@avoid_log = args[:print_log] == "avoid_log"
|
||||||
load(Rails.root.join("db", "dev_seeds.rb"))
|
load(Rails.root.join("db", "dev_seeds.rb"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "populate the default pages manually"
|
||||||
|
task pages: :environment do
|
||||||
|
load(Rails.root.join("db", "pages.rb"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ describe PagesController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "includes a faq page" do
|
it "includes a faq page" do
|
||||||
get :show, id: "help/faq/index"
|
get :show, id: :faq
|
||||||
expect(response).to be_ok
|
expect(response).to be_ok
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
0
spec/controllers/welcome_controller_spec.rb
Normal file
0
spec/controllers/welcome_controller_spec.rb
Normal file
@@ -13,7 +13,9 @@ feature "Admin custom pages" do
|
|||||||
%w[title subtitle],
|
%w[title subtitle],
|
||||||
{ "content" => :ckeditor }
|
{ "content" => :ckeditor }
|
||||||
|
|
||||||
scenario "Index" do
|
context "Index" do
|
||||||
|
|
||||||
|
scenario "lists all created custom pages" do
|
||||||
custom_page = create(:site_customization_page)
|
custom_page = create(:site_customization_page)
|
||||||
visit admin_site_customization_pages_path
|
visit admin_site_customization_pages_path
|
||||||
|
|
||||||
@@ -21,6 +23,25 @@ feature "Admin custom pages" do
|
|||||||
expect(page).to have_content(custom_page.slug)
|
expect(page).to have_content(custom_page.slug)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "should contain all default custom pages published populated by db:seeds" do
|
||||||
|
slugs = %w[accessibility conditions faq privacy welcome_not_verified
|
||||||
|
welcome_level_two_verified welcome_level_three_verified]
|
||||||
|
|
||||||
|
visit admin_site_customization_pages_path
|
||||||
|
|
||||||
|
expect(SiteCustomization::Page.count).to be 7
|
||||||
|
slugs.each do |slug|
|
||||||
|
expect(SiteCustomization::Page.find_by_slug(slug).status).to eq "published"
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(all("[id^='site_customization_page_']").count).to be 7
|
||||||
|
slugs.each do |slug|
|
||||||
|
expect(page).to have_content slug
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
context "Create" do
|
context "Create" do
|
||||||
scenario "Valid custom page" do
|
scenario "Valid custom page" do
|
||||||
visit admin_root_path
|
visit admin_root_path
|
||||||
|
|||||||
@@ -1,39 +1,6 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
feature "Custom Pages" do
|
feature "Custom Pages" do
|
||||||
context "Override existing page" do
|
|
||||||
scenario "See default content when custom page is not published" do
|
|
||||||
custom_page = create(:site_customization_page,
|
|
||||||
slug: "conditions",
|
|
||||||
title_en: "Custom conditions",
|
|
||||||
content_en: "New text for conditions page",
|
|
||||||
print_content_flag: true
|
|
||||||
)
|
|
||||||
|
|
||||||
visit custom_page.url
|
|
||||||
|
|
||||||
expect(page).to have_title("Terms of use")
|
|
||||||
expect(page).to have_selector("h1", text: "Terms and conditions of use")
|
|
||||||
expect(page).to have_content("Information page on the conditions of use, privacy and protection of personal data.")
|
|
||||||
expect(page).to have_content("Print this info")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "See custom content when custom page is published" do
|
|
||||||
custom_page = create(:site_customization_page, :published,
|
|
||||||
slug: "conditions",
|
|
||||||
title_en: "Custom conditions",
|
|
||||||
content_en: "New text for conditions page",
|
|
||||||
print_content_flag: true
|
|
||||||
)
|
|
||||||
|
|
||||||
visit custom_page.url
|
|
||||||
|
|
||||||
expect(page).to have_title("Custom conditions")
|
|
||||||
expect(page).to have_selector("h1", text: "Custom conditions")
|
|
||||||
expect(page).to have_content("New text for conditions page")
|
|
||||||
expect(page).to have_content("Print this info")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "New custom page" do
|
context "New custom page" do
|
||||||
context "Draft" do
|
context "Draft" do
|
||||||
|
|||||||
@@ -2,12 +2,29 @@ require "rails_helper"
|
|||||||
|
|
||||||
feature "Welcome screen" do
|
feature "Welcome screen" do
|
||||||
|
|
||||||
scenario "a regular users sees it the first time he logs in" do
|
let(:budget) { create(:budget) }
|
||||||
user = create(:user)
|
|
||||||
|
|
||||||
|
scenario "for a not verified user" do
|
||||||
|
user = create(:user)
|
||||||
login_through_form_as(user)
|
login_through_form_as(user)
|
||||||
|
|
||||||
expect(page).to have_current_path(welcome_path)
|
expect(page).to have_current_path(page_path("welcome_not_verified"))
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "for a level two verified user" do
|
||||||
|
user = create(:user, :level_two)
|
||||||
|
login_as(user)
|
||||||
|
|
||||||
|
visit welcome_path
|
||||||
|
expect(page).to have_current_path(page_path("welcome_level_two_verified"))
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "for a level three verified user" do
|
||||||
|
user = create(:user, :level_three)
|
||||||
|
login_as(user)
|
||||||
|
|
||||||
|
visit welcome_path
|
||||||
|
expect(page).to have_current_path(page_path("welcome_level_three_verified"))
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "a regular user does not see it when coing to /email" do
|
scenario "a regular user does not see it when coing to /email" do
|
||||||
|
|||||||
@@ -4,9 +4,30 @@ describe AdminWYSIWYGSanitizer do
|
|||||||
let(:sanitizer) { AdminWYSIWYGSanitizer.new }
|
let(:sanitizer) { AdminWYSIWYGSanitizer.new }
|
||||||
|
|
||||||
describe "#sanitize" do
|
describe "#sanitize" do
|
||||||
|
|
||||||
it "allows images" do
|
it "allows images" do
|
||||||
html = 'Dangerous<img src="/smile.png" alt="Smile" style="width: 10px;"> image'
|
html = 'Dangerous<img src="/smile.png" alt="Smile" style="width: 10px;"> image'
|
||||||
expect(sanitizer.sanitize(html)).to eq(html)
|
expect(sanitizer.sanitize(html)).to eq(html)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "allows tables" do
|
||||||
|
html = '<table align="center" border="2" cellpadding="2" cellspacing="2" dir="ltr" ' \
|
||||||
|
'id="table_id" class="stylesheet_classes" style="height:200px;width:500px;" ' \
|
||||||
|
'summary="summary">
|
||||||
|
<caption>caption</caption>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">header 1</th>
|
||||||
|
<td>cell 1</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">header 2</th>
|
||||||
|
<td>cell 2</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>'
|
||||||
|
expect(sanitizer.sanitize(html)).to eq(html)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
15
spec/lib/tasks/db_spec.rb
Normal file
15
spec/lib/tasks/db_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
require "rails_helper"
|
||||||
|
|
||||||
|
describe "rake db:pages" do
|
||||||
|
let :run_rake_task do
|
||||||
|
Rake.application.invoke_task("db:pages")
|
||||||
|
end
|
||||||
|
|
||||||
|
it "seeds the database with the default custom pages" do
|
||||||
|
SiteCustomization::Page.destroy_all
|
||||||
|
expect(SiteCustomization::Page.count).to be 0
|
||||||
|
|
||||||
|
run_rake_task
|
||||||
|
expect(SiteCustomization::Page.count).to be 7
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user