shows proposal view inside management layout
This commit is contained in:
@@ -18,4 +18,14 @@ module ProposalsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def namespaced_proposal_path(proposal, options={})
|
||||
@namespace_proposal_path ||= namespace
|
||||
case @namespace_proposal_path
|
||||
when "management"
|
||||
management_proposal_path(proposal, options)
|
||||
else
|
||||
proposal_path(proposal, options)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -6,10 +6,10 @@
|
||||
<div class="proposal-content">
|
||||
<span class="label-proposal left"><%= t("proposals.proposal.proposal") %></span>
|
||||
<i class="icon-proposals"></i>
|
||||
<h3><%= link_to proposal.title, proposal %></h3>
|
||||
<h3><%= link_to proposal.title, namespaced_proposal_path(proposal) %></h3>
|
||||
<p class="proposal-info">
|
||||
<i class="icon-comments"></i>
|
||||
<%= link_to t("proposals.proposal.comments", count: proposal.comments_count), proposal_path(proposal, anchor: "comments") %>
|
||||
<%= link_to t("proposals.proposal.comments", count: proposal.comments_count), namespaced_proposal_path(proposal, anchor: "comments") %>
|
||||
<span class="bullet"> • </span>
|
||||
<%= l proposal.created_at.to_date %>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
<% end %>
|
||||
</p>
|
||||
<div class="proposal-description">
|
||||
<p><%= link_to proposal.summary, proposal %></p>
|
||||
<p><%= link_to proposal.summary, namespaced_proposal_path(proposal) %></p>
|
||||
<div class="truncate"></div>
|
||||
</div>
|
||||
<%= render "shared/tags", taggable: proposal, limit: 5 %>
|
||||
|
||||
@@ -49,9 +49,52 @@ feature 'Proposals' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Searching" do
|
||||
proposal1 = create(:proposal, title: "Show me what you got")
|
||||
proposal2 = create(:proposal, title: "Get Schwifty")
|
||||
|
||||
user = create(:user, :level_two)
|
||||
login_managed_user(user)
|
||||
|
||||
click_link "Support proposals"
|
||||
|
||||
fill_in "search", with: "what you got"
|
||||
click_button "Search"
|
||||
|
||||
expect(current_path).to eq(management_proposals_path)
|
||||
|
||||
within("#proposals") do
|
||||
expect(page).to have_css('.proposal', count: 1)
|
||||
expect(page).to have_content(proposal1.title)
|
||||
expect(page).to_not have_content(proposal2.title)
|
||||
expect(page).to have_css("a[href='#{management_proposal_path(proposal1)}']", text: proposal1.title)
|
||||
expect(page).to have_css("a[href='#{management_proposal_path(proposal1)}']", text: proposal1.summary)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Listing" do
|
||||
proposal1 = create(:proposal, title: "Show me what you got")
|
||||
proposal2 = create(:proposal, title: "Get Schwifty")
|
||||
|
||||
user = create(:user, :level_two)
|
||||
login_managed_user(user)
|
||||
|
||||
click_link "Support proposals"
|
||||
|
||||
expect(current_path).to eq(management_proposals_path)
|
||||
|
||||
within("#proposals") do
|
||||
expect(page).to have_css('.proposal', count: 2)
|
||||
expect(page).to have_css("a[href='#{management_proposal_path(proposal1)}']", text: proposal1.title)
|
||||
expect(page).to have_css("a[href='#{management_proposal_path(proposal1)}']", text: proposal1.summary)
|
||||
expect(page).to have_css("a[href='#{management_proposal_path(proposal2)}']", text: proposal2.title)
|
||||
expect(page).to have_css("a[href='#{management_proposal_path(proposal2)}']", text: proposal2.summary)
|
||||
end
|
||||
end
|
||||
|
||||
context "Voting" do
|
||||
|
||||
scenario 'Voting proposals on behalf of someone', :js do
|
||||
scenario 'Voting proposals on behalf of someone in index view', :js do
|
||||
proposal = create(:proposal)
|
||||
|
||||
user = create(:user, :level_two)
|
||||
@@ -68,6 +111,24 @@ feature 'Proposals' do
|
||||
expect(URI.parse(current_url).path).to eq(management_proposals_path)
|
||||
end
|
||||
|
||||
scenario 'Voting proposals on behalf of someone in show view', :js do
|
||||
proposal = create(:proposal)
|
||||
|
||||
user = create(:user, :level_two)
|
||||
login_managed_user(user)
|
||||
|
||||
click_link "Support proposals"
|
||||
|
||||
within("#proposals") do
|
||||
click_link proposal.title
|
||||
end
|
||||
|
||||
find('.in-favor a').click
|
||||
expect(page).to have_content "1 support"
|
||||
expect(page).to have_content "You already supported this proposal"
|
||||
expect(current_path).to eq(management_proposal_path(proposal))
|
||||
end
|
||||
|
||||
scenario "Should not allow unverified users to vote proposals" do
|
||||
proposal = create(:proposal)
|
||||
|
||||
@@ -78,27 +139,6 @@ feature 'Proposals' do
|
||||
|
||||
expect(page).to have_content "User is not verified"
|
||||
end
|
||||
|
||||
scenario "Searching" do
|
||||
proposal1 = create(:proposal, title: "Show me what you got")
|
||||
proposal2 = create(:proposal, title: "Get Schwifty")
|
||||
|
||||
user = create(:user, :level_two)
|
||||
login_managed_user(user)
|
||||
|
||||
click_link "Support proposals"
|
||||
|
||||
fill_in "search", with: "what you got"
|
||||
click_button "Search"
|
||||
|
||||
expect(current_path).to eq(management_proposals_path)
|
||||
|
||||
within("#proposals") do
|
||||
expect(page).to have_css('.proposal', count: 1)
|
||||
expect(page).to have_content(proposal1.title)
|
||||
expect(page).to_not have_content(proposal2.title)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "Printing" do
|
||||
|
||||
@@ -20,6 +20,7 @@ feature 'Proposals' do
|
||||
proposals.each do |proposal|
|
||||
within('#proposals') do
|
||||
expect(page).to have_content proposal.title
|
||||
expect(page).to have_css("a[href='#{proposal_path(proposal)}']", text: proposal.title)
|
||||
expect(page).to have_css("a[href='#{proposal_path(proposal)}']", text: proposal.summary)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user