Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:decidim/decidim into feature/i18…
Browse files Browse the repository at this point in the history
…n-org-name
  • Loading branch information
alecslupu committed May 16, 2024
2 parents c984a89 + 8afa643 commit 691dfe3
Show file tree
Hide file tree
Showing 29 changed files with 181 additions and 149 deletions.
13 changes: 12 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,18 @@ Additionally, if you need, you can also customize the `admin` and `system` inter

You can read more about this change on PR [\#12646](https://github.com/decidim/decidim/pull/12646).

### 3.6. [[TITLE OF THE ACTION]]
### 3.6. Update to Footer Topic and Pages functionality

We have changed the behavior of the footer pages and topics links:

- Removed the "show in the footer" checkbox for pages.
- Removed duplicate "Terms of Service" link.
- Always show the link to the "Terms of Service" page.
- Only show links in footer to topics.

You can read more about this change on PR [\#12592](https://github.com/decidim/decidim/pull/12592).

### 3.7. [[TITLE OF THE ACTION]]

You can read more about this change on PR [\#XXXX](https://github.com/decidim/decidim/pull/XXXX).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Decidim
module Admin
# A command with all the business logic when creating a static page.
class CreateStaticPage < Decidim::Commands::CreateResource
fetch_form_attributes :organization, :title, :slug, :show_in_footer, :weight, :topic, :content, :allow_public_access
fetch_form_attributes :organization, :title, :slug, :weight, :topic, :content, :allow_public_access

protected

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Decidim
module Admin
# A command with all the business logic when updating a static page.
class UpdateStaticPage < Decidim::Commands::UpdateResource
fetch_form_attributes :title, :slug, :show_in_footer, :weight, :topic, :content, :allow_public_access
fetch_form_attributes :title, :slug, :weight, :topic, :content, :allow_public_access

private

Expand Down
1 change: 0 additions & 1 deletion decidim-admin/app/forms/decidim/admin/static_page_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class StaticPageForm < Form
translatable_attribute :title, String
translatable_attribute :content, String
attribute :changed_notably, Boolean
attribute :show_in_footer, Boolean
attribute :allow_public_access, Boolean
attribute :weight, Integer
attribute :topic_id, Integer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
<%= form.number_field :weight, label: false %>
</div>

<div class="row column">
<%= form.check_box :show_in_footer %>
</div>

<% if form.object.control_public_access? %>
<div class="row column">
<%= form.check_box :allow_public_access %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ edit_link(
<%= render partial: "conference_hero" %>
<%= render layout: "layouts/decidim/shared/layout_two_col", locals: { reverse: true, main_enabled: false } do %>
<% layout_style = conference_nav_items(current_participatory_space).any? ? "layout_two_col" : "layout_center" %>
<%= render layout: "layouts/decidim/shared/#{layout_style}", locals: { reverse: true, main_enabled: false, columns: 10 } do %>
<%= participatory_space_floating_help %>

Expand Down
16 changes: 16 additions & 0 deletions decidim-conferences/spec/system/conferences_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@
visit decidim_conferences.conference_path(conference)
end

it "has a sidebar" do
expect(page).to have_css(".conference__nav-container")
end

describe "follow button" do
let!(:user) { create(:user, :confirmed, organization:) }
let(:followable) { conference }
Expand Down Expand Up @@ -267,4 +271,16 @@
end
end
end

describe "when the conference has no components" do
let!(:conference) { base_conference }

before do
visit decidim_conferences.conference_path(conference)
end

it "has no sidebar" do
expect(page).to have_no_css(".conference__nav-container")
end
end
end
3 changes: 0 additions & 3 deletions decidim-core/app/cells/decidim/footer_pages/pages.erb

This file was deleted.

12 changes: 0 additions & 12 deletions decidim-core/app/cells/decidim/footer_pages/topics.erb

This file was deleted.

66 changes: 0 additions & 66 deletions decidim-core/app/cells/decidim/footer_pages_cell.rb

This file was deleted.

8 changes: 8 additions & 0 deletions decidim-core/app/cells/decidim/footer_topics/show.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<nav role="navigation" aria-label="Help">
<h2 class="h4 mb-4">Help</h2>
<ul class="space-y-4 break-inside-avoid">
<% topics.each do |topic| %>
<%= topic_item(topic, class: "font-semibold underline") %>
<% end %>
</ul>
</nav>
39 changes: 39 additions & 0 deletions decidim-core/app/cells/decidim/footer_topics_cell.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

require "cell/partial"

module Decidim
# Topics and their corresponding pages are mapped out to the footer
# of the layout.
#
# Example:
#
# cell("decidim/footer_topics", nil)
#
class FooterTopicsCell < Decidim::ViewModel
def show
return if topics.blank?

render
end

private

def topics
@topics ||= current_organization.static_page_topics.where(show_in_footer: true).map do |topic|
next if topic.pages.empty?

{
title: decidim_escape_translated(topic.title),
path: decidim.page_path(topic.pages.first)
}
end.compact
end

def topic_item(page_data, opts = {})
content_tag(:li, **opts.slice(:class)) do
link_to page_data[:title], page_data[:path]
end
end
end
end
1 change: 0 additions & 1 deletion decidim-core/app/views/decidim/pages/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edit_link(
%>
<%= render layout:"layouts/decidim/shared/layout_center", locals: { columns: 8 } do %>

<div class="text-center py-10">
<h1 class="title-decorator inline-block text-left mb-12">
<%= t "decidim.pages.index.title" %>
Expand Down
3 changes: 1 addition & 2 deletions decidim-core/app/views/layouts/decidim/footer/_main.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
<div class="lg:w-1/3">
<%= render partial: "layouts/decidim/footer/main_intro" %>
</div>
<div class="lg:w-2/3 grid grid-cols-1 gap-x-4 gap-y-10 lg:grid-cols-4 text-md text-white">
<div class="lg:w-2/3 grid grid-cols-1 gap-x-44 gap-y-10 lg:grid-cols-4 text-md text-white">
<%= render partial: "layouts/decidim/footer/main_links" %>
</div>
<%= cell("decidim/footer_pages", :topics) %>
</div>
<div class="main-footer__down">
<nav class="md:w-1/2 lg:w-auto" role="navigation" aria-label="Legal">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<ul class="flex flex-col md:flex-row gap-10 text-sm text-white [&_a]:underline">
<%= cell("decidim/footer_pages", :pages) %>
<li>
<%= link_to t("layouts.decidim.footer.terms_and_conditions"), decidim.page_path("terms-and-conditions") %>
<%= link_to t("layouts.decidim.footer.terms_of_service"), decidim.page_path("terms-of-service") %>
</li>
<li>
<a href="#" data-dialog-open="dc-modal"><%= t("layouts.decidim.footer.data_consent_settings") %></a>
Expand Down
20 changes: 11 additions & 9 deletions decidim-core/app/views/layouts/decidim/footer/_main_links.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<%= footer_menu.render %>

<nav role="navigation" aria-label="<%= t("layouts.decidim.footer.resources") %>">
<h2 class="h4 mb-4"><%= t("layouts.decidim.footer.resources") %></h2>
<ul class="space-y-4 break-inside-avoid">
<li class="font-semibold underline"><%= link_to t("decidim.profiles.show.activity"), decidim.last_activities_path %></li>
<li class="font-semibold underline"><%= link_to t("decidim.pages.home.extended.meetings"), Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path %></li>
<li class="font-semibold underline"><%= link_to t("layouts.decidim.footer.download_open_data"), decidim.open_data_download_path %></li>
</ul>
</nav>

<nav role="navigation" aria-label="<%= t("layouts.decidim.user_menu.profile") %>">
<h2 class="h4 mb-4"><%= t("layouts.decidim.user_menu.profile") %></h2>
<ul class="space-y-4 break-inside-avoid">
Expand All @@ -25,3 +16,14 @@
<% end %>
</ul>
</nav>

<nav role="navigation" aria-label="<%= t("layouts.decidim.footer.resources") %>">
<h2 class="h4 mb-4"><%= t("layouts.decidim.footer.resources") %></h2>
<ul class="space-y-4 break-inside-avoid">
<li class="font-semibold underline"><%= link_to t("decidim.profiles.show.activity"), decidim.last_activities_path %></li>
<li class="font-semibold underline"><%= link_to t("decidim.pages.home.extended.meetings"), Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path %></li>
<li class="font-semibold underline"><%= link_to t("layouts.decidim.footer.download_open_data"), decidim.open_data_download_path %></li>
</ul>
</nav>

<%= cell("decidim/footer_topics", nil) %>
4 changes: 2 additions & 2 deletions decidim-core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ en:
content: "<p>In %{organization} you can participate and decide on different topics, through the spaces you see in the top menu: Processes, Assemblies, Initiatives, Consultations.</p> <p>Within each one you will find different options to participate: make proposals - individually or with other people-, take part in debates, prioritize projects to implement, attend face-to-face meetings and other actions.</p>\n"
title: What can I do in %{organization}?
description: Read more about %{organization}.
title: General Help
title: General
last_activities:
all: All activity types
index:
Expand Down Expand Up @@ -1932,7 +1932,7 @@ en:
made_with_open_source: Website made with <a target="_blank" href="https://github.com/decidim/decidim">free software</a>.
resources: Resources
sign_up: Sign Up
terms_and_conditions: Terms and Conditions
terms_of_service: Terms of Service
header:
log_in: Log in
main_menu: Main menu
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class RemoveShowInFooterInStaticPages < ActiveRecord::Migration[6.1]
def change
remove_column :decidim_static_pages, :show_in_footer, :boolean
end
end
6 changes: 0 additions & 6 deletions decidim-core/lib/decidim/core/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ def self.register_menu!
decidim.root_path,
position: 1,
active: :exclusive

menu.add_item :pages,
I18n.t("menu.help", scope: "decidim"),
decidim.pages_path,
position: 7,
active: :inclusive
end
end

Expand Down
1 change: 1 addition & 0 deletions decidim-core/lib/decidim/core/test/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ def generate_localized_title(field = nil, skip_injection: false)
end
title { generate_localized_title(:static_page_topic_title, skip_injection:) }
description { generate_localized_description(:static_page_topic_description, skip_injection:) }
show_in_footer { true }
organization
end

Expand Down
4 changes: 2 additions & 2 deletions decidim-core/spec/system/external_domain_warning_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
let(:allowlist) { ["decidim.org", "example.org"] }
let(:organization) { create(:organization, external_domain_allowlist: allowlist) }
let(:content) { { en: 'Hello world <a href="http://www.github.com" target="_blank">Very nice link</a><br><a href="http://www.example.org" target="_blank">Another link</a>' } }
let!(:static_page) { create(:static_page, organization:, show_in_footer: true, allow_public_access: true, content:) }
let!(:static_page) { create(:static_page, :with_topic, organization:, allow_public_access: true, content:) }

before do
switch_to_host(organization.host)
visit decidim.root_path
click_on static_page.title["en"]
click_on static_page.topic.title["en"]
end

after do
Expand Down
Loading

0 comments on commit 691dfe3

Please sign in to comment.