diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 7f4e1bb82..14ec9e354 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -1093,6 +1093,7 @@ form { .callout { font-size: $small-font-size; + overflow: hidden; a:not(.button) { font-weight: bold; @@ -1132,6 +1133,10 @@ form { .close { text-decoration: none !important; } + + .button { + margin-bottom: 0; + } } .no-error { diff --git a/app/views/admin/proposals/show.html.erb b/app/views/admin/proposals/show.html.erb index 762c65592..c646b0eed 100644 --- a/app/views/admin/proposals/show.html.erb +++ b/app/views/admin/proposals/show.html.erb @@ -5,6 +5,18 @@
<%= t("proposals.proposal.successful") %>
- <%= link_to t('poll_questions.create_question'), - new_admin_question_path(proposal_id: proposal.id), - class: "button hollow" %> -
- <% end %> <% elsif proposal.archived? %><%= t("proposals.proposal.successful") %>
- <% if can? :create, Poll::Question %> -- <%= link_to t('poll_questions.create_question'), - new_admin_question_path(proposal_id: @proposal.id), - class: "button hollow expanded" %> -
- <% end %> <% elsif @proposal.archived? %>diff --git a/spec/features/admin/poll/questions_spec.rb b/spec/features/admin/poll/questions_spec.rb index 5fedcbb34..65aead571 100644 --- a/spec/features/admin/poll/questions_spec.rb +++ b/spec/features/admin/poll/questions_spec.rb @@ -53,11 +53,12 @@ feature 'Admin poll questions' do expect(page).to have_content(title) end - scenario 'Create from successful proposal index' do + scenario 'Create from successful proposal' do poll = create(:poll, name: 'Proposals') proposal = create(:proposal, :successful) - visit proposals_path + visit admin_proposal_path(proposal) + click_link "Create question" expect(page).to have_current_path(new_admin_question_path, ignore_query: true) @@ -72,17 +73,6 @@ feature 'Admin poll questions' do expect(page).to have_link(proposal.author.name, href: user_path(proposal.author)) end - scenario "Create from successful proposal show" do - poll = create(:poll, name: 'Proposals') - proposal = create(:proposal, :successful) - - visit proposal_path(proposal) - click_link "Create question" - - expect(page).to have_current_path(new_admin_question_path, ignore_query: true) - expect(page).to have_field('Question', with: proposal.title) - end - scenario 'Update' do question1 = create(:poll_question) diff --git a/spec/features/admin/proposals_spec.rb b/spec/features/admin/proposals_spec.rb index ddad53d9c..d1d8c5cc0 100644 --- a/spec/features/admin/proposals_spec.rb +++ b/spec/features/admin/proposals_spec.rb @@ -28,12 +28,32 @@ feature "Admin proposals" do end end - scenario "Show" do - create(:proposal, title: "Create a chaotic future", summary: "Chaos isn't controlled") + context "Show" do - visit admin_proposals_path - click_link "Create a chaotic future" + scenario "View proposal" do + create(:proposal, title: "Create a chaotic future", summary: "Chaos isn't controlled") - expect(page).to have_content "Chaos isn't controlled" + visit admin_proposals_path + click_link "Create a chaotic future" + + expect(page).to have_content "Chaos isn't controlled" + expect(page).not_to have_content "This proposal has reached the required supports" + expect(page).not_to have_link "Create question" + end + + scenario "Successful proposals show create question button" do + successful_proposals = create_successful_proposals + admin = create(:administrator) + + login_as(admin.user) + + visit admin_proposals_path + + successful_proposals.each do |proposal| + visit admin_proposal_path(proposal) + expect(page).to have_content "This proposal has reached the required supports" + expect(page).to have_link "Create question" + end + end end end diff --git a/spec/features/proposals_spec.rb b/spec/features/proposals_spec.rb index 9628ea9f8..e36d9c6cd 100644 --- a/spec/features/proposals_spec.rb +++ b/spec/features/proposals_spec.rb @@ -1789,8 +1789,11 @@ feature 'Successful proposals' do end end - scenario 'Successful proposals show create question button to admin users' do + scenario 'Successful proposals do not show create question button in index' do successful_proposals = create_successful_proposals + admin = create(:administrator) + + login_as(admin.user) visit proposals_path @@ -1799,17 +1802,20 @@ feature 'Successful proposals' do expect(page).not_to have_link "Create question" end end + end - login_as(create(:administrator).user) + scenario 'Successful proposals do not show create question button in show' do + successful_proposals = create_successful_proposals + admin = create(:administrator) - visit proposals_path + login_as(admin.user) successful_proposals.each do |proposal| + visit proposal_path(proposal) within("#proposal_#{proposal.id}_votes") do - expect(page).to have_link "Create question" + expect(page).not_to have_link "Create question" end end - end context "Skip user verification" do