Skip to content

Commit

Permalink
Fix overrides spec and lint erb files
Browse files Browse the repository at this point in the history
  • Loading branch information
fblupi committed Sep 11, 2024
1 parent 0bfa396 commit b372a37
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 68 deletions.
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -945,6 +945,7 @@ GEM
PLATFORMS
aarch64-linux
arm64-darwin-21
arm64-darwin-23
x86_64-linux

DEPENDENCIES
Expand Down
2 changes: 1 addition & 1 deletion app/cells/decidim/accountability/status/status.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if options[:show_category_image] %>
<%= image_pack_tag("media/images/category-#{model.id}.jpg") %>
<%= image_pack_tag("media/images/category-#{model.id}.jpg") %>
<% end %>

<p class="accountability__status-title"><%= title %></p>
Expand Down

This file was deleted.

4 changes: 3 additions & 1 deletion app/helpers/concerns/decidim/paginate_helper_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ module PaginateHelperOverride
def decidim_paginate(collection, paginate_params = {})
return if collection.total_pages <= 1

per_page = (params[:per_page] || paginate_params[:per_page] || Decidim::Paginable::OPTIONS.first).to_i

content_tag :div, class: "flex flex-col-reverse md:flex-row items-center justify-between gap-1 py-8 md:py-16", data: { pagination: "" } do
template = ""
if collection.total_pages.positive? && !paginate_params.delete(:hide_results_per_page_selector)
template += render partial: "decidim/shared/results_per_page", formats: ["html"]
template += render partial: "decidim/shared/results_per_page", locals: { per_page: }, formats: [:html]
end
template += paginate collection, window: 2, outer_window: 1, theme: "decidim", params: paginate_params
template.html_safe
Expand Down
22 changes: 15 additions & 7 deletions app/views/decidim/accountability/admin/results/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,22 @@
<%= export_dropdowns(query) %>
<%= import_dropdown do %>
<li class="imports--component imports--results">
<%= link_to t("actions.import", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")), new_projects_import_path if allowed_to?(:create, :result) && parent_result.nil? %>
</li>
<li class="imports--component imports--results">
<%= link_to t("actions.import_csv", scope: "decidim.accountability"), import_results_path if allowed_to? :create, :result %>
</li>
<% if allowed_to?(:create, :result) && parent_result.nil? %>
<%= link_to new_projects_import_path do %>
<li class="imports--component imports--results">
<%= t("actions.import", scope: "decidim.accountability", name: t("models.result.name", scope: "decidim.accountability.admin")) %>
</li>
<% end %>
<% end %>
<% if allowed_to? :create, :result %>
<%= link_to import_results_path do %>
<li class="imports--component imports--results">
<%= t("actions.import_csv", scope: "decidim.accountability") %>
</li>
<% end %>
<% end %>
<% end %>
<%= link_to t("decidim.accountability.admin.shared.subnav.import_csv"), Rails.application.routes.url_helpers.import_results_path(current_participatory_space, current_component), class: 'button button__sm button__secondary' %>
<%= link_to t("decidim.accountability.admin.shared.subnav.import_csv"), Rails.application.routes.url_helpers.import_results_path(current_participatory_space, current_component), class: "button button__sm button__secondary" %>
<%= render partial: "decidim/accountability/admin/shared/subnav" unless parent_result %>
<%= link_to t("actions.new_result", scope: "decidim.accountability"), new_result_path(parent_id: parent_result), class: "button button__sm button__secondary" if allowed_to? :create, :result %>
<%= render partial: "decidim/admin/components/resource_action" %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,3 @@
<% end %>
</table>
<% end %>


Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</span>
<% end %>

<div class="accountability<%= '_without_children' unless children %>__grid">
<div class="accountability<%= "_without_children" unless children %>__grid">
<% first_class_categories.each do |category| %>
<% category_results_count = count_calculator(current_scope, category) %>
<% next if category_results_count == 0 %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div class="categories section pb-8">
<div class="accountability_without_children__grid">
<% current_participatory_space.subscopes.order(Arel.sql("code::INTEGER ASC")).each do |scope| %>
<% scope_results_count = count_calculator(scope.id, 'all') %>
<% progress = progress_calculator(scope.id, 'all') %>
<% scope_results_count = count_calculator(scope.id, "all") %>
<% progress = progress_calculator(scope.id, "all") %>
<div>
<%= link_to results_path(filter: { with_scope: scope.id }), class: "accountability__status accountability__status__background" do %>
<%= image_pack_tag("media/images/districte-#{scope.id}.jpg") %>
<%= image_pack_tag("media/images/districte-#{scope.id}.jpg") %>
<p class="accountability__status-title"><%= translated_attribute(scope.name) %></p>
<div class="accountability__status-progress">
<div style="width:<%= progress %>%"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<div class="form__wrapper">
<%= f.text_field :document_number, required: true %>
<div class="help-text" style="margin-top: -2rem;"><%= t('.document_hint') %></div>
<div class="help-text" style="margin-top: -2rem;"><%= t(".document_hint") %></div>
</div>

<div class="form__wrapper">
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/mailer.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>
/* Email styles need to be inline */
</style>
Expand Down
16 changes: 8 additions & 8 deletions app/views/static/_accountability_graph_ca.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
<tspan x="24.863" y="170"><%= t("static.accountability.flow_text_4_1") %> </tspan> <tspan x="6.315" y="191"><%= t("static.accountability.flow_text_4_2") %> </tspan> <tspan x="33.322" y="212"><%= t("static.accountability.flow_text_4_3") %></tspan>
</text>
<g transform="translate(549 54)">
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.11764706L125.5 1.11764706M125.5 1.67647059L125.5 50.8529412" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="125 57 119 43.588 131 43.588"/>
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.11764706L125.5 1.11764706M125.5 1.67647059L125.5 50.8529412" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="125 57 119 43.588 131 43.588" />
</g>
<g transform="translate(144 50)">
<path stroke="#5A9AA6" stroke-width="3" d="M2.46400518 5.98863636L127.5 5.98863636M1.5 5.97703724L1.5 59.4431818" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="128 13.227 122 -.136 134 -.136" transform="rotate(-90 128 6.545)"/>
<path stroke="#5A9AA6" stroke-width="3" d="M2.46400518 5.98863636L127.5 5.98863636M1.5 5.97703724L1.5 59.4431818" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="128 13.227 122 -.136 134 -.136" transform="rotate(-90 128 6.545)" />
</g>
<g transform="rotate(90 222.25 452.75)">
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L79.5 1.5M79.5 2.5L79.5 98.5" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="79.5 109 73.5 97 85.5 97"/>
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L79.5 1.5M79.5 2.5L79.5 98.5" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="79.5 109 73.5 97 85.5 97" />
</g>
<g transform="rotate(-180 136 155.75)">
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L125.504 1.5M126.5 1.5L126.5 75.5067564" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="126 82 120 70 132 70"/>
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L125.504 1.5M126.5 1.5L126.5 75.5067564" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="126 82 120 70 132 70" />
</g>
</g>
</svg>
16 changes: 8 additions & 8 deletions app/views/static/_accountability_graph_es.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@
<tspan x="14.143" y="170"><%= t("static.accountability.flow_text_4_1") %> </tspan> <tspan x="38.127" y="191"><%= t("static.accountability.flow_text_4_2") %> </tspan> <tspan x="10.55" y="212"><%= t("static.accountability.flow_text_4_3") %></tspan>
</text>
<g transform="translate(549 54)">
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.11764706L125.5 1.11764706M125.5 1.67647059L125.5 50.8529412" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="125 57 119 43.588 131 43.588"/>
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.11764706L125.5 1.11764706M125.5 1.67647059L125.5 50.8529412" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="125 57 119 43.588 131 43.588" />
</g>
<g transform="translate(144 50)">
<path stroke="#5A9AA6" stroke-width="3" d="M2.46400518 5.98863636L127.5 5.98863636M1.5 5.97703724L1.5 59.4431818" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="128 13.227 122 -.136 134 -.136" transform="rotate(-90 128 6.545)"/>
<path stroke="#5A9AA6" stroke-width="3" d="M2.46400518 5.98863636L127.5 5.98863636M1.5 5.97703724L1.5 59.4431818" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="128 13.227 122 -.136 134 -.136" transform="rotate(-90 128 6.545)" />
</g>
<g transform="rotate(90 222.25 452.75)">
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L79.5 1.5M79.5 2.5L79.5 98.5" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="79.5 109 73.5 97 85.5 97"/>
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L79.5 1.5M79.5 2.5L79.5 98.5" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="79.5 109 73.5 97 85.5 97" />
</g>
<g transform="rotate(-180 136 155.75)">
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L125.504 1.5M126.5 1.5L126.5 75.5067564" stroke-linecap="square"/>
<polygon fill="#5A9AA6" points="126 82 120 70 132 70"/>
<path stroke="#5A9AA6" stroke-width="3" d="M.5 1.5L125.504 1.5M126.5 1.5L126.5 75.5067564" stroke-linecap="square" />
<polygon fill="#5A9AA6" points="126 82 120 70 132 70" />
</g>
</g>
</svg>
6 changes: 3 additions & 3 deletions app/views/static/accountability.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<div class="card__grid-grid pt-6">
<div class="card__grid">
<div class="card__grid-img">
<%= image_pack_tag 'media/images/canals.jpg' %>
<%= image_pack_tag "media/images/canals.jpg" %>
</div>
<div class="card__grid-text">
<a style="text-decoration: none;" href="<%= t(".citizens_card_1_link") %>">
Expand All @@ -94,7 +94,7 @@
</div>
<div class="card__grid">
<div class="card__grid-img">
<%= image_pack_tag 'media/images/logo_decidim.png' %>
<%= image_pack_tag "media/images/logo_decidim.png" %>
</div>
<div class="card__grid-text">
<a style="text-decoration: none;" href="<%= t(".citizens_card_2_link") %>">
Expand All @@ -105,7 +105,7 @@
</div>
<div class="card__grid">
<div class="card__grid-img">
<%= image_pack_tag 'media/images/trobades.jpg' %>
<%= image_pack_tag "media/images/trobades.jpg" %>
</div>
<div class="card__grid-text">
<a style="text-decoration: none;" href="<%= t(".citizens_card_3_link") %>">
Expand Down
1 change: 0 additions & 1 deletion config/initializers/decidim_overrides.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
Decidim::Forms::QuestionnaireUserAnswers.include(Decidim::Forms::QuestionnaireUserAnswersOverride)
Decidim::Proposals::ApplicationHelper.include(Decidim::Proposals::ApplicationHelperOverride)
Decidim::Assemblies::AssembliesController.include(Decidim::Assemblies::AssembliesControllerOverride)
Decidim::Admin::ConflictsController.include(Decidim::Admin::ConflictsControllerOverride)
end
16 changes: 8 additions & 8 deletions spec/lib/overrides_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
{
package: "decidim-core",
files: {
"/app/helpers/decidim/paginate_helper.rb" => "2cfcf887ca0896b329cda980095971a1",
"/app/controllers/decidim/application_controller.rb" => "3fa179cac8605b5bf472ea276d3f788a", # ephemeral participation overrides
"/app/controllers/concerns/decidim/paginable.rb" => "eb847be701a1a05e9070c99e210741a5", # update per_page method in assemblies_controller_override.rb
"/app/helpers/decidim/paginate_helper.rb" => "6fd69359386319d678c7a17cf64de4d9",
"/app/controllers/decidim/application_controller.rb" => "e86fe37834b061828536f9417fe56cd1", # ephemeral participation overrides
"/app/controllers/concerns/decidim/paginable.rb" => "a42381a0883c92df189ac61cebea3047", # update per_page method in assemblies_controller_override.rb
"/app/helpers/decidim/decidim_form_helper.rb" => "c534a1faa8da83aab5b2190f9d7534c3", # ephemeral participation overrides
"/app/models/decidim/component.rb" => "7fdd302396760cdccd5fab8adc6a0976", # ephemeral participation overrides
"/app/models/decidim/component.rb" => "ec2a03817027336392f1e9e0893309ab", # ephemeral participation overrides
"/app/models/decidim/organization.rb" => "04eaf4467a1e0d891251c5cedf71f5e4", # ephemeral participation overrides
"/app/models/decidim/permission_action.rb" => "3ad166f375e32d3cbb19fd6ca97fa659", # ephemeral participation overrides
"/app/models/decidim/user.rb" => "81da9f2f82f6336a92b948d827bd0fb3", # ephemeral participation overrides
"/app/models/decidim/user.rb" => "288624d037fa5f38bd6c00a785bf5a58", # ephemeral participation overrides
"/app/packs/stylesheets/decidim/legacy/email.scss" => "be1d2c978a80cca492954666677cd4bd",
"/app/permissions/decidim/permissions.rb" => "36a9c31bbf17685e80acff49f6e9b0ca", # ephemeral participation overrides
"/app/views/decidim/shared/_login_modal.html.erb" => "a29d4fcebe8c689044e3c15f6144f3d1", # ephemeral participation overrides
Expand All @@ -40,7 +40,7 @@
files: {
"/app/commands/decidim/admin/publish_component.rb" => "48b73691b2aea10191ed427702a74359", # revert https://github.com/decidim/decidim/pull/10690
"/app/commands/decidim/admin/transfer_user.rb" => "7cf11abc98c3a0c4a656ab96c220dd6a", # ephemeral participation overrides
"/app/controllers/decidim/admin/conflicts_controller.rb" => "12574de367c1bf989cfaad43d1ced6d9", # ephemeral participation overrides and ignore deleted users on index
"/app/controllers/decidim/admin/conflicts_controller.rb" => "98cda49632d3e1ec6ab8d509ad1c2e93", # ephemeral participation overrides and ignore deleted users on index
"/app/forms/decidim/admin/component_form.rb" => "0455dd26580817470fd7096ef6b08315", # ephemeral participation overrides
"/app/forms/decidim/admin/permissions_form.rb" => "f68d00a490e84524ce3aebe6f71d829a" # ephemeral participation overrides
}
Expand Down Expand Up @@ -72,7 +72,7 @@
package: "decidim-accountability",
files: {
"/app/views/decidim/accountability/admin/results/_form.html.erb" => "980e3f623300704e209f860e1859b507",
"/app/views/decidim/accountability/admin/results/index.html.erb" => "633d8dd325d917ba4cfd8500052a3dcf",
"/app/views/decidim/accountability/admin/results/index.html.erb" => "aefffeaa8594ba9072e28eeabffc5845",
"/app/views/decidim/participatory_spaces/_result.html.erb" => "36add6a46776f600922fa04099a20909",
"/app/cells/decidim/accountability/result_l/extra_data.erb" => "58368fec1e36bff35cc3ea24c2109076",
"/app/cells/decidim/accountability/status_cell.rb" => "6ca4eca3af487284dcb6caae19200596",
Expand Down Expand Up @@ -133,7 +133,7 @@
}
]

describe "Overriden files", type: :view do
describe "Overridden files", type: :view do
checksums.each do |item|
spec = Gem::Specification.find_by_name(item[:package])

Expand Down
8 changes: 4 additions & 4 deletions spec/system/assemblies_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
end

context "when there are some published assemblies" do
let(:number_of_assemblies) { 25 }
let(:number_of_assemblies) { 30 }
let!(:assemblies) { create_list(:assembly, number_of_assemblies, organization:) }

context "and requesting the assemblies path" do
before do
visit decidim_assemblies.assemblies_path
end

it "lists 20 assemblies per page" do
it "lists 25 assemblies per page" do
within "#assemblies-grid" do
expect(page).to have_content("Results per page:\n20")
expect(page).to have_css("[id^=assembly_]", count: 20)
expect(page).to have_content("Results per page:\n25")
expect(page).to have_css("[id^=assembly_]", count: 25)
end
end
end
Expand Down

0 comments on commit b372a37

Please sign in to comment.