Binary file not shown.
@@ -54,4 +54,8 @@
|
||||
<glyph glyph-name="arrow-down" unicode="R" d="M402 311c0-5-2-9-5-13l-128-128c-4-4-8-5-13-5-5 0-9 1-13 5l-128 128c-3 4-5 8-5 13 0 5 2 9 5 13 4 3 8 5 13 5l256 0c5 0 9-2 13-5 3-4 5-8 5-13z"/>
|
||||
<glyph glyph-name="arrow-left" unicode="T" d="M347 384l0-256c0-5-1-9-5-13-4-3-8-5-13-5-5 0-9 2-13 5l-128 128c-3 4-5 8-5 13 0 5 2 9 5 13l128 128c4 3 8 5 13 5 5 0 9-2 13-5 4-4 5-8 5-13z"/>
|
||||
<glyph glyph-name="arrow-right" unicode="U" d="M329 256c0-5-2-9-5-13l-128-128c-4-3-8-5-13-5-5 0-9 2-13 5-4 4-5 8-5 13l0 256c0 5 1 9 5 13 4 3 8 5 13 5 5 0 9-2 13-5l128-128c3-4 5-8 5-13z"/>
|
||||
<glyph glyph-name="check-circle" unicode="V" d="M256 480c-124 0-224-100-224-224 0-124 100-224 224-224 124 0 224 100 224 224 0 124-100 224-224 224z m115-149l-139-179c-1-1-3-3-5-3-3 0-4 1-5 3-2 1-79 76-79 76l-2 1c0 1-1 2-1 3 0 2 1 3 1 4 1 0 1 0 1 1 8 8 24 24 25 25 1 2 2 3 4 3 3 0 5-2 6-3 1-1 45-43 45-43l111 143c1 0 2 1 4 1 1 0 2 0 3-1l31-24c0-1 1-3 1-4 0-1 0-2-1-3z"/>
|
||||
<glyph glyph-name="arrow-top" unicode="W" d="M402 165c0-5-2-10-5-13-4-4-8-6-13-6l-256 0c-5 0-9 2-13 6-3 3-5 8-5 13 0 5 2 9 5 12l128 128c4 4 8 6 13 6 5 0 9-2 13-6l128-128c3-3 5-7 5-12z"/>
|
||||
<glyph glyph-name="help-1" unicode="X" d="M345 435c-27 21-58 28-98 28-29 0-55-6-75-20-30-20-44-54-44-108l77 0c0 14-2 30 7 43 8 13 20 24 40 24 20 0 31-6 41-18 8-11 11-23 11-36 0-12-5-22-12-32-4-5-9-10-15-15 0 0-42-25-56-48-11-18-15-40-16-66 0-2 0-5 7-5 7 0 56 0 62 0 6 0 7 4 7 6 0 9 2 24 3 29 4 11 10 20 20 28l21 14c18 15 33 26 40 36 11 15 19 34 19 57 0 36-13 64-39 83z m-103-293c-26 1-47-17-48-46-1-28 19-46 45-47 27-1 48 17 49 45 1 28-19 47-46 48z"/>
|
||||
<glyph glyph-name="checkmark-circle" unicode="Y" d="M171 296l-29-30 93-93 208 208-29 29-179-178z m251-40c0-92-74-166-166-166-92 0-166 74-166 166 0 92 74 166 166 166 16 0 31-2 46-6l32 32c-24 11-50 16-78 16-114 0-208-94-208-208 0-114 94-208 208-208 114 0 208 94 208 208z"/>
|
||||
</font></defs></svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 26 KiB |
Binary file not shown.
Binary file not shown.
BIN
app/assets/images/ballot.gif
Normal file
BIN
app/assets/images/ballot.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
@@ -172,3 +172,6 @@
|
||||
.icon-arrow-right:before {
|
||||
content: "\55";
|
||||
}
|
||||
.icon-checkmark-circle:before {
|
||||
content: "\59";
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
// 03. Show participation
|
||||
// 04. List participation
|
||||
// 05. Featured
|
||||
// 06. Proposals successfull
|
||||
//
|
||||
|
||||
// 01. Votes and supports
|
||||
@@ -563,14 +564,14 @@
|
||||
|
||||
.debates-list, .proposals-list, .investment-projects-list {
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
margin-bottom: rem-calc(48);
|
||||
}
|
||||
}
|
||||
|
||||
.investment-projects-list {
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
min-height: $line-height*15;
|
||||
}
|
||||
}
|
||||
@@ -589,7 +590,7 @@
|
||||
min-height: rem-calc(192);
|
||||
padding: rem-calc(12) rem-calc(12) 0 rem-calc(12);
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
margin-bottom: rem-calc(-1);
|
||||
padding-bottom: rem-calc(12);
|
||||
}
|
||||
@@ -747,7 +748,7 @@
|
||||
border: 1px solid $votes-border;
|
||||
margin: 0 rem-calc(-12);
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
margin: 0 rem-calc(-25) 0 rem-calc(12);
|
||||
@@ -765,7 +766,7 @@
|
||||
right: -1px;
|
||||
border-width: 13px 13px 0 0;
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
@@ -777,7 +778,7 @@
|
||||
padding-top: rem-calc(12);
|
||||
vertical-align: top;
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
display: block;
|
||||
float: none;
|
||||
line-height: $line-height*2;
|
||||
@@ -786,7 +787,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
.like, .unlike {
|
||||
|
||||
span.percentage {
|
||||
@@ -805,7 +806,7 @@
|
||||
border: 1px solid $proposals-border;
|
||||
margin: 0 rem-calc(-12);
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
border-top-left-radius: 3px;
|
||||
border-bottom-left-radius: 3px;
|
||||
margin: 0 rem-calc(-25) 0 rem-calc(12);
|
||||
@@ -823,7 +824,7 @@
|
||||
right: -1px;
|
||||
border-width: 13px 13px 0 0;
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
content: "";
|
||||
}
|
||||
}
|
||||
@@ -834,7 +835,7 @@
|
||||
padding-top: rem-calc(12);
|
||||
vertical-align: top;
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
display: block;
|
||||
float: none;
|
||||
margin-left: 0;
|
||||
@@ -855,7 +856,7 @@
|
||||
min-height: rem-calc(180);
|
||||
padding-top: 0;
|
||||
|
||||
@include breakpoint(small) {
|
||||
@include breakpoint(medium) {
|
||||
padding-top: $line-height*1.5;
|
||||
}
|
||||
|
||||
@@ -944,7 +945,8 @@
|
||||
// 05. Featured
|
||||
// ------------
|
||||
|
||||
.featured-debates, .featured-proposals {
|
||||
.featured-debates, .featured-proposals,
|
||||
.proposals-ballot, .proposals-ballot-list {
|
||||
padding: $line-height/2 0;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
@@ -1044,3 +1046,108 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 06. Proposals successfull
|
||||
// -------------------------
|
||||
|
||||
.dark-heading {
|
||||
background: #2D3E50;
|
||||
color: white;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
padding-bottom: $line-height;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 0;
|
||||
|
||||
&.title {
|
||||
color: #FFD200;
|
||||
}
|
||||
}
|
||||
|
||||
.info {
|
||||
background: #314253;
|
||||
padding-top: $line-height;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
border-top: rem-calc(6) solid #FFD200;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.featured-proposals-ballot-banner {
|
||||
background: #2D3E50 image-url("ballot.gif");
|
||||
background-position: 90% 0;
|
||||
background-repeat: no-repeat;
|
||||
position: relative;
|
||||
|
||||
h2, a:hover h2 {
|
||||
color: #FFD200 !important;
|
||||
}
|
||||
|
||||
p {
|
||||
color: white;
|
||||
}
|
||||
|
||||
@include breakpoint(medium) {
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.featured-proposals-ballot-banner,
|
||||
.successfull .panel {
|
||||
|
||||
.icon-successfull {
|
||||
border-right: 60px solid #FFD200;
|
||||
border-top: 0;
|
||||
border-bottom: 60px solid transparent;
|
||||
height: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
width: 0;
|
||||
|
||||
&:after {
|
||||
color: #1B254C;
|
||||
content: "\59";
|
||||
font-family: "icons" !important;
|
||||
left: 34px;
|
||||
position: absolute;
|
||||
top: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.proposals-ballot-list {
|
||||
|
||||
.proposal-sucessfull {
|
||||
background: white;
|
||||
border-top: 1px solid $border;
|
||||
padding: $line-height 0;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
.successfull {
|
||||
|
||||
.panel {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.truncate {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.message {
|
||||
@include supports;
|
||||
background: none;
|
||||
border-top: 0;
|
||||
|
||||
@include breakpoint(medium) {
|
||||
border-left: 1px solid $border;
|
||||
margin: $line-height rem-calc(-25) 0 rem-calc(12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ class DebatesController < ApplicationController
|
||||
|
||||
def index_customization
|
||||
@featured_debates = @debates.featured
|
||||
@proposal_successfull_exists = Proposal.successfull.exists?
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
8
app/controllers/proposal_ballots_controller.rb
Normal file
8
app/controllers/proposal_ballots_controller.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class ProposalBallotsController < ApplicationController
|
||||
skip_authorization_check
|
||||
|
||||
def index
|
||||
@proposal_ballots = Proposal.successfull.sort_by_confidence_score
|
||||
end
|
||||
|
||||
end
|
||||
@@ -28,7 +28,8 @@ class ProposalsController < ApplicationController
|
||||
def index_customization
|
||||
discard_archived
|
||||
load_retired
|
||||
load_featured
|
||||
load_proposal_ballots
|
||||
load_featured unless @proposal_successfull_exists
|
||||
end
|
||||
|
||||
def vote
|
||||
@@ -102,4 +103,8 @@ class ProposalsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def load_proposal_ballots
|
||||
@proposal_successfull_exists = Proposal.successfull.exists?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -50,6 +50,7 @@ class Proposal < ActiveRecord::Base
|
||||
scope :last_week, -> { where("proposals.created_at >= ?", 7.days.ago)}
|
||||
scope :retired, -> { where.not(retired_at: nil) }
|
||||
scope :not_retired, -> { where(retired_at: nil) }
|
||||
scope :successfull, -> { where("cached_votes_up + physical_votes >= ?", Proposal.votes_needed_for_success)}
|
||||
|
||||
def to_param
|
||||
"#{id}-#{title}".parameterize
|
||||
@@ -158,6 +159,10 @@ class Proposal < ActiveRecord::Base
|
||||
Setting['votes_for_proposal_success'].to_i
|
||||
end
|
||||
|
||||
def successfull?
|
||||
total_votes >= Proposal.votes_needed_for_success
|
||||
end
|
||||
|
||||
def archived?
|
||||
self.created_at <= Setting["months_to_archive_proposals"].to_i.months.ago
|
||||
end
|
||||
|
||||
@@ -29,7 +29,11 @@
|
||||
<%= render "shared/banner" %>
|
||||
<% end %>
|
||||
|
||||
<% unless @tag_filter || @search_terms || !has_featured? %>
|
||||
<% if @proposal_successfull_exists %>
|
||||
<%= render "proposals/proposal_ballots_banner" %>
|
||||
<% end %>
|
||||
|
||||
<% unless @tag_filter || @search_terms || !has_featured? || @proposal_ballots.present? || @proposal_successfull_exists %>
|
||||
<%= render "featured_debates" %>
|
||||
<% end %>
|
||||
|
||||
|
||||
13
app/views/proposal_ballots/_successfull_proposal.html.erb
Normal file
13
app/views/proposal_ballots/_successfull_proposal.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<div id="<%= dom_id(proposal) %>" class="proposal-sucessfull">
|
||||
<h3><%= link_to proposal.title, proposal %></h3>
|
||||
<div class="info">
|
||||
<% if proposal.author.hidden? || proposal.author.erased? %>
|
||||
<%= t("proposals.show.author_deleted") %>
|
||||
<% else %>
|
||||
<%= proposal.author.name %>
|
||||
<% end %>
|
||||
|
||||
<span class="bullet"> • </span>
|
||||
<%= l proposal.created_at.to_date %>
|
||||
</div>
|
||||
</div>
|
||||
35
app/views/proposal_ballots/index.html.erb
Normal file
35
app/views/proposal_ballots/index.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="expanded no-margin-top margin-bottom dark-heading">
|
||||
<div class="row" data-equalizer>
|
||||
<div class="small-12 medium-6 column padding" data-equalizer-watch>
|
||||
<h2>
|
||||
<%= t("proposal_ballots.title") %>
|
||||
</h2>
|
||||
<p>
|
||||
<%= t("proposal_ballots.description_html").html_safe %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="small-12 medium-4 column info" data-equalizer-watch>
|
||||
<p class="title"><strong><%= t("proposal_ballots.date_title") %></strong></p>
|
||||
<h3><%= t("proposal_ballots.date") %></h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<main>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
<% if @proposal_ballots.present? %>
|
||||
<div class="proposals-ballot-list">
|
||||
<% @proposal_ballots.each do |proposal_for_vote| %>
|
||||
<%= render "successfull_proposal", proposal: proposal_for_vote %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% else %>
|
||||
<p>
|
||||
<%= t("proposal_ballots.nothing_to_vote") %>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
@@ -1,10 +1,12 @@
|
||||
<div id="<%= dom_id(proposal) %>" class="proposal clear" data-type="proposal">
|
||||
<div id="<%= dom_id(proposal) %>"
|
||||
class="proposal clear <%= ("successfull" if proposal.total_votes > Proposal.votes_needed_for_success) %>"
|
||||
data-type="proposal">
|
||||
<div class="panel">
|
||||
<div class="icon-successfull"></div>
|
||||
<div class="row">
|
||||
|
||||
<div class="small-12 medium-9 column">
|
||||
<div class="proposal-content">
|
||||
|
||||
<% cache [locale_and_user_status(proposal), 'index', proposal, proposal.author] do %>
|
||||
<span class="label-proposal float-left"><%= t("proposals.proposal.proposal") %></span>
|
||||
<span class="icon-proposals"></span>
|
||||
@@ -51,7 +53,13 @@
|
||||
</div>
|
||||
|
||||
<div id="<%= dom_id(proposal) %>_votes" class="small-12 medium-3 column">
|
||||
<% if proposal.archived? %>
|
||||
<% if proposal.successfull? %>
|
||||
<div class="message">
|
||||
<p>
|
||||
<%= t("proposal_ballots.successfull",
|
||||
voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %>
|
||||
</p>
|
||||
<% elsif proposal.archived? %>
|
||||
<div class="message">
|
||||
<strong><%= t("proposals.proposal.supports", count: proposal.total_votes) %></strong>
|
||||
<p><%= t("proposals.proposal.archived") %></p>
|
||||
@@ -63,7 +71,6 @@
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
9
app/views/proposals/_proposal_ballots_banner.html.erb
Normal file
9
app/views/proposals/_proposal_ballots_banner.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<div id="next-voting" class="row featured-proposals-ballot-banner">
|
||||
<%= link_to proposal_ballots_path do %>
|
||||
<div class="small-12 column padding">
|
||||
<div class="icon-successfull"></div>
|
||||
<h2><%= t("proposal_ballots.featured_title") %></h2>
|
||||
<p><%= t("proposal_ballots.info") %></p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -31,7 +31,9 @@
|
||||
<%= render "shared/banner" %>
|
||||
<% end %>
|
||||
|
||||
<% if @featured_proposals.present? %>
|
||||
<% if @proposal_successfull_exists %>
|
||||
<%= render "proposal_ballots_banner" %>
|
||||
<% elsif @featured_proposals.present? %>
|
||||
<div id="featured-proposals" class="row featured-proposals">
|
||||
<div class="small-12 column">
|
||||
<h2>
|
||||
|
||||
@@ -102,19 +102,24 @@
|
||||
<aside class="small-12 medium-3 column">
|
||||
<div class="sidebar-divider"></div>
|
||||
<h3><%= t("votes.supports") %></h3>
|
||||
<% if @proposal.archived? %>
|
||||
<p class="text-center">
|
||||
<strong><%= t("proposals.proposal.supports", count: @proposal.total_votes) %></strong>
|
||||
</p>
|
||||
<p><%= t("proposals.proposal.archived") %></p>
|
||||
<% else %>
|
||||
<div class="text-center">
|
||||
<div id="<%= dom_id(@proposal) %>_votes">
|
||||
<div id="<%= dom_id(@proposal) %>_votes">
|
||||
<% if @proposal.successfull? %>
|
||||
<p>
|
||||
<%= t("proposal_ballots.successfull",
|
||||
voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %>
|
||||
</p>
|
||||
<% elsif @proposal.archived? %>
|
||||
<p class="text-center">
|
||||
<strong><%= t("proposals.proposal.supports", count: @proposal.total_votes) %></strong>
|
||||
</p>
|
||||
<p><%= t("proposals.proposal.archived") %></p>
|
||||
<% else %>
|
||||
<div class="text-center">
|
||||
<%= render 'votes',
|
||||
{ proposal: @proposal, vote_url: vote_proposal_path(@proposal, value: 'yes') } %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="social-share" class="sidebar-divider"></div>
|
||||
<h3><%= t("proposals.show.share") %></h3>
|
||||
<div class="social-share-full">
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<li>
|
||||
<%= link_to t("layouts.header.proposals"), proposals_path, class: ("active" if controller_name == "proposals"), accesskey: "p" %>
|
||||
</li>
|
||||
<li>
|
||||
<%= link_to t("layouts.header.proposal_ballot"), proposal_ballots_path, class: ("active" if controller_name == "proposal_ballots"), accesskey: "v" %>
|
||||
</li>
|
||||
<% if feature?(:spending_proposals) %>
|
||||
<li>
|
||||
<%= link_to t("layouts.header.spending_proposals"), spending_proposals_path, class: ("active" if controller_name == "spending_proposals"), accesskey: "s" %>
|
||||
|
||||
@@ -209,6 +209,7 @@ en:
|
||||
open_data: Open data
|
||||
open_gov: Open government
|
||||
proposals: Proposals
|
||||
proposal_ballot: Voting
|
||||
see_all: See proposals
|
||||
spending_proposals: Spending proposals
|
||||
legislation:
|
||||
@@ -373,6 +374,17 @@ en:
|
||||
update:
|
||||
form:
|
||||
submit_button: Save changes
|
||||
proposal_ballots:
|
||||
title: "Votings"
|
||||
description_html: "The following citizen proposals that have reached the <strong>required supports</strong> and will be voted."
|
||||
date_title: "Dates of participation"
|
||||
date: "Soon we'll announce the date of vote these proposals."
|
||||
successfull: "This proposal has reached the required supports and will be voted in the %{voting}."
|
||||
voting: "next voting"
|
||||
featured_title: "#NextVoting"
|
||||
nothing_to_vote: "There is nothing to vote at the moment."
|
||||
info: "New proposals that have reached the voting phase."
|
||||
button: "I want to decide"
|
||||
proposal_notifications:
|
||||
new:
|
||||
title: "Send message"
|
||||
|
||||
@@ -209,6 +209,7 @@ es:
|
||||
open_data: Datos abiertos
|
||||
open_gov: Gobierno %{open}
|
||||
proposals: Propuestas
|
||||
proposal_ballot: Votaciones
|
||||
see_all: Ver propuestas
|
||||
spending_proposals: Presupuestos ciudadanos
|
||||
legislation:
|
||||
@@ -373,6 +374,17 @@ es:
|
||||
update:
|
||||
form:
|
||||
submit_button: Guardar cambios
|
||||
proposal_ballots:
|
||||
title: "Votaciones"
|
||||
description_html: "Las siguientes propuestas ciudadanas han alcanzado el <strong>número de apoyos necesarios</strong> y pasarán a votación."
|
||||
date_title: "Fechas de participación"
|
||||
date: "En breve anunciaremos la fecha de votación de estas propuestas."
|
||||
successfull: "Esta propuesta ha alcanzado los apoyos necesarios y pasará a la %{voting}."
|
||||
voting: "próxima votación"
|
||||
featured_title: "#PróximaVotación"
|
||||
nothing_to_vote: "No hay nada que votar en este momento."
|
||||
info: "Nuevas propuestas ciudadanas han llegado a la fase de votación."
|
||||
button: "Quiero decidir"
|
||||
proposal_notifications:
|
||||
new:
|
||||
title: "Enviar mensaje"
|
||||
|
||||
@@ -61,6 +61,8 @@ Rails.application.routes.draw do
|
||||
end
|
||||
end
|
||||
|
||||
resources :proposal_ballots, only: [:index]
|
||||
|
||||
resources :comments, only: [:create, :show], shallow: true do
|
||||
member do
|
||||
post :vote
|
||||
|
||||
@@ -150,7 +150,7 @@ tags = Faker::Lorem.words(25)
|
||||
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
|
||||
proposal = Proposal.create!(author: author,
|
||||
title: Faker::Lorem.sentence(3).truncate(60),
|
||||
question: Faker::Lorem.sentence(3),
|
||||
question: Faker::Lorem.sentence(3) + "?",
|
||||
summary: Faker::Lorem.sentence(3),
|
||||
responsible_name: Faker::Name.name,
|
||||
external_url: Faker::Internet.url,
|
||||
@@ -169,7 +169,7 @@ tags = ActsAsTaggableOn::Tag.where(kind: 'category')
|
||||
description = "<p>#{Faker::Lorem.paragraphs.join('</p><p>')}</p>"
|
||||
proposal = Proposal.create!(author: author,
|
||||
title: Faker::Lorem.sentence(3).truncate(60),
|
||||
question: Faker::Lorem.sentence(3),
|
||||
question: Faker::Lorem.sentence(3) + "?",
|
||||
summary: Faker::Lorem.sentence(3),
|
||||
responsible_name: Faker::Name.name,
|
||||
external_url: Faker::Internet.url,
|
||||
|
||||
87
db/schema.rb
87
db/schema.rb
@@ -78,6 +78,91 @@ ActiveRecord::Schema.define(version: 20160803154011) do
|
||||
|
||||
add_index "banners", ["hidden_at"], name: "index_banners_on_hidden_at", using: :btree
|
||||
|
||||
create_table "budget_ballot_lines", force: :cascade do |t|
|
||||
t.integer "ballot_id"
|
||||
t.integer "investment_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "budget_id"
|
||||
t.integer "group_id"
|
||||
t.integer "heading_id"
|
||||
end
|
||||
|
||||
add_index "budget_ballot_lines", ["ballot_id"], name: "index_budget_ballot_lines_on_ballot_id", using: :btree
|
||||
add_index "budget_ballot_lines", ["investment_id"], name: "index_budget_ballot_lines_on_investment_id", using: :btree
|
||||
|
||||
create_table "budget_ballots", force: :cascade do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "budget_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "budget_groups", force: :cascade do |t|
|
||||
t.integer "budget_id"
|
||||
t.string "name", limit: 50
|
||||
end
|
||||
|
||||
add_index "budget_groups", ["budget_id"], name: "index_budget_groups_on_budget_id", using: :btree
|
||||
|
||||
create_table "budget_headings", force: :cascade do |t|
|
||||
t.integer "budget_id"
|
||||
t.integer "geozone_id"
|
||||
t.string "name", limit: 50
|
||||
t.integer "price", limit: 8
|
||||
end
|
||||
|
||||
create_table "budget_investments", force: :cascade do |t|
|
||||
t.integer "author_id"
|
||||
t.integer "administrator_id"
|
||||
t.string "title"
|
||||
t.text "description"
|
||||
t.string "external_url"
|
||||
t.integer "price", limit: 8
|
||||
t.string "feasibility", limit: 15, default: "undecided"
|
||||
t.text "price_explanation"
|
||||
t.text "unfeasibility_explanation"
|
||||
t.text "internal_comments"
|
||||
t.boolean "valuation_finished", default: false
|
||||
t.integer "valuator_assignments_count", default: 0
|
||||
t.integer "price_first_year", limit: 8
|
||||
t.string "duration"
|
||||
t.datetime "hidden_at"
|
||||
t.integer "cached_votes_up", default: 0
|
||||
t.integer "comments_count", default: 0
|
||||
t.integer "confidence_score", default: 0, null: false
|
||||
t.integer "physical_votes", default: 0
|
||||
t.tsvector "tsv"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.integer "heading_id"
|
||||
t.string "responsible_name"
|
||||
end
|
||||
|
||||
add_index "budget_investments", ["administrator_id"], name: "index_budget_investments_on_administrator_id", using: :btree
|
||||
add_index "budget_investments", ["author_id"], name: "index_budget_investments_on_author_id", using: :btree
|
||||
add_index "budget_investments", ["heading_id"], name: "index_budget_investments_on_heading_id", using: :btree
|
||||
add_index "budget_investments", ["tsv"], name: "index_budget_investments_on_tsv", using: :gin
|
||||
|
||||
create_table "budget_valuator_assignments", force: :cascade do |t|
|
||||
t.integer "valuator_id"
|
||||
t.integer "investment_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "budget_valuator_assignments", ["investment_id"], name: "index_budget_valuator_assignments_on_investment_id", using: :btree
|
||||
|
||||
create_table "budgets", force: :cascade do |t|
|
||||
t.string "name", limit: 30
|
||||
t.text "description"
|
||||
t.string "currency_symbol", limit: 10
|
||||
t.string "phase", limit: 15, default: "on_hold"
|
||||
t.boolean "valuating", default: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "campaigns", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "track_id"
|
||||
@@ -378,6 +463,7 @@ ActiveRecord::Schema.define(version: 20160803154011) do
|
||||
t.integer "proposals_count", default: 0
|
||||
t.integer "spending_proposals_count", default: 0
|
||||
t.string "kind"
|
||||
t.integer "budget/investments_count", default: 0
|
||||
end
|
||||
|
||||
add_index "tags", ["debates_count"], name: "index_tags_on_debates_count", using: :btree
|
||||
@@ -484,6 +570,7 @@ ActiveRecord::Schema.define(version: 20160803154011) do
|
||||
t.integer "user_id"
|
||||
t.string "description"
|
||||
t.integer "spending_proposals_count", default: 0
|
||||
t.integer "budget_investments_count", default: 0
|
||||
end
|
||||
|
||||
add_index "valuators", ["user_id"], name: "index_valuators_on_user_id", using: :btree
|
||||
|
||||
57
spec/features/proposal_ballots_spec.rb
Normal file
57
spec/features/proposal_ballots_spec.rb
Normal file
@@ -0,0 +1,57 @@
|
||||
# coding: utf-8
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'Proposal ballots' 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 are listed in the proposal ballots index' do
|
||||
successfull_proposals = create_successfull_proposals
|
||||
|
||||
visit proposal_ballots_path
|
||||
|
||||
successfull_proposals.each do |proposal|
|
||||
expect(page).to have_content(proposal.title)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -192,6 +192,11 @@ module CommonActions
|
||||
create(:debate, :with_confidence_score, cached_votes_up: 80)]
|
||||
end
|
||||
|
||||
def create_successfull_proposals
|
||||
[create(:proposal, title: "Winter is coming", question: "Do you speak it?", cached_votes_up: Proposal.votes_needed_for_success + 100),
|
||||
create(:proposal, title: "Fire and blood", question: "You talking to me?", cached_votes_up: Proposal.votes_needed_for_success + 1)]
|
||||
end
|
||||
|
||||
def create_archived_proposals
|
||||
[create(:proposal, title: "This is an expired proposal", created_at: Setting["months_to_archive_proposals"].to_i.months.ago),
|
||||
create(:proposal, title: "This is an oldest expired proposal", created_at: (Setting["months_to_archive_proposals"].to_i + 2).months.ago)]
|
||||
|
||||
Reference in New Issue
Block a user