Always show create question button on admin proposal show

This commit is contained in:
decabeza
2019-03-13 13:28:12 +01:00
parent e7dd63e264
commit 74958fab02
7 changed files with 37 additions and 11 deletions

View File

@@ -3,18 +3,24 @@
<% end %>
<div class="proposal-show">
<h2><%= @proposal.title %></h2>
<h2 class="inline-block"><%= @proposal.title %></h2>
<% if @proposal.successful? %>
<div class="callout success">
<%= t("proposals.proposal.successful") %>
<div class="float-right">
<%= link_to t("poll_questions.create_question"),
<%= link_to t("admin.proposals.show.create_question"),
new_admin_question_path(proposal_id: @proposal.id),
class: "button medium" %>
</div>
</div>
<% else %>
<div class="float-right">
<%= link_to t("admin.proposals.show.create_question"),
new_admin_question_path(proposal_id: @proposal.id),
class: "button hollow medium" %>
</div>
<% end %>
<%= render "proposals/info", proposal: @proposal %>

View File

@@ -1144,6 +1144,8 @@ en:
author: Author
milestones: Milestones
no_proposals: There are no proposals.
show:
create_question: Add this proposal to a poll to be voted
hidden_proposals:
index:
filter: Filter

View File

@@ -508,7 +508,6 @@ en:
title: "Questions"
most_voted_answer: "Most voted answer: "
poll_questions:
create_question: "Create question"
show:
vote_answer: "Vote %{answer}"
voted: "You have voted %{answer}"

View File

@@ -1143,6 +1143,8 @@ es:
author: Autor
milestones: Hitos
no_proposals: No hay propuestas.
show:
create_question: Añadir esta propuesta a una votación para ser votada
hidden_proposals:
index:
filter: Filtro

View File

@@ -508,7 +508,6 @@ es:
title: "Preguntas"
most_voted_answer: "Respuesta más votada: "
poll_questions:
create_question: "Crear pregunta"
show:
vote_answer: "Votar %{answer}"
voted: "Has votado %{answer}"

View File

@@ -62,13 +62,33 @@ feature "Admin poll questions" do
expect(page).to have_content(title)
end
scenario "Create from successful proposal" do
poll = create(:poll, name: "Proposals")
proposal = create(:proposal, :successful)
scenario "Create from proposal" do
create(:poll, name: "Proposals")
proposal = create(:proposal)
visit admin_proposal_path(proposal)
click_link "Create question"
expect(page).not_to have_content("This proposal has reached the required supports")
click_link "Add this proposal to a poll to be voted"
expect(page).to have_current_path(new_admin_question_path, ignore_query: true)
expect(page).to have_field("Question", with: proposal.title)
select "Proposals", from: "poll_question_poll_id"
click_button "Save"
expect(page).to have_content(proposal.title)
end
scenario "Create from successful proposal" do
create(:poll, name: "Proposals")
proposal = create(:proposal, :successful)
visit admin_proposal_path(proposal)
expect(page).to have_content("This proposal has reached the required supports")
click_link "Add this proposal to a poll to be voted"
expect(page).to have_current_path(new_admin_question_path, ignore_query: true)
expect(page).to have_field("Question", with: proposal.title)
@@ -78,8 +98,6 @@ feature "Admin poll questions" do
click_button "Save"
expect(page).to have_content(proposal.title)
expect(page).to have_link(proposal.title, href: proposal_path(proposal))
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
end
scenario "Update" do

View File

@@ -52,7 +52,7 @@ feature "Admin proposals" do
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"
expect(page).to have_link "Add this proposal to a poll to be voted"
end
end
end