Add census terms page by default

This commit is contained in:
decabeza
2022-04-30 18:02:50 +02:00
committed by Javi Martín
parent e18f85a570
commit f6da129857
6 changed files with 50 additions and 21 deletions

View File

@@ -1,5 +1,8 @@
en:
pages:
census_terms:
title: "Terms and conditions of access of the Census"
description: "Information page on the terms and conditions of access of the Census."
conditions:
title: Terms and conditions of use
subtitle: LEGAL NOTICE ON THE CONDITIONS OF USE, PRIVACY AND PROTECTION OF PERSONAL DATA OF THE OPEN GOVERNMENT PORTAL

View File

@@ -1,5 +1,8 @@
es:
pages:
census_terms:
title: "Términos y condiciones de acceso al Padrón"
description: "Página de información sobre los términos y condiciones de acceso al Padrón."
conditions:
title: Condiciones de uso
subtitle: AVISO LEGAL SOBRE LAS CONDICIONES DE USO, PRIVACIDAD Y PROTECCIÓN DE DATOS PERSONALES DEL PORTAL DE GOBIERNO ABIERTO

View File

@@ -5,3 +5,4 @@ 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")
load Rails.root.join("db", "pages", "census_terms.rb")

13
db/pages/census_terms.rb Normal file
View File

@@ -0,0 +1,13 @@
def generate_content(page)
page.title = I18n.t("pages.census_terms.title")
page.content = "<p>#{I18n.t("pages.census_terms.description")}</p>"
page.save!
end
if SiteCustomization::Page.find_by(slug: "census_terms").nil?
page = SiteCustomization::Page.new(slug: "census_terms", status: "published")
page.print_content_flag = true
I18n.available_locales.each do |locale|
I18n.with_locale(locale) { generate_content(page) }
end
end

View File

@@ -11,17 +11,17 @@ describe "Admin custom pages", :admin do
end
scenario "should contain all default custom pages published populated by db:seeds" do
slugs = %w[accessibility conditions faq privacy welcome_not_verified
slugs = %w[accessibility census_terms conditions faq privacy welcome_not_verified
welcome_level_two_verified welcome_level_three_verified]
expect(SiteCustomization::Page.count).to be 7
expect(SiteCustomization::Page.count).to be 8
slugs.each do |slug|
expect(SiteCustomization::Page.find_by(slug: slug).status).to eq "published"
end
visit admin_site_customization_pages_path
expect(all("[id^='site_customization_page_']").count).to be 7
expect(all("[id^='site_customization_page_']").count).to be 8
slugs.each do |slug|
expect(page).to have_content slug
end

View File

@@ -159,4 +159,13 @@ describe "Residence" do
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."
expect(page).to have_current_path(account_path)
end
scenario "Terms and conditions link" do
login_as(create(:user))
visit new_residence_path
click_link "the terms and conditions of access"
expect(page).to have_content "Terms and conditions of access of the Census"
end
end