Always show create question button on admin proposal show
This commit is contained in:
@@ -3,18 +3,24 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="proposal-show">
|
<div class="proposal-show">
|
||||||
<h2><%= @proposal.title %></h2>
|
<h2 class="inline-block"><%= @proposal.title %></h2>
|
||||||
|
|
||||||
<% if @proposal.successful? %>
|
<% if @proposal.successful? %>
|
||||||
<div class="callout success">
|
<div class="callout success">
|
||||||
<%= t("proposals.proposal.successful") %>
|
<%= t("proposals.proposal.successful") %>
|
||||||
|
|
||||||
<div class="float-right">
|
<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),
|
new_admin_question_path(proposal_id: @proposal.id),
|
||||||
class: "button medium" %>
|
class: "button medium" %>
|
||||||
</div>
|
</div>
|
||||||
</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 %>
|
<% end %>
|
||||||
|
|
||||||
<%= render "proposals/info", proposal: @proposal %>
|
<%= render "proposals/info", proposal: @proposal %>
|
||||||
|
|||||||
@@ -1144,6 +1144,8 @@ en:
|
|||||||
author: Author
|
author: Author
|
||||||
milestones: Milestones
|
milestones: Milestones
|
||||||
no_proposals: There are no proposals.
|
no_proposals: There are no proposals.
|
||||||
|
show:
|
||||||
|
create_question: Add this proposal to a poll to be voted
|
||||||
hidden_proposals:
|
hidden_proposals:
|
||||||
index:
|
index:
|
||||||
filter: Filter
|
filter: Filter
|
||||||
|
|||||||
@@ -508,7 +508,6 @@ en:
|
|||||||
title: "Questions"
|
title: "Questions"
|
||||||
most_voted_answer: "Most voted answer: "
|
most_voted_answer: "Most voted answer: "
|
||||||
poll_questions:
|
poll_questions:
|
||||||
create_question: "Create question"
|
|
||||||
show:
|
show:
|
||||||
vote_answer: "Vote %{answer}"
|
vote_answer: "Vote %{answer}"
|
||||||
voted: "You have voted %{answer}"
|
voted: "You have voted %{answer}"
|
||||||
|
|||||||
@@ -1143,6 +1143,8 @@ es:
|
|||||||
author: Autor
|
author: Autor
|
||||||
milestones: Hitos
|
milestones: Hitos
|
||||||
no_proposals: No hay propuestas.
|
no_proposals: No hay propuestas.
|
||||||
|
show:
|
||||||
|
create_question: Añadir esta propuesta a una votación para ser votada
|
||||||
hidden_proposals:
|
hidden_proposals:
|
||||||
index:
|
index:
|
||||||
filter: Filtro
|
filter: Filtro
|
||||||
|
|||||||
@@ -508,7 +508,6 @@ es:
|
|||||||
title: "Preguntas"
|
title: "Preguntas"
|
||||||
most_voted_answer: "Respuesta más votada: "
|
most_voted_answer: "Respuesta más votada: "
|
||||||
poll_questions:
|
poll_questions:
|
||||||
create_question: "Crear pregunta"
|
|
||||||
show:
|
show:
|
||||||
vote_answer: "Votar %{answer}"
|
vote_answer: "Votar %{answer}"
|
||||||
voted: "Has votado %{answer}"
|
voted: "Has votado %{answer}"
|
||||||
|
|||||||
@@ -62,13 +62,33 @@ feature "Admin poll questions" do
|
|||||||
expect(page).to have_content(title)
|
expect(page).to have_content(title)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Create from successful proposal" do
|
scenario "Create from proposal" do
|
||||||
poll = create(:poll, name: "Proposals")
|
create(:poll, name: "Proposals")
|
||||||
proposal = create(:proposal, :successful)
|
proposal = create(:proposal)
|
||||||
|
|
||||||
visit admin_proposal_path(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_current_path(new_admin_question_path, ignore_query: true)
|
||||||
expect(page).to have_field("Question", with: proposal.title)
|
expect(page).to have_field("Question", with: proposal.title)
|
||||||
@@ -78,8 +98,6 @@ feature "Admin poll questions" do
|
|||||||
click_button "Save"
|
click_button "Save"
|
||||||
|
|
||||||
expect(page).to have_content(proposal.title)
|
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
|
end
|
||||||
|
|
||||||
scenario "Update" do
|
scenario "Update" do
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ feature "Admin proposals" do
|
|||||||
successful_proposals.each do |proposal|
|
successful_proposals.each do |proposal|
|
||||||
visit admin_proposal_path(proposal)
|
visit admin_proposal_path(proposal)
|
||||||
expect(page).to have_content "This proposal has reached the required supports"
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user