Skip to content

Commit

Permalink
Merge branch 'release/0.28-stable' of github.com:AjuntamentdeBarcelon…
Browse files Browse the repository at this point in the history
…a/decidim into release/0.28-stable-bcn
  • Loading branch information
fblupi committed Oct 22, 2024
2 parents 9c78c1c + d85a296 commit 6e50c98
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def create
BlockUser.call(@form) do
on(:ok) do
flash[:notice] = I18n.t("officializations.block.success", scope: "decidim.admin")
redirect_to moderated_users_path(blocked: true), notice:
redirect_to moderated_users_path, notice:
end

on(:invalid) do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<% end %>
<% if allowed_to?(:block, :moderate_users) %>
<% if moderation.user.blocked? %>
<%= icon_link_to "forbid-2-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %>
<%= icon_link_to "refresh-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %>
<% else %>
<%= icon_link_to "forbid-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %>
<%= icon_link_to "lock-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %>
<% end %>
<% end %>
</td>
Expand Down
1 change: 1 addition & 0 deletions decidim-admin/lib/decidim/admin/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Engine < ::Rails::Engine
end

initializer "decidim_admin.register_icons" do |_app|
Decidim.icons.register(name: "lock-2-line", icon: "lock-2-line", category: "system", description: "Block user icon", engine: :admin)
Decidim.icons.register(name: "layout-masonry-line", icon: "layout-masonry-line", category: "system", description: "", engine: :admin)
Decidim.icons.register(name: "service-line", icon: "service-line", category: "system", description: "", engine: :admin)
Decidim.icons.register(name: "fullscreen-line", icon: "fullscreen-line", category: "system", description: "", engine: :admin)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ module Admin

expect(flash[:notice]).to be_present
expect(user.reload.blocked?).to be(true)
expect(response).not_to redirect_to(moderated_users_path(blocked: true))
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class AssemblyLandingPageContentBlocksController < Decidim::Assemblies::Admin::A

layout "decidim/admin/assemblies"

helper_method :parent_assembly

private

def content_block_scope
Expand All @@ -29,6 +31,10 @@ def edit_resource_landing_page_path
def resource_landing_page_content_block_path
assembly_landing_page_content_block_path(scoped_resource, params[:id])
end

def parent_assembly
scoped_resource.parent
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: true

require "spec_helper"

describe "Admin manages assembly landing page" do
include_context "when admin administrating an assembly"
let!(:resource) { assembly }
let(:scope_name) { :assembly_homepage }
let(:edit_landing_page_path) { decidim_admin_assemblies.edit_assembly_landing_page_path(resource) }

def edit_content_block_path(resource, content_block)
decidim_admin_assemblies.edit_assembly_landing_page_content_block_path(resource, content_block)
end

before do
switch_to_host(organization.host)
login_as user, scope: :user
end

context "when editing related assemblies" do
let!(:related_assemblies_content_block) { create(:content_block, organization:, scope_name: "assembly_homepage", manifest_name: "related_assemblies", scoped_resource_id: resource.id, settings: { "max_results" => "6" }) }

it "updates the related assemblies content block" do
visit edit_content_block_path(resource, related_assemblies_content_block)

expect(related_assemblies_content_block.settings["max_results"]).to eq(6)
select 12, from: :content_block_settings_max_results
click_on "Update"

expect(page).to have_content("Related assemblies")
expect(related_assemblies_content_block.reload.settings["max_results"]).to eq(12)
end
end
end
6 changes: 3 additions & 3 deletions decidim-core/app/cells/decidim/translation_bar/show.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="wrapper-mini translation-bar">
<div class="row column">
<div>
<div class="pt-4 pb-4 text-center bg-background">
<%= link %>
<span class="translation-button-help"><%= help_text %></span>
<span class="translation-button-help ml-4"><%= help_text %></span>
</div>
</div>
2 changes: 1 addition & 1 deletion decidim-core/app/cells/decidim/translation_bar_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def link
parsed_url.query = new_query
url = parsed_url.to_s

link_to button_text, url, class: "button small hollow"
link_to button_text, url, class: "button button__sm button__transparent-secondary"
end

def button_text
Expand Down
5 changes: 5 additions & 0 deletions decidim-meetings/app/cells/decidim/meetings/meeting_l_cell.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def extra_class
"card__calendar-list__reset"
end

# Renders the date in the meeting card list
def has_image?
true
end

def image
render
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}

&-container {
@apply grid grid-cols-[auto_1fr] md:grid-cols-[auto_1fr_1fr] items-center gap-0 md:gap-x-5 border-4 border-background rounded md:h-[140px] overflow-hidden;
@apply grid grid-cols-[auto_1fr] md:grid-cols-[auto_1fr_1fr] items-center gap-0 md:gap-x-5 border-4 border-background rounded overflow-hidden;

> *:nth-child(2) {
@apply p-4 md:p-0;
Expand All @@ -28,7 +28,7 @@
}

> *:nth-child(3) {
@apply order-1 md:order-2 h-[135px] md:h-full;
@apply order-1 md:order-2 h-[135px];
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# frozen_string_literal: true

require "spec_helper"

module Decidim::Meetings
describe MeetingLCell, type: :cell do
controller Decidim::Meetings::MeetingsController
include Decidim::SanitizeHelper

subject { my_cell.call }

let!(:meeting) { create(:meeting, :published, start_time: Time.new(2020, 10, 15, 10, 4, 5, 0)) }
let(:my_cell) { cell("decidim/meetings/meeting_l", meeting) }

context "when rendering" do
it "renders the card" do
expect(subject).to have_css("#meetings__meeting_#{meeting.id}.card__calendar-list__reset")
end

it "shows the start time's month" do
expect(subject).to have_css(".card__calendar-month", text: "Oct")
end

it "shows the start time's day" do
expect(subject).to have_css(".card__calendar-day", text: "15")
end

it "shows the start time's year" do
expect(subject).to have_css(".card__calendar-year", text: "2020")
end
end

context "when title contains special html entities" do
let!(:original_title) { meeting.title["en"] }

before do
meeting.update!(title: { en: "<strong>#{original_title}</strong> &'<" })
meeting.reload
end

it "escapes them correctly" do
title = decidim_html_escape(original_title).gsub("&quot;", '"')
expect(subject.to_s).to include("&lt;strong&gt;#{title}&lt;/strong&gt; &amp;'&lt;")
end
end
end
end
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dependencies": {
"@picmo/popup-picker": "^5.8.4",
"@rails/activestorage": "^6.0.4",
"@tarekraafat/autocomplete.js": "^10.2.6",
"@tarekraafat/autocomplete.js": "10.2.7",
"@tiptap/core": "2.1.13",
"@tiptap/extension-blockquote": "2.1.13",
"@tiptap/extension-bold": "2.1.13",
Expand Down

0 comments on commit 6e50c98

Please sign in to comment.