diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_address.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_address.scss new file mode 100644 index 0000000000000..988cb50ed4bc7 --- /dev/null +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_address.scss @@ -0,0 +1,5 @@ +@import "stylesheets/decidim/modules/address"; + +.address{ + padding: 1rem; +} diff --git a/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_modules.scss b/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_modules.scss index 9d43d857829ce..6ab7e022b2504 100644 --- a/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_modules.scss +++ b/decidim-admin/app/packs/stylesheets/decidim/admin/modules/_modules.scss @@ -40,3 +40,6 @@ //Admin dashboard @import "stylesheets/decidim/admin/modules/users_statistics"; @import "stylesheets/decidim/admin/modules/moderations"; + +// Address styling +@import "stylesheets/decidim/admin/modules/address"; diff --git a/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb b/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb index e901ecd7cc27a..592686a762710 100644 --- a/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb +++ b/decidim-proposals/app/views/decidim/proposals/admin/proposals/show.html.erb @@ -38,6 +38,13 @@ <%= t ".body" %>: <%= simple_format(present(proposal).body(strip_tags: true)) %> + <% if component_settings.geocoding_enabled? %> +
+ <%= t ".geolocated_at" %>: + <%= render partial: "decidim/shared/static_map", locals: { icon_name: "proposals", geolocalizable: proposal } %> +
+ <% end %> +
<%= t ".created_at" %>: <%= l proposal.created_at, format: :decidim_short %>
diff --git a/decidim-proposals/config/locales/en.yml b/decidim-proposals/config/locales/en.yml index e25375e317c21..8aa6f9024d958 100644 --- a/decidim-proposals/config/locales/en.yml +++ b/decidim-proposals/config/locales/en.yml @@ -544,6 +544,7 @@ en: endorsements_count: Endorsements count endorsements_ranking: Ranking by endorsements endorsers: Endorsers + geolocated_at: Geolocated at link: Link n_more_endorsers: one: and 1 more diff --git a/decidim-proposals/spec/system/admin/view_proposal_details_from_admin_spec.rb b/decidim-proposals/spec/system/admin/view_proposal_details_from_admin_spec.rb index a2eed1021ce0c..c519c49a9b489 100644 --- a/decidim-proposals/spec/system/admin/view_proposal_details_from_admin_spec.rb +++ b/decidim-proposals/spec/system/admin/view_proposal_details_from_admin_spec.rb @@ -90,6 +90,38 @@ end end + context "when it is a proposal with geocoding data" do + let!(:proposal) { create(:proposal, component: component, address: address, latitude: latitude, longitude: longitude) } + + it "does not show the address" do + go_to_admin_proposal_page(proposal) + expect(page).not_to have_css(".address") + expect(page).not_to have_css(".address__info") + expect(page).not_to have_css(".address__map") + expect(page).not_to have_content(address) + end + + context "when component has geocoding enabled" do + let!(:component) do + create(:proposal_component, + manifest: manifest, + participatory_space: participatory_process, + settings: { + geocoding_enabled: true + }) + end + + it "shows the address" do + go_to_admin_proposal_page(proposal) + within ".address" do + expect(page).to have_css(".address__info") + expect(page).to have_css(".address__map") + expect(page).to have_content(address) + end + end + end + end + describe "with supports" do before do create_list :proposal_vote, 2, proposal: proposal diff --git a/decidim-proposals/spec/system/proposals_spec.rb b/decidim-proposals/spec/system/proposals_spec.rb index 63998ab012607..eaf89b41989f5 100644 --- a/decidim-proposals/spec/system/proposals_spec.rb +++ b/decidim-proposals/spec/system/proposals_spec.rb @@ -144,6 +144,40 @@ end end + context "when it is a proposal with geocoding data" do + let!(:proposal) { create(:proposal, component: component, address: address, latitude: latitude, longitude: longitude) } + + it "does not show the address" do + visit_component + click_link proposal_title + expect(page).not_to have_css(".card__content.address") + expect(page).not_to have_css(".address__info") + expect(page).not_to have_css(".address__map") + expect(page).not_to have_content(address) + end + + context "when component has geocoding enabled" do + let!(:component) do + create(:proposal_component, + manifest: manifest, + participatory_space: participatory_process, + settings: { + geocoding_enabled: true + }) + end + + it "shows the address" do + visit_component + click_link proposal_title + within ".card__content.address" do + expect(page).to have_css(".address__info") + expect(page).to have_css(".address__map") + expect(page).to have_content(address) + end + end + end + end + context "when it is an official meeting proposal" do include_context "with rich text editor content" let!(:proposal) { create(:proposal, :official_meeting, body: content, component: component) }