Add new footer content block
Include a new content block called 'footer_legal' for additional legal footer items.
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
<li><%= link_to t("layouts.footer.privacy"), page_path("privacy") %></li>
|
<li><%= link_to t("layouts.footer.privacy"), page_path("privacy") %></li>
|
||||||
<li><%= link_to t("layouts.footer.conditions"), page_path("conditions") %></li>
|
<li><%= link_to t("layouts.footer.conditions"), page_path("conditions") %></li>
|
||||||
<li><%= link_to t("layouts.footer.accessibility"), page_path("accessibility") %></li>
|
<li><%= link_to t("layouts.footer.accessibility"), page_path("accessibility") %></li>
|
||||||
|
<%= raw footer_legal_content_block %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
class Layout::FooterComponent < ApplicationComponent
|
class Layout::FooterComponent < ApplicationComponent
|
||||||
|
delegate :content_block, to: :helpers
|
||||||
|
|
||||||
|
def footer_legal_content_block
|
||||||
|
content_block("footer_legal")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class SiteCustomization::ContentBlock < ApplicationRecord
|
class SiteCustomization::ContentBlock < ApplicationRecord
|
||||||
VALID_BLOCKS = %w[top_links footer subnavigation_left subnavigation_right].freeze
|
VALID_BLOCKS = %w[top_links footer footer_legal subnavigation_left subnavigation_right].freeze
|
||||||
|
|
||||||
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) }
|
||||||
validates :name, presence: true, uniqueness: { scope: :locale }, inclusion: { in: ->(*) { VALID_BLOCKS }}
|
validates :name, presence: true, uniqueness: { scope: :locale }, inclusion: { in: ->(*) { VALID_BLOCKS }}
|
||||||
|
|||||||
@@ -1590,7 +1590,8 @@ en:
|
|||||||
name: Name
|
name: Name
|
||||||
names:
|
names:
|
||||||
top_links: Top Links
|
top_links: Top Links
|
||||||
footer: Footer
|
footer: Footer (social media)
|
||||||
|
footer_legal: Footer (legal terms)
|
||||||
subnavigation_left: Main Navigation Left
|
subnavigation_left: Main Navigation Left
|
||||||
subnavigation_right: Main Navigation Right
|
subnavigation_right: Main Navigation Right
|
||||||
images:
|
images:
|
||||||
|
|||||||
@@ -1590,7 +1590,8 @@ es:
|
|||||||
name: Nombre
|
name: Nombre
|
||||||
names:
|
names:
|
||||||
top_links: Enlaces superiores
|
top_links: Enlaces superiores
|
||||||
footer: Pie de página
|
footer: Pie de página (redes sociales)
|
||||||
|
footer_legal: Pie de página (términos legales)
|
||||||
subnavigation_left: Navegación principal izquierda
|
subnavigation_left: Navegación principal izquierda
|
||||||
subnavigation_right: Navegación principal derecha
|
subnavigation_right: Navegación principal derecha
|
||||||
images:
|
images:
|
||||||
|
|||||||
@@ -26,14 +26,38 @@ describe "Custom content blocks" do
|
|||||||
|
|
||||||
visit "/?locale=en"
|
visit "/?locale=en"
|
||||||
|
|
||||||
|
within ".social" do
|
||||||
expect(page).to have_content("content for footer")
|
expect(page).to have_content("content for footer")
|
||||||
expect(page).not_to have_content("contenido para footer")
|
expect(page).not_to have_content("contenido para footer")
|
||||||
|
end
|
||||||
|
|
||||||
visit "/?locale=es"
|
visit "/?locale=es"
|
||||||
|
|
||||||
|
within ".social" do
|
||||||
expect(page).to have_content("contenido para footer")
|
expect(page).to have_content("contenido para footer")
|
||||||
expect(page).not_to have_content("content for footer")
|
expect(page).not_to have_content("content for footer")
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario "footer_legal content block" do
|
||||||
|
create(:site_customization_content_block, name: "footer_legal", locale: "en",
|
||||||
|
body: "legal content for footer")
|
||||||
|
create(:site_customization_content_block, name: "footer_legal", locale: "es",
|
||||||
|
body: "contenido legal para el footer")
|
||||||
|
|
||||||
|
visit "/?locale=en"
|
||||||
|
|
||||||
|
within ".legal" do
|
||||||
|
expect(page).to have_content("legal content for footer")
|
||||||
|
expect(page).not_to have_content("contenido legal para el footer")
|
||||||
|
end
|
||||||
|
|
||||||
|
visit "/?locale=es"
|
||||||
|
within ".legal" do
|
||||||
|
expect(page).to have_content("contenido legal para el footer")
|
||||||
|
expect(page).not_to have_content("legal content for footer")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
scenario "main navigation left" do
|
scenario "main navigation left" do
|
||||||
create(:site_customization_content_block, name: "subnavigation_left", locale: "en",
|
create(:site_customization_content_block, name: "subnavigation_left", locale: "en",
|
||||||
|
|||||||
Reference in New Issue
Block a user