Allow to pass the destination link for the geozone link
Previous to this commit the geozone link shown in the legislation proposal page was pointing to the proposals process feature instead to the legislation proposals.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<ul id="geozone" class="no-bullet geozone">
|
<ul id="geozone" class="no-bullet geozone">
|
||||||
<li class="inline-block">
|
<li class="inline-block">
|
||||||
<%= link_to geozone_name(geozonable), proposals_path(search: geozone_name(geozonable)) %>
|
<%= link_to geozone_name(geozonable), link %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
class Shared::GeozoneLinkComponent < ApplicationComponent
|
class Shared::GeozoneLinkComponent < ApplicationComponent
|
||||||
attr_reader :geozonable
|
attr_reader :geozonable, :link
|
||||||
delegate :geozone_name, to: :helpers
|
delegate :geozone_name, to: :helpers
|
||||||
|
|
||||||
def initialize(geozonable)
|
def initialize(geozonable, link)
|
||||||
@geozonable = geozonable
|
@geozonable = geozonable
|
||||||
|
@link = link
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
|
|
||||||
<%= render "shared/tags", taggable: @proposal %>
|
<%= render "shared/tags", taggable: @proposal %>
|
||||||
|
|
||||||
<%= render Shared::GeozoneLinkComponent.new(@proposal) %>
|
<%= render Shared::GeozoneLinkComponent.new(@proposal, legislation_process_proposals_path(@process, search: geozone_name(@proposal))) %>
|
||||||
|
|
||||||
<div class="js-moderator-proposal-actions margin">
|
<div class="js-moderator-proposal-actions margin">
|
||||||
<%= render "legislation/proposals/actions", proposal: @proposal %>
|
<%= render "legislation/proposals/actions", proposal: @proposal %>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "proposals/info", proposal: @proposal %>
|
<%= render "proposals/info", proposal: @proposal %>
|
||||||
<%= render Shared::GeozoneLinkComponent.new(@proposal) %>
|
<%= render Shared::GeozoneLinkComponent.new(@proposal, proposals_path(search: geozone_name(@proposal))) %>
|
||||||
|
|
||||||
<% unless @proposal.selected? %>
|
<% unless @proposal.selected? %>
|
||||||
<%= render "relationable/related_content", relationable: @proposal %>
|
<%= render "relationable/related_content", relationable: @proposal %>
|
||||||
|
|||||||
@@ -236,4 +236,19 @@ describe "Legislation Proposals" do
|
|||||||
|
|
||||||
expect(page).to have_link("Culture")
|
expect(page).to have_link("Culture")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
scenario "Can filter proposals by geozone" do
|
||||||
|
geozone = create(:geozone, name: "Zone1")
|
||||||
|
proposal = create(:legislation_proposal, title: "Proposal with geozone",
|
||||||
|
legislation_process_id: process.id,
|
||||||
|
geozone: geozone)
|
||||||
|
create(:legislation_proposal, title: "Proposal without geozone", legislation_process_id: process.id)
|
||||||
|
|
||||||
|
visit legislation_process_proposal_path(proposal.process, proposal)
|
||||||
|
click_link "Zone1"
|
||||||
|
|
||||||
|
expect(page).to have_current_path(legislation_process_proposals_path(process.id, search: "Zone1"))
|
||||||
|
expect(page).to have_content("Proposal with geozone")
|
||||||
|
expect(page).not_to have_content("Proposal without geozone")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user