diff --git a/app/helpers/proposals_dashboard_helper.rb b/app/helpers/proposals_dashboard_helper.rb index 40a3e365f..c7dc38010 100644 --- a/app/helpers/proposals_dashboard_helper.rb +++ b/app/helpers/proposals_dashboard_helper.rb @@ -1,6 +1,6 @@ module ProposalsDashboardHelper def resources_menu_visible?(proposal, resources) - can?(:manage_polls, proposal) && resources.any? + can?(:manage_polls, proposal) || resources.any? end def progress_menu(&block) diff --git a/app/views/dashboard/polls/index.html.erb b/app/views/dashboard/polls/index.html.erb index 51d8e1a3f..beaa5003d 100644 --- a/app/views/dashboard/polls/index.html.erb +++ b/app/views/dashboard/polls/index.html.erb @@ -1,10 +1,11 @@ <% content_for :action_title, t("admin.polls.index.title") %> -<%= link_to t("admin.polls.index.create"), - new_proposal_dashboard_poll_path(proposal), - class: "button success float-right" %> <% if @polls.any? %> + <%= link_to t("admin.polls.index.create"), + new_proposal_dashboard_poll_path(proposal), + class: "button success float-right" %> + @@ -19,4 +20,8 @@
<%= t("admin.polls.index.no_polls") %>
+ + <%= link_to t("admin.polls.index.create"), + new_proposal_dashboard_poll_path(proposal), + class: "button success float-right" %> <% end %> diff --git a/app/views/layouts/proposals_dashboard.html.erb b/app/views/layouts/proposals_dashboard.html.erb index c9d7b8669..8f3ad7c94 100644 --- a/app/views/layouts/proposals_dashboard.html.erb +++ b/app/views/layouts/proposals_dashboard.html.erb @@ -31,7 +31,6 @@
-
<%= render partial: 'proposals_dashboard/menu' %> diff --git a/spec/features/dashboard/polls_spec.rb b/spec/features/dashboard/polls_spec.rb index df27c9e76..9acfab3d2 100644 --- a/spec/features/dashboard/polls_spec.rb +++ b/spec/features/dashboard/polls_spec.rb @@ -13,7 +13,10 @@ feature 'Polls' do end scenario 'Initially there are no polls' do - click_link 'Polls' + within('#side_menu') do + click_link 'Polls' + end + expect(page).to have_content('There are no polls coming up.') end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 47b3657b9..761ded855 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -442,7 +442,9 @@ feature 'Proposals' do expect(page.html).not_to include "" click_link 'Dashboard' - click_link 'Edit' + within('#side_menu') do + click_link 'Edit' + end expect(page).to have_current_path(edit_proposal_path(Proposal.last)) expect(page).not_to have_link('click me') @@ -518,7 +520,10 @@ feature 'Proposals' do click_link 'Dashboard' end - click_link 'Retire' + within('#side_menu') do + click_link 'Retire' + end + expect(page).to have_current_path(retire_form_proposal_path(proposal)) select 'Duplicated', from: 'proposal_retired_reason'
<%= t("admin.polls.index.name") %>