cherry picks creating poll question from successful proposals
This commit is contained in:
@@ -846,7 +846,7 @@
|
|||||||
// ------------
|
// ------------
|
||||||
|
|
||||||
.featured-debates, .featured-proposals,
|
.featured-debates, .featured-proposals,
|
||||||
.proposals-ballot, .proposals-ballot-list {
|
.enquiries-list {
|
||||||
padding: $line-height/2 0;
|
padding: $line-height/2 0;
|
||||||
|
|
||||||
@include breakpoint(medium) {
|
@include breakpoint(medium) {
|
||||||
@@ -953,6 +953,11 @@
|
|||||||
padding-bottom: $line-height;
|
padding-bottom: $line-height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.enquiries {
|
||||||
|
background: #2D3E50 image-url('heading_enquiries.jpg') no-repeat;
|
||||||
|
background-position: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
||||||
@@ -971,7 +976,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.featured-proposals-ballot-banner {
|
.sucessfull-proposals-banner {
|
||||||
background: #2D3E50 image-url("ballot_tiny.gif") no-repeat;
|
background: #2D3E50 image-url("ballot_tiny.gif") no-repeat;
|
||||||
background-position: 75% 0;
|
background-position: 75% 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -995,7 +1000,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.featured-proposals-ballot-banner,
|
.sucessfull-proposals-banner,
|
||||||
.successfull .panel {
|
.successfull .panel {
|
||||||
|
|
||||||
.icon-successfull {
|
.icon-successfull {
|
||||||
@@ -1019,9 +1024,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.proposals-ballot-list {
|
.enquiries-list {
|
||||||
|
|
||||||
.proposal-sucessfull {
|
.enquiry {
|
||||||
background: white;
|
background: white;
|
||||||
border-top: 1px solid $border;
|
border-top: 1px solid $border;
|
||||||
padding: $line-height 0;
|
padding: $line-height 0;
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ProposalsController < ApplicationController
|
|||||||
def index_customization
|
def index_customization
|
||||||
discard_archived
|
discard_archived
|
||||||
load_retired
|
load_retired
|
||||||
load_proposal_ballots
|
load_successfull_proposals
|
||||||
load_featured unless @proposal_successfull_exists
|
load_featured unless @proposal_successfull_exists
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ class ProposalsController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_proposal_ballots
|
def load_successfull_proposals
|
||||||
@proposal_successfull_exists = Proposal.successfull.exists?
|
@proposal_successfull_exists = Proposal.successfull.exists?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @proposal_successfull_exists %>
|
<% if @proposal_successfull_exists %>
|
||||||
<%= render "proposals/proposal_ballots_banner" %>
|
<%= render "proposals/successfull_banner" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless @tag_filter || @search_terms || !has_featured? || @proposal_ballots.present? || @proposal_successfull_exists %>
|
<% unless @tag_filter || @search_terms || !has_featured? || @proposal_successfull_exists %>
|
||||||
<%= render "featured_debates" %>
|
<%= render "featured_debates" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|||||||
41
app/views/enquiries/index.html.erb
Normal file
41
app/views/enquiries/index.html.erb
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<div class="expanded no-margin-top margin-bottom dark-heading enquiries padding">
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 medium-6 column">
|
||||||
|
<h2>
|
||||||
|
<%= t("enquiries.index.title") %>
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
<%= t("enquiries.index.description_html").html_safe %>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div class="row">
|
||||||
|
<div class="small-12 column">
|
||||||
|
<%= render 'shared/filter_subnav', i18n_namespace: "enquiries.index" %>
|
||||||
|
|
||||||
|
<% if @enquiries.present? %>
|
||||||
|
<div class="enquiries-list">
|
||||||
|
<% @enquiries.each do |enquiry| %>
|
||||||
|
<div class="enquiry">
|
||||||
|
<h3><%= link_to enquiry.title, enquiry %></h3>
|
||||||
|
<div class="info">
|
||||||
|
<%= t('enquiries.index.dates',
|
||||||
|
open_at: l(enquiry.open_at.to_date),
|
||||||
|
closed_at: l(enquiry.closed_at.to_date)).html_safe %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<%= paginate @enquiries %>
|
||||||
|
<% else %>
|
||||||
|
<div class="callout primary">
|
||||||
|
<%= t("enquiries.index.no_enquiries_#{@current_filter}") %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
@@ -56,8 +56,8 @@
|
|||||||
<% if proposal.successfull? %>
|
<% if proposal.successfull? %>
|
||||||
<div class="message">
|
<div class="message">
|
||||||
<p>
|
<p>
|
||||||
<%= t("proposal_ballots.successfull",
|
<%= t("proposals.proposal.successfull",
|
||||||
voting: link_to(t("proposal_ballots.voting"), polls_path)).html_safe %>
|
voting: link_to(t("proposals.proposal.voting"), polls_path)).html_safe %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<% if can? :create, Poll::Question %>
|
<% if can? :create, Poll::Question %>
|
||||||
|
|||||||
9
app/views/proposals/_successfull_banner.html.erb
Normal file
9
app/views/proposals/_successfull_banner.html.erb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<div id="next-voting" class="row sucessfull-proposals-banner">
|
||||||
|
<%= link_to polls_path do %>
|
||||||
|
<div class="small-12 column padding">
|
||||||
|
<div class="icon-successfull"></div>
|
||||||
|
<h2><%= t("enquiries.banner.featured_title") %></h2>
|
||||||
|
<p><%= t("enquiries.banner.info") %></p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @proposal_successfull_exists %>
|
<% if @proposal_successfull_exists %>
|
||||||
<%= render "proposal_ballots_banner" %>
|
<%= render "successfull_banner" %>
|
||||||
<% elsif @featured_proposals.present? %>
|
<% elsif @featured_proposals.present? %>
|
||||||
<div id="featured-proposals" class="row featured-proposals">
|
<div id="featured-proposals" class="row featured-proposals">
|
||||||
<div class="small-12 column">
|
<div class="small-12 column">
|
||||||
|
|||||||
@@ -105,9 +105,16 @@
|
|||||||
<div id="<%= dom_id(@proposal) %>_votes">
|
<div id="<%= dom_id(@proposal) %>_votes">
|
||||||
<% if @proposal.successfull? %>
|
<% if @proposal.successfull? %>
|
||||||
<p>
|
<p>
|
||||||
<%= t("proposal_ballots.successfull",
|
<%= t("proposals.proposal.successfull",
|
||||||
voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %>
|
voting: link_to(t("proposals.proposal.voting"), polls_path)).html_safe %>
|
||||||
</p>
|
</p>
|
||||||
|
<% if can? :create, Poll::Question %>
|
||||||
|
<p class="text-center">
|
||||||
|
<%= link_to t('poll_questions.create_enquiry'),
|
||||||
|
new_admin_question_path(proposal_id: @proposal.id),
|
||||||
|
class: "button hollow expanded" %>
|
||||||
|
</p>
|
||||||
|
<% end %>
|
||||||
<% elsif @proposal.archived? %>
|
<% elsif @proposal.archived? %>
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
<strong><%= t("proposals.proposal.supports", count: @proposal.total_votes) %></strong>
|
<strong><%= t("proposals.proposal.supports", count: @proposal.total_votes) %></strong>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if controller_name == "proposals"), accesskey: "p" %>
|
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if controller_name == "proposals"), accesskey: "p" %>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to t("layouts.header.proposal_ballot"), polls_path, class: ("active" if controller_name == "proposal_ballots"), accesskey: "v" %>
|
<%= link_to t("layouts.header.poll_questions"), polls_path, class: ("active" if controller_name == "polls"), accesskey: "v" %>
|
||||||
</li>
|
</li>
|
||||||
<% if feature?(:spending_proposals) %>
|
<% if feature?(:spending_proposals) %>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -354,6 +354,8 @@ en:
|
|||||||
supports_necessary: "%{number} supports needed"
|
supports_necessary: "%{number} supports needed"
|
||||||
total_percent: 100%
|
total_percent: 100%
|
||||||
archived: "This proposal has been archived and can't collect supports."
|
archived: "This proposal has been archived and can't collect supports."
|
||||||
|
successfull: "This proposal has reached the required supports and will be voted in the %{voting}."
|
||||||
|
voting: "next voting"
|
||||||
show:
|
show:
|
||||||
author_deleted: User deleted
|
author_deleted: User deleted
|
||||||
code: 'Proposal code:'
|
code: 'Proposal code:'
|
||||||
|
|||||||
@@ -354,6 +354,8 @@ es:
|
|||||||
supports_necessary: "%{number} apoyos necesarios"
|
supports_necessary: "%{number} apoyos necesarios"
|
||||||
total_percent: 100%
|
total_percent: 100%
|
||||||
archived: "Esta propuesta ha sido archivada y ya no puede recoger apoyos."
|
archived: "Esta propuesta ha sido archivada y ya no puede recoger apoyos."
|
||||||
|
successfull: "Esta propuesta ha alcanzado los apoyos necesarios y pasará a la %{voting}."
|
||||||
|
voting: "próxima votación"
|
||||||
show:
|
show:
|
||||||
author_deleted: Usuario eliminado
|
author_deleted: Usuario eliminado
|
||||||
code: 'Código de la propuesta:'
|
code: 'Código de la propuesta:'
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ feature 'Admin enquiries' do
|
|||||||
expect(page).to have_content(summary)
|
expect(page).to have_content(summary)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Create from successful proposal' do
|
scenario 'Create from successful proposal index' do
|
||||||
geozones = create_list(:geozone, 3)
|
geozones = create_list(:geozone, 3)
|
||||||
proposal = create(:proposal, :successful)
|
proposal = create(:proposal, :successful)
|
||||||
|
|
||||||
@@ -74,6 +74,8 @@ feature 'Admin enquiries' do
|
|||||||
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
|
expect(page).to have_link(proposal.author.name, href: user_path(proposal.author))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pending "Create from successul proposal show"
|
||||||
|
|
||||||
scenario 'Update' do
|
scenario 'Update' do
|
||||||
question1 = create(:poll_question)
|
question1 = create(:poll_question)
|
||||||
|
|
||||||
|
|||||||
@@ -1488,3 +1488,69 @@ feature 'Proposals' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
feature 'Successfull proposals' do
|
||||||
|
|
||||||
|
scenario 'Banner shows in proposal index' do
|
||||||
|
create_featured_proposals
|
||||||
|
|
||||||
|
visit proposals_path
|
||||||
|
expect(page).to_not have_css("#next-voting")
|
||||||
|
expect(page).to have_css("#featured-proposals")
|
||||||
|
|
||||||
|
create_successfull_proposals
|
||||||
|
|
||||||
|
visit proposals_path
|
||||||
|
|
||||||
|
expect(page).to have_css("#next-voting")
|
||||||
|
expect(page).to_not have_css("#featured-proposals")
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'Successfull proposals do not show support buttons in index' do
|
||||||
|
successfull_proposals = create_successfull_proposals
|
||||||
|
|
||||||
|
visit proposals_path
|
||||||
|
|
||||||
|
successfull_proposals.each do |proposal|
|
||||||
|
within("#proposal_#{proposal.id}_votes") do
|
||||||
|
expect(page).to_not have_css(".supports")
|
||||||
|
expect(page).to have_content "This proposal has reached the required supports"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'Successfull proposals do not show support buttons in show' do
|
||||||
|
successfull_proposals = create_successfull_proposals
|
||||||
|
|
||||||
|
successfull_proposals.each do |proposal|
|
||||||
|
visit proposal_path(proposal)
|
||||||
|
within("#proposal_#{proposal.id}_votes") do
|
||||||
|
expect(page).to_not have_css(".supports")
|
||||||
|
expect(page).to have_content "This proposal has reached the required supports"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'Successfull proposals show create enquiry button to admin users' do
|
||||||
|
successfull_proposals = create_successfull_proposals
|
||||||
|
|
||||||
|
visit proposals_path
|
||||||
|
|
||||||
|
successfull_proposals.each do |proposal|
|
||||||
|
within("#proposal_#{proposal.id}_votes") do
|
||||||
|
expect(page).to_not have_link "Create question"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
login_as(create(:administrator).user)
|
||||||
|
|
||||||
|
visit proposals_path
|
||||||
|
|
||||||
|
successfull_proposals.each do |proposal|
|
||||||
|
within("#proposal_#{proposal.id}_votes") do
|
||||||
|
expect(page).to have_link "Create question"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user