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([
|
||||
{ name: 'insert', items: [ 'Image' ] }
|
||||
{ name: 'insert', items: [ 'Image', 'Table' ] }
|
||||
]);
|
||||
|
||||
config.toolbar = "mini";
|
||||
|
||||
@@ -12,6 +12,13 @@ class WelcomeController < ApplicationController
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
search:
|
||||
## Paths or `File.find` patterns to search in:
|
||||
# paths:
|
||||
# - app/
|
||||
paths:
|
||||
- app/
|
||||
- db/pages/
|
||||
|
||||
## Root directories for relative keys resolution.
|
||||
# relative_roots:
|
||||
|
||||
@@ -799,13 +799,14 @@ en:
|
||||
question: Do you already have an account in %{org_name}?
|
||||
title: Account verification
|
||||
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
|
||||
user_permission_debates: Participate on debates
|
||||
user_permission_info: With your account you can...
|
||||
user_permission_proposal: Create new 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_my_account: Verify my account
|
||||
user_permission_votes: Participate on final voting
|
||||
|
||||
@@ -51,8 +51,6 @@ en:
|
||||
page:
|
||||
title: "Frequently Asked Questions"
|
||||
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:
|
||||
title: "Other information of interest"
|
||||
how_to_use: "Use %{org_name} in your city"
|
||||
@@ -67,18 +65,7 @@ en:
|
||||
how_to_use: Use it in your local government
|
||||
privacy:
|
||||
title: Privacy Policy
|
||||
subtitle: INFORMATION REGARDING DATA 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
|
||||
subtitle: "Information page on privacy"
|
||||
accessibility:
|
||||
title: Accessibility
|
||||
description: |-
|
||||
@@ -154,10 +141,7 @@ en:
|
||||
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.'
|
||||
titles:
|
||||
accessibility: Accessibility
|
||||
conditions: Terms of use
|
||||
help: "What is %{org}? - Citizen participation"
|
||||
privacy: Privacy Policy
|
||||
verify:
|
||||
code: Code you received in letter
|
||||
email: Email
|
||||
|
||||
@@ -798,13 +798,14 @@ es:
|
||||
question: '¿Tienes ya una cuenta en %{org_name}?'
|
||||
title: Verificación de cuenta
|
||||
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
|
||||
user_permission_debates: Participar en debates
|
||||
user_permission_info: Con tu cuenta ya puedes...
|
||||
user_permission_proposal: Crear nuevas 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_my_account: Verificar mi cuenta
|
||||
user_permission_votes: Participar en las votaciones finales*
|
||||
|
||||
@@ -51,8 +51,6 @@ es:
|
||||
page:
|
||||
title: "Preguntas Frecuentes"
|
||||
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:
|
||||
title: "Otra información de interés"
|
||||
how_to_use: "Utiliza %{org_name} en tu municipio"
|
||||
@@ -67,25 +65,7 @@ es:
|
||||
how_to_use: Utilízalo en tu municipio
|
||||
privacy:
|
||||
title: Política de privacidad
|
||||
subtitle: AVISO 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
|
||||
subtitle: Página de información de protección de datos
|
||||
accessibility:
|
||||
title: Accesibilidad
|
||||
description: |-
|
||||
@@ -179,10 +159,7 @@ es:
|
||||
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.'
|
||||
titles:
|
||||
accessibility: Accesibilidad
|
||||
conditions: Condiciones de uso
|
||||
help: "¿Qué es %{org}? - Participación ciudadana"
|
||||
privacy: Política de privacidad
|
||||
verify:
|
||||
code: Código que has recibido en tu carta
|
||||
email: Email
|
||||
|
||||
@@ -45,7 +45,7 @@ Rails.application.routes.draw do
|
||||
# More info pages
|
||||
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/faq', to: 'pages#show', id: 'help/faq/index', as: 'faq'
|
||||
get "help/faq", to: "pages#show", id: "faq", as: "faq"
|
||||
|
||||
# Static pages
|
||||
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: "budgets")
|
||||
WebSection.create(name: "help_page")
|
||||
|
||||
# Default custom pages
|
||||
load Rails.root.join("db", "pages.rb")
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class AdminWYSIWYGSanitizer < WYSIWYGSanitizer
|
||||
def allowed_tags
|
||||
super + %w[img]
|
||||
super + %w[img table caption thead tbody tr th td]
|
||||
end
|
||||
|
||||
def allowed_attributes
|
||||
super + %w[alt src style]
|
||||
super + %w[alt src align border cellpadding cellspacing dir style class summary scope id]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,4 +4,9 @@ namespace :db do
|
||||
@avoid_log = args[:print_log] == "avoid_log"
|
||||
load(Rails.root.join("db", "dev_seeds.rb"))
|
||||
end
|
||||
|
||||
desc "populate the default pages manually"
|
||||
task pages: :environment do
|
||||
load(Rails.root.join("db", "pages.rb"))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -32,7 +32,7 @@ describe PagesController do
|
||||
end
|
||||
|
||||
it "includes a faq page" do
|
||||
get :show, id: "help/faq/index"
|
||||
get :show, id: :faq
|
||||
expect(response).to be_ok
|
||||
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],
|
||||
{ "content" => :ckeditor }
|
||||
|
||||
scenario "Index" do
|
||||
context "Index" do
|
||||
|
||||
scenario "lists all created custom pages" do
|
||||
custom_page = create(:site_customization_page)
|
||||
visit admin_site_customization_pages_path
|
||||
|
||||
@@ -21,6 +23,25 @@ feature "Admin custom pages" do
|
||||
expect(page).to have_content(custom_page.slug)
|
||||
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
|
||||
scenario "Valid custom page" do
|
||||
visit admin_root_path
|
||||
|
||||
@@ -1,39 +1,6 @@
|
||||
require "rails_helper"
|
||||
|
||||
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 "Draft" do
|
||||
|
||||
@@ -2,12 +2,29 @@ require "rails_helper"
|
||||
|
||||
feature "Welcome screen" do
|
||||
|
||||
scenario "a regular users sees it the first time he logs in" do
|
||||
user = create(:user)
|
||||
let(:budget) { create(:budget) }
|
||||
|
||||
scenario "for a not verified user" do
|
||||
user = create(: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
|
||||
|
||||
scenario "a regular user does not see it when coing to /email" do
|
||||
|
||||
@@ -4,9 +4,30 @@ describe AdminWYSIWYGSanitizer do
|
||||
let(:sanitizer) { AdminWYSIWYGSanitizer.new }
|
||||
|
||||
describe "#sanitize" do
|
||||
|
||||
it "allows images" do
|
||||
html = 'Dangerous<img src="/smile.png" alt="Smile" style="width: 10px;"> image'
|
||||
expect(sanitizer.sanitize(html)).to eq(html)
|
||||
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
|
||||
|
||||
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