Skip to content

Commit

Permalink
Merge branch 'develop' into feature/sticky_header
Browse files Browse the repository at this point in the history
  • Loading branch information
ElviaBth committed May 29, 2024
2 parents 3cf1b0a + d6f6b92 commit d931c58
Show file tree
Hide file tree
Showing 227 changed files with 1,262 additions and 578 deletions.
64 changes: 44 additions & 20 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ rbenv local 3.2.2

If not, you need to adapt it to your environment. See "2.1. Ruby update to 3.2"

### 2.1. Update your Gemfile
### 1.2. Update your Gemfile

```ruby
gem "decidim", github: "decidim/decidim"
gem "decidim-dev", github: "decidim/decidim"
```

### 2.2. Run these commands
### 1.3. Run these commands

```console
bundle update decidim
bin/rails decidim:upgrade
bin/rails db:migrate
```

### 2.3. Follow the steps and commands detailed in these notes
### 1.4. Follow the steps and commands detailed in these notes

## 2. General notes

Expand All @@ -47,6 +47,12 @@ We have updated the Rails version to 7.0.8.1. You do not need to do anything.

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

## 2.3. Removal of the accountability naming customization

We have removed the ability to customize the labels from the Accountability component, as it was not following the recommended way of handling these text customizations. If you want to migrate your current customizations, you can read about [Text customizations in Decidim Documentation](https://docs.decidim.org/en/develop/customize/texts)

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

## 3. One time actions

These are one time actions that need to be done after the code is updated in the production database.
Expand Down Expand Up @@ -181,7 +187,41 @@ You can read more about this change on PR [\#XXXX](https://github.com/decidim/de

## 5. Changes in APIs

### 5.1. [[TITLE OF THE CHANGE]]
### 5.1 Migration of Proposal states in own table

As of [\#12052](https://github.com/decidim/decidim/pull/12052) all the proposals states are kept in a separate database table, enabling end users to customize the states of the proposals. By default we will create for any proposal component that is being installed in the project 5 default states that cannot be disabled nor deleted. These states are:

- Not Answered ( default state for any new created proposal )
- Evaluating
- Accepted
- Rejected
- Withdrawn ( special states for proposals that have been withdrawn by the author )

For any of the above states you can customize the name, description, css class used by labels. You can also decide which states the user can receive a notification or an answer.

You do not need to run any task to migrate the existing states, as we will automatically migrate the existing states to the new table.

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

### 5.2. Seeds require assets precompiling

In order to successfully showcase the features of the application, we have added as a mandatory step the assets precompiling, as the seeds will now fire the notification system. That allows any Decidim demo instance to display user notifications.

if you previously seeded your database using:

```bash
bin/rails db:drop db:create db:migrate db:seed
```

You are required to run using:

```bash
bin/rails db:drop db:create db:migrate assets:precompile db:seed
```

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

### 5.3. [[TITLE OF THE CHANGE]]

In order to [[REASONING (e.g. improve the maintenance of the code base)]] we have changed...

Expand All @@ -198,19 +238,3 @@ You need to change it to:
# Explain the usage of the API as it is in the new version
result = 1 + 1 if after
```

### 5.8 Migration of Proposal states in own table

As of [\#12052](https://github.com/decidim/decidim/pull/12052) all the proposals states are kept in a separate database table, enabling end users to customize the states of the proposals. By default we will create for any proposal component that is being installed in the project 5 default states that cannot be disabled nor deleted. These states are:

- Not Answered ( default state for any new created proposal )
- Evaluating
- Accepted
- Rejected
- Withdrawn ( special states for proposals that have been withdrawn by the author )

For any of the above states you can customize the name, description, css class used by labels. You can also decide which states the user can receive a notification or an answer.

You do not need to run any task to migrate the existing states, as we will automatically migrate the existing states to the new table.

You can see more details about this change on PR [\#12052](https://github.com/decidim/decidim/pull/12052)
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,7 @@ def display_count(count)
end

def heading_parent_level_results(count)
text = translated_attribute(component_settings.heading_parent_level_results).presence
if text
pluralize(count, text)
else
t("results.count.results_count", scope: "decidim.accountability", count:)
end
t("results.count.results_count", scope: "decidim.accountability", count:)
end

def render_count
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ def proposal_path
def proposal
@proposal ||= resource.linked_resources(:proposals, "included_proposals").find_by(id: extra[:proposal_id])
end

def hidden_resource?
super || (proposal.respond_to?(:hidden?) && proposal.hidden?)
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ def component_name
(defined?(current_component) && translated_attribute(current_component&.name).presence) || t("decidim.components.accountability.name")
end

def categories_label
translated_attribute(component_settings.categories_label).presence || t("results.home.categories_label", scope: "decidim.accountability")
end

def subcategories_label
translated_attribute(component_settings.subcategories_label).presence || t("results.home.subcategories_label", scope: "decidim.accountability")
end

def filter_items_for(participatory_space:, category:)
[
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
) %>

<div>
<span class="accountability__grid-title"><%= categories_label %></span>
<span class="accountability__grid-title"><%= t("results.home.categories_label", scope: "decidim.accountability") %></span>
<%= subelements.call %>
</div>

<div>
<span class="accountability__grid-title"><%= subcategories_label %></span>
<span class="accountability__grid-title"><%= t("results.home.subcategories_label", scope: "decidim.accountability") %></span>
<% if subelements.has_results? %>
<div class="accountability__subgrid">
<% category.subcategories.each do |subcategory| %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<% if current_component.has_subscopes? %>
<div class="filter-container">
<button id="dropdown-trigger-accountability" data-component="dropdown" data-target="dropdown-menu-accountability" data-auto-close="true" data-disabled-md="true">
<button id="dropdown-trigger-accountability" data-component="dropdown" data-target="dropdown-menu-accountability" data-auto-close="true">
<% items.each do |item| %>
<%= content_tag :span, class: "#{"is-active" if item[:active]}" do %>
<span class="sr-only"><%= item[:sr_text] %></span>
Expand All @@ -15,7 +15,7 @@
<%= icon "arrow-down-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
<%= icon "arrow-up-s-line", class: "w-8 h-8 flex-none text-secondary fill-current" %>
</button>
<ul id="dropdown-menu-accountability" data-scope-filters>
<ul id="dropdown-menu-accountability" data-scope-filters aria-hidden="true">
<% items.each do |item| %>
<li>
<%= link_to item[:url], class: "filter#{" is-active" if item[:active]}" do %>
Expand Down
4 changes: 0 additions & 4 deletions decidim-accountability/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,12 @@ en:
name: Accountability
settings:
global:
categories_label: Name for "Categories"
comments_enabled: Comments enabled
comments_max_length: Comments max length (Leave 0 for default value)
display_progress_enabled: Display progress
heading_leaf_level_results: Name for "Projects"
heading_parent_level_results: Name for "Results"
intro: Intro
scope_id: Scope
scopes_enabled: Scopes enabled
subcategories_label: Name for "Subcategories"
step:
comments_blocked: Comments blocked
events:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
settings.attribute :comments_enabled, type: :boolean, default: true
settings.attribute :comments_max_length, type: :integer, required: true
settings.attribute :intro, type: :text, translated: true, editor: true
settings.attribute :categories_label, type: :string, translated: true, editor: true
settings.attribute :subcategories_label, type: :string, translated: true, editor: true
settings.attribute :heading_parent_level_results, type: :string, translated: true, editor: true
settings.attribute :heading_leaf_level_results, type: :string, translated: true, editor: true
settings.attribute :display_progress_enabled, type: :boolean, default: true
end

Expand Down
4 changes: 0 additions & 4 deletions decidim-accountability/lib/decidim/accountability/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ def call
participatory_space:,
settings: {
intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { Decidim::Faker::Localized.sentence(word_count: 4) },
categories_label: Decidim::Faker::Localized.word,
subcategories_label: Decidim::Faker::Localized.word,
heading_parent_level_results: Decidim::Faker::Localized.word,
heading_leaf_level_results: Decidim::Faker::Localized.word,
scopes_enabled: true,
scope_id: participatory_space.scope&.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
settings do
{
intro: generate_localized_description(:accountability_component_intro, skip_injection:),
categories_label: generate_localized_word(:accountability_component_categories_label, skip_injection:),
subcategories_label: generate_localized_word(:accountability_component_subcategories_label, skip_injection:),
heading_parent_level_results: generate_localized_word(:accountability_component_heading_parent_level_results, skip_injection:),
heading_leaf_level_results: generate_localized_word(:accountability_component_heading_leaf_level_results, skip_injection:),
scopes_enabled: true,
scope_id: participatory_space.scope&.id
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,22 @@
expect(subject.resource_text).to eq translated(resource.description)
end
end

describe "hidden_resource?" do
context "when resource is not moderated" do
let(:resource) { create(:proposal) }

it "returns false" do
expect(subject.hidden_resource?).to be false
end
end

context "when resource is moderated" do
let(:resource) { create(:proposal, :moderated) }

it "returns true" do
expect(subject.hidden_resource?).to be true
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,22 @@
expect(subject.resource_text).to eq translated(resource.description)
end
end

describe "hidden_resource?" do
context "when resource is not moderated" do
let(:resource) { create(:proposal) }

it "returns false" do
expect(subject.hidden_resource?).to be false
end
end

context "when resource is moderated" do
let(:resource) { create(:proposal, :moderated) }

it "returns true" do
expect(subject.hidden_resource?).to be true
end
end
end
end
4 changes: 2 additions & 2 deletions decidim-admin/app/forms/decidim/admin/organization_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class OrganizationForm < Form

mimic :organization

attribute :name, String
translatable_attribute :name, String
attribute :reference_prefix, String
attribute :time_zone, String
attribute :twitter_handler, String
Expand All @@ -37,7 +37,7 @@ class OrganizationForm < Form

validates :welcome_notification_subject, :welcome_notification_body, translatable_presence: true, if: proc { |form| form.customize_welcome_notification }

validates :name, presence: true
validates :name, translatable_presence: true
validates :time_zone, presence: true
validates :time_zone, time_zone: true
validates :default_locale, :reference_prefix, presence: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def reportable_author_name(reportable)
decidim_sanitize_translated(author.title)
end
end
when Decidim::Organization
content_tag :li, organization_name(author)
else
content_tag(:li, author.name)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="item_show__header">
<h1 class="item_show__header-title">
<%= t "decidim.admin.titles.dashboard" %> <%= current_organization.name %>
<%= t "decidim.admin.titles.dashboard" %> <%= current_organization_name %>
</h1>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="card-section">
<div class="row column">
<div class="columns">
<%= form.text_field :name %>
<%= form.translated :text_field, :name %>
</div>

<div class="columns">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% add_decidim_page_title(t("titles.panel", scope: "decidim.admin")) %>
<% add_decidim_page_title(current_organization.name) %>
<% add_decidim_page_title(current_organization_name) %>
<!doctype html>
<html class="no-js" lang="<%= I18n.locale %>" dir="<%= rtl_direction %>">
<head>
Expand All @@ -21,9 +21,9 @@
</div>
<div class="relative md:flex grow min-h-max w-full">
<div class="layout-nav">
<%= link_to decidim_admin.root_path, class: "logo hidden md:block", data: { "external-link": false }, aria: { label: t("decidim.accessibility.logo", organization: current_organization.name) } do %>
<%= link_to decidim_admin.root_path, class: "logo hidden md:block", data: { "external-link": false }, aria: { label: t("decidim.accessibility.logo", organization: current_organization_name) } do %>
<% if current_organization.logo.present? %>
<%= image_tag current_organization.attached_uploader(:logo).path, alt: current_organization.name %>
<%= image_tag current_organization.attached_uploader(:logo).path, alt: current_organization_name %>
<% else %>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 134 109">
<g fill="#fff">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
<div class="hidden md:block">
<%= sidebar_menu(secondary_root_menu).render %>
</div>
<button data-component="dropdown" data-target="dropdown-menu-sidebar" data-auto-close="true" data-disabled-md="true" data-scroll-to-menu="true">
<button data-component="dropdown" data-target="dropdown-menu-sidebar" data-auto-close="true" data-scroll-to-menu="true">
<span><%= t("menu", scope: "decidim.admin.titles") %></span>
<%= icon "arrow-down-s-line" %>
<%= icon "arrow-up-s-line" %>
</button>

<ul id="dropdown-menu-sidebar" class="md:hidden">
<ul id="dropdown-menu-sidebar" class="md:hidden" aria-hidden="true">
<%= sidebar_menu(secondary_root_menu).render %>
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="title-bar">
<div class="layout-content__container">
<span class="font-semibold text-sm">
<%= current_organization.name %>
<%= current_organization_name %>
</span>
<div class="tool-bar">
<%= link_to decidim.root_path, class: "button__site", target: "_blank", data: { "external-link": false } do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="layout-content__container">
<a href="#menu" class="menu-trigger"><%= icon "menu-line", class: "fill-black" %></a>
<span class="font-semibold text-sm">
<%= current_organization.name %>
<%= current_organization_name %>
</span>
<div class="tool-bar">
<%= link_to decidim.root_path, class: "button__site", target: "_blank", data: { "external-link": false } do %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Decidim::Admin
let(:params) do
{
organization: {
name: "My super organization",
name: { en: "My super organization" },
reference_prefix: "MSO",
time_zone: "Hawaii",
default_locale: "en",
Expand Down Expand Up @@ -48,7 +48,7 @@ module Decidim::Admin
command.call
organization.reload

expect(organization.name).not_to eq("My super organization")
expect(translated(organization.name)).not_to eq("My super organization")
end
end

Expand All @@ -74,7 +74,7 @@ module Decidim::Admin
expect { command.call }.to broadcast(:ok)
organization.reload

expect(organization.name).to eq("My super organization")
expect(translated(organization.name)).to eq("My super organization")
expect(organization.rich_text_editor_in_public_views).to be(true)
expect(organization.enable_machine_translations).to be(true)
end
Expand Down
Loading

0 comments on commit d931c58

Please sign in to comment.