Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:decidim/decidim into ale-add-spa…
Browse files Browse the repository at this point in the history
…m-detection
  • Loading branch information
alecslupu committed Mar 8, 2024
2 parents b71691c + 90556e2 commit ce04e00
Show file tree
Hide file tree
Showing 627 changed files with 4,457 additions and 21,554 deletions.
5 changes: 4 additions & 1 deletion .erb-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ linters:
- budget-list__item
- budget-list__item-cell
- budget-list__number
- budget-list__number-show-for-medium
- budget-list__text
- budget-list__title
- budget-progress--fixed
Expand Down Expand Up @@ -1585,9 +1586,10 @@ linters:
- show-8
- show-9
- show-comment-replies
- show-for-dark-mode
- show-for-ie
- show-for-dark-mode
- show-for-landscape
- show-for-large
- show-for-large-only
- show-for-medium
- show-for-medium-only
Expand Down Expand Up @@ -1892,6 +1894,7 @@ linters:
- timeline__phase
- timeline__phase__number
- timeline__title
- tiny
- title-action
- title-action__action
- title-action__title
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We have disabled the feature request's issue creation on this repository. If you

* [Feature Request](https://meta.decidim.org/processes/roadmap)

We are doing this because we are trying to eat our own dog food. Once your proposal is collaboratively reviewed and accepted by the Product Comitee, we will create the new issue on GitHub and notify you through Metadecidim.
We are doing this because we are trying to eat our own dog food. Once your proposal is collaboratively reviewed and accepted by the Product Committee, we will create the new issue on GitHub and notify you through Metadecidim.

Thanks for contributing to Decidim!

5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ PATH
mime-types (>= 1.16, < 4.0)
mini_magick (~> 4.9)
net-smtp (~> 0.3.1)
nokogiri (~> 1.16, >= 1.16.2)
omniauth (~> 2.0)
omniauth-facebook (~> 5.0)
omniauth-google-oauth2 (~> 1.0)
Expand Down Expand Up @@ -121,7 +122,7 @@ PATH
factory_bot_rails (~> 6.2)
faker (~> 3.2)
i18n-tasks (~> 1.0)
nokogiri (~> 1.14, >= 1.14.3)
nokogiri (~> 1.16, >= 1.16.2)
parallel_tests (~> 4.2)
puma (~> 6.2, >= 6.3.1)
rails-controller-testing (~> 1.0)
Expand Down Expand Up @@ -169,7 +170,7 @@ PATH
decidim-proposals (0.29.0.dev)
decidim-comments (= 0.29.0.dev)
decidim-core (= 0.29.0.dev)
doc2text (~> 0.4.6)
doc2text (~> 0.4.7)
redcarpet (~> 3.5, >= 3.5.1)
decidim-sortitions (0.29.0.dev)
decidim-admin (= 0.29.0.dev)
Expand Down
12 changes: 11 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,17 @@ In case you have modifications in your application's webpack configuration, adap

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

### 3.4. [[TITLE OF THE ACTION]]
### 3.4. Allow removal of orphan categories

A bug was identified that prevented the deletion of categories lacking associated resources. This action is a one-time task that must be performed directly in the production database.

```console
bin/rails decidim:upgrade:fix_orphan_categorizations
```

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

### 3.5. [[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 @@ -18,11 +18,11 @@ def show
private

def title
translated_attribute result.title
decidim_escape_translated result.title
end

def description
translated_attribute(result.description).html_safe
decidim_sanitize_admin translated_attribute(result.description)
end

def scope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def status_item_compact
return if status.blank?

{
text: translated_attribute(status.name),
text: decidim_escape_translated(status.name),
icon: "focus-2-line"
}
end
Expand Down Expand Up @@ -108,12 +108,12 @@ def status_item
{
text: t("models.result.fields.status", scope: "decidim.accountability"),
icon: "focus-2-line",
value: translated_attribute(status.name)
value: decidim_escape_translated(status.name)
}
end

def status_description
return unless status.present? && (description = translated_attribute(status.description)).present?
return unless status.present? && (description = decidim_escape_translated(status.description)).present?

{
text: t("models.status.fields.description", scope: "decidim.accountability"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def update_parent_progress
end

# Public: There are two ways to update parent's progress:
# - using weights, in which case each progress is multiplied by the weigth and them summed
# - using weights, in which case each progress is multiplied by the weight and them summed
# - not using weights, and using the average of progress of each children
def update_progress!
self.progress = if children_use_weighted_progress?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<tr data-id="<%= status.id %>">
<td><%= status.key %><br></td>
<td><%= translated_attribute(status.name) %></td>
<td><%= truncate translated_attribute(status.description), lenght: 50 %></td>
<td><%= truncate translated_attribute(status.description), length: 50 %></td>
<td><%= status.progress %></td>
<td class="table-list__actions">
<% if allowed_to? :update, :status, status: status %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<%= render layout: "layouts/decidim/shared/layout_two_col" do %>

<section class="layout-main__section">
<div class="editor-content"><%== translated_attribute component_settings.intro %></div>
<div class="editor-content"><%= decidim_sanitize_admin translated_attribute(component_settings.intro) %></div>
</section>

<section class="layout-main__section">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<%= render layout: "layouts/decidim/shared/layout_two_col" do %>
<section class="layout-main__section">
<h2 class="h4"><%= category.present? ? translated_attribute(category.name) : t("decidim.accountability.results.home_header.global_status") %></h2>
<h2 class="h4"><%= category.present? ? decidim_escape_translated(category.name) : t("decidim.accountability.results.home_header.global_status") %></h2>
</section>

<section id="results" class="layout-main__section">
Expand Down
46 changes: 29 additions & 17 deletions decidim-accountability/lib/decidim/accountability/test/factories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,44 +9,56 @@

FactoryBot.define do
factory :accountability_component, parent: :component do
name { Decidim::Components::Namer.new(participatory_space.organization.available_locales, :accountability).i18n_name }
transient do
skip_injection { false }
end
name { generate_component_name(participatory_space.organization.available_locales, :accountability, skip_injection:) }
manifest_name { :accountability }
participatory_space { create(:participatory_process, :with_steps, organization:) }
participatory_space { create(:participatory_process, :with_steps, organization:, skip_injection:) }
settings do
{
intro: Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title },
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,
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
}
end
end

factory :status, class: "Decidim::Accountability::Status" do
component { create(:accountability_component) }
transient do
skip_injection { false }
end
component { create(:accountability_component, skip_injection:) }
sequence(:key) { |n| "status_#{n}" }
name { Decidim::Faker::Localized.word }
description { generate_localized_title }
name { generate_localized_word(:status_name, skip_injection:) }
description { generate_localized_word(:status_description, skip_injection:) }
progress { rand(1..100) }
end

factory :result, class: "Decidim::Accountability::Result" do
component { create(:accountability_component) }
title { generate_localized_title }
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
transient do
skip_injection { false }
end
component { create(:accountability_component, skip_injection:) }
title { generate_localized_title(:result_title, skip_injection:) }
description { generate_localized_description(:result_description, skip_injection:) }
start_date { "12/7/2017" }
end_date { "30/9/2017" }
status { create :status, component: }
status { create :status, component:, skip_injection: }
progress { rand(1..100) }
end

factory :timeline_entry, class: "Decidim::Accountability::TimelineEntry" do
result { create(:result) }
transient do
skip_injection { false }
end
result { create(:result, skip_injection:) }
entry_date { "12/7/2017" }
title { generate_localized_title }
description { generate_localized_title }
title { generate_localized_title(:timeline_entry_title, skip_injection:) }
description { generate_localized_title(:timeline_entry_description, skip_injection:) }
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let(:proposal_component) do
create(:component, manifest_name: "proposals", participatory_space: resource.component.participatory_space)
end
let(:proposal) { create(:proposal, component: proposal_component, title: generate_localized_title(:proposal_title)) }
let(:proposal) { create(:proposal, component: proposal_component) }
let(:extra) { { proposal_id: proposal.id } }
let(:proposal_path) { resource_locator(proposal).path }
let(:proposal_title) { decidim_sanitize_translated(proposal.title) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let(:proposal_component) do
create(:component, manifest_name: "proposals", participatory_space: resource.component.participatory_space)
end
let(:proposal) { create(:proposal, component: proposal_component, title: generate_localized_title(:proposal_title)) }
let(:proposal) { create(:proposal, component: proposal_component) }
let(:extra) { { proposal_id: proposal.id, progress: 95 } }
let(:proposal_path) { resource_locator(proposal).path }
let(:proposal_title) { decidim_sanitize_translated(proposal.title) }
Expand Down
4 changes: 2 additions & 2 deletions decidim-accountability/spec/shared/export_results_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
shared_examples "export as CSV" do
it "exports a CSV" do
find("span.exports", text: export_type).click
perform_enqueued_jobs { click_link "Results as CSV" }
perform_enqueued_jobs { click_on "Results as CSV" }

expect(page).to have_admin_callout "Your export is currently in progress. You will receive an email when it is complete."
expect(last_email.subject).to include("results", "csv")
Expand All @@ -37,7 +37,7 @@
shared_examples "export as JSON" do
it "exports a JSON" do
find("span.exports", text: export_type).click
perform_enqueued_jobs { click_link "Results as JSON" }
perform_enqueued_jobs { click_on "Results as JSON" }

expect(page).to have_admin_callout "Your export is currently in progress. You will receive an email when it is complete."
expect(last_email.subject).to include("results", "json")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

before do
within "tr", text: translated(result.title) do
click_link "Folders"
click_on "Folders"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

before do
within "tr", text: translated(result.title) do
click_link "Attachments"
click_on "Attachments"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.shared_examples "manage child results" do
it "updates a result" do
within "tr", text: translated(child_result.title) do
click_link "Edit"
click_on "Edit"
end

within ".edit_result" do
Expand Down Expand Up @@ -38,7 +38,7 @@
end

it "creates a new child result" do
click_link "New result", match: :first
click_on "New result", match: :first

within ".new_result" do
fill_in_i18n(
Expand Down Expand Up @@ -74,13 +74,13 @@
before do
visit current_path
within ".table-list__actions" do
click_link "New result"
click_on "New result"
end
end

it "deletes a result" do
within "tr", text: translated(child_result.title) do
accept_confirm { click_link "Delete" }
accept_confirm { click_on "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
6 changes: 3 additions & 3 deletions decidim-accountability/spec/shared/manage_results_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

it "updates a result" do
within "tr", text: translated(result.title) do
click_link "Edit"
click_on "Edit"
end

within ".edit_result" do
Expand All @@ -59,7 +59,7 @@
end

it "creates a new result", :slow do
click_link "New result", match: :first
click_on "New result", match: :first

within ".new_result" do
fill_in_i18n(
Expand Down Expand Up @@ -114,7 +114,7 @@

it "deletes a result" do
within "tr", text: translated(result2.title) do
accept_confirm { click_link "Delete" }
accept_confirm { click_on "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
RSpec.shared_examples "manage statuses" do
it "updates a status" do
within "tr", text: status.key do
click_link "Edit"
click_on "Edit"
end

within ".edit_status" do
Expand All @@ -26,7 +26,7 @@
end

it "creates a new status" do
click_link "New status"
click_on "New status"

within ".new_status" do
fill_in :status_key, with: "status_key_1"
Expand Down Expand Up @@ -69,7 +69,7 @@

it "deletes a status" do
within "tr", text: status2.key do
accept_confirm { click_link "Delete" }
accept_confirm { click_on "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
describe "child results" do
before do
within ".table-list__actions" do
click_link "New result"
click_on "New result"
end
end

Expand All @@ -30,7 +30,7 @@

describe "statuses" do
before do
click_link "Statuses"
click_on "Statuses"
end

it_behaves_like "manage statuses"
Expand Down

0 comments on commit ce04e00

Please sign in to comment.