Skip to content

Commit

Permalink
Merge branch 'develop' into feature/redesign-admin
Browse files Browse the repository at this point in the history
* develop:
  Add recognition to BrowserStack in the README (#11546)
  Remove unused view hook for `:upcoming_meeting_for_card` (#11543)
  Remove unused dependency: `wicked` (#11150)
  Clean-up initiatives signature URLs and methods (#11545)
  Refactor initiative signing wizard (#10731)
  Fix Permissions screen on budgets throw errors (#11532)
  Redesign: read more literal (#11516)
  Fix 'download your data' when there are comments on budgets (#11531)
  • Loading branch information
entantoencuanto committed Aug 30, 2023
2 parents fd21f30 + 76260c2 commit 9524169
Show file tree
Hide file tree
Showing 29 changed files with 234 additions and 149 deletions.
3 changes: 0 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ PATH
decidim-core (= 0.28.0.dev)
decidim-verifications (= 0.28.0.dev)
hexapdf (~> 0.32.0)
wicked (~> 1.3)
wicked_pdf (~> 2.1)
wkhtmltopdf-binary (~> 0.12)
decidim-meetings (0.28.0.dev)
Expand Down Expand Up @@ -802,8 +801,6 @@ GEM
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
wicked (1.4.0)
railties (>= 3.0.7)
wicked_pdf (2.6.3)
activesupport
wisper (2.0.1)
Expand Down
6 changes: 6 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
:uri-blog: https://decidim.org/blog
:uri-browserstack: https://www.browserstack.com
:uri-chat: http://chat.decidim.org
:uri-contributing: xref:CONTRIBUTING.adoc
:uri-demo: https://try.decidim.org
Expand Down Expand Up @@ -72,6 +73,7 @@ All members of the Decidim community agree with {uri-social-contract}[Decidim So
** <<members,🧑 Members>>
** <<partners,💻 Partners>>
* <<learn-more,📖 Learn More>>
* <<credits,🎩 Credits>>

'''

Expand Down Expand Up @@ -202,3 +204,7 @@ image::https://opencollective.com/decidim/tiers/partner.svg?avatarHeight=36&widt
| How to contribute to the Decidim project and code base.

|===

== 🎩 Credits

* This project is tested with {uri-browserstack}[BrowserStack].
8 changes: 6 additions & 2 deletions decidim-budgets/app/models/decidim/budgets/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,16 @@ def self.log_presenter_class_for(_log)
Decidim::Budgets::AdminLog::ProjectPresenter
end

def resource_locator
::Decidim::ResourceLocatorPresenter.new([budget, self])
end

def polymorphic_resource_path(url_params)
::Decidim::ResourceLocatorPresenter.new([budget, self]).path(url_params)
resource_locator.path(url_params)
end

def polymorphic_resource_url(url_params)
::Decidim::ResourceLocatorPresenter.new([budget, self]).url(url_params)
resource_locator.url(url_params)
end

# Public: Overrides the `comments_have_votes?` Commentable concern method.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# frozen_string_literal: true

require "spec_helper"

describe "Admin manages project permissions", type: :system do
let(:manifest_name) { "budgets" }
let(:budget) { create(:budget, component: current_component) }
let!(:project) { create(:project, budget:) }

include_context "when managing a component as an admin"

before do
switch_to_host(organization.host)
login_as user, scope: :user
visit_component_admin
within find("tr", text: translated(budget.title)) do
page.find(".action-icon--edit-projects").click
end
within find("tr", text: translated(project.title)) do
page.find(".action-icon--permissions").click
end
end

it "Saves the permissions" do
expect(page).to have_content("Edit permissions")

within find("fieldset", text: "Vote") do
page.check("Example authorization (Direct)")
end
click_button "Submit"
expect(page).to have_content("Permissions updated successfully")
within find("tr", text: translated(budget.title)) do
page.find(".action-icon--edit-projects").click
end
within find("tr", text: translated(project.title)) do
expect(page).to have_css(".action-icon--highlighted")
page.find(".action-icon--permissions").click
end
within find("fieldset", text: "Vote") do
expect(page).to have_checked_field("Example authorization (Direct)")
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def serialize

def root_commentable_url
@root_commentable_url ||= if resource.root_commentable.respond_to?(:polymorphic_resource_url)
resource.root_commentable.polymorphic_resource_url
resource.root_commentable.polymorphic_resource_url({})
else
ResourceLocatorPresenter.new(resource.root_commentable).url
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def serialize

def root_commentable_url
@root_commentable_url ||= if resource.comment.root_commentable.respond_to?(:polymorphic_resource_url)
resource.comment.root_commentable.polymorphic_resource_url
resource.comment.root_commentable.polymorphic_resource_url({})
else
ResourceLocatorPresenter.new(resource.comment.root_commentable).url
end
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/app/cells/decidim/announcement/show.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</span>
<%= icon "arrow-down-s-line" %>
<span>
<%= t("close", scope: "layouts.decidim.announcements") %>
<%= t("view_less", scope: "layouts.decidim.announcements") %>
</span>
<%= icon "arrow-up-s-line" %>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</span>
<%= icon "arrow-down-s-line" %>
<span>
<%= t("close", scope: "layouts.decidim.announcements") %>
<%= t("view_less", scope: "layouts.decidim.announcements") %>
</span>
<%= icon "arrow-up-s-line" %>
</button>
Expand Down
2 changes: 2 additions & 0 deletions decidim-core/app/helpers/decidim/resource_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def linked_classes_filter_values_for(klass)

# Returns an instance of ResourceLocatorPresenter with the given resource
def resource_locator(resource)
return resource.resource_locator if resource.respond_to?(:resource_locator)

::Decidim::ResourceLocatorPresenter.new(resource)
end

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

.layout-1col {
@apply container grid grid-rows-[max-content] grid-cols-12 mb-12 md:mb-32 grow;
@apply container grid grid-rows-[max-content] grid-cols-12 auto-rows-max mb-12 md:mb-32 grow;

&.cols-6 > * {
@apply col-span-12 md:col-start-3 md:col-span-8 lg:col-start-4 lg:col-span-6 self-start;
Expand Down
2 changes: 1 addition & 1 deletion decidim-core/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ en:
layouts:
decidim:
announcements:
close: Close
view_less: Show less
view_more: More information
data_consent:
details:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -916,5 +916,29 @@
expect(page).to have_link "#decidim", href: "/search?term=%23decidim"
end
end

describe "export_serializer" do
let(:comment) { comments.first }

it "returns the serializer for the comment" do
expect(comment.class.export_serializer).to eq(Decidim::Comments::CommentSerializer)
end

context "with instance" do
subject { comment.class.export_serializer.new(comment).serialize }

it { is_expected.to have_key(:id) }
it { is_expected.to have_key(:created_at) }
it { is_expected.to have_key(:body) }
it { is_expected.to have_key(:locale) }
it { is_expected.to have_key(:author) }
it { is_expected.to have_key(:alignment) }
it { is_expected.to have_key(:depth) }
it { is_expected.to have_key(:user_group) }
it { is_expected.to have_key(:commentable_id) }
it { is_expected.to have_key(:commentable_type) }
it { is_expected.to have_key(:root_commentable_url) }
end
end
end
end
3 changes: 0 additions & 3 deletions decidim-generators/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ PATH
decidim-core (= 0.28.0.dev)
decidim-verifications (= 0.28.0.dev)
hexapdf (~> 0.32.0)
wicked (~> 1.3)
wicked_pdf (~> 2.1)
wkhtmltopdf-binary (~> 0.12)
decidim-meetings (0.28.0.dev)
Expand Down Expand Up @@ -802,8 +801,6 @@ GEM
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
wicked (1.4.0)
railties (>= 3.0.7)
wicked_pdf (2.1.0)
activesupport
wisper (2.0.1)
Expand Down
Loading

0 comments on commit 9524169

Please sign in to comment.