diff --git a/app/assets/fonts/icons.eot b/app/assets/fonts/icons.eot
index f1420b532..c3c5d6289 100644
Binary files a/app/assets/fonts/icons.eot and b/app/assets/fonts/icons.eot differ
diff --git a/app/assets/fonts/icons.svg b/app/assets/fonts/icons.svg
index a7f352c4f..a548d9575 100644
--- a/app/assets/fonts/icons.svg
+++ b/app/assets/fonts/icons.svg
@@ -54,4 +54,8 @@
+
+
+
+
diff --git a/app/assets/fonts/icons.ttf b/app/assets/fonts/icons.ttf
index 16401c79b..6f938f863 100644
Binary files a/app/assets/fonts/icons.ttf and b/app/assets/fonts/icons.ttf differ
diff --git a/app/assets/fonts/icons.woff b/app/assets/fonts/icons.woff
index 83689755d..f3c31e804 100644
Binary files a/app/assets/fonts/icons.woff and b/app/assets/fonts/icons.woff differ
diff --git a/app/assets/images/ballot.gif b/app/assets/images/ballot.gif
new file mode 100644
index 000000000..18cf0717f
Binary files /dev/null and b/app/assets/images/ballot.gif differ
diff --git a/app/assets/stylesheets/icons.scss b/app/assets/stylesheets/icons.scss
index a92a3b61a..a4b0da4f7 100644
--- a/app/assets/stylesheets/icons.scss
+++ b/app/assets/stylesheets/icons.scss
@@ -172,3 +172,6 @@
.icon-arrow-right:before {
content: "\55";
}
+.icon-checkmark-circle:before {
+ content: "\59";
+}
diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss
index 2ab28f52d..7c8e6b477 100644
--- a/app/assets/stylesheets/participation.scss
+++ b/app/assets/stylesheets/participation.scss
@@ -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);
+ }
+ }
+}
diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb
index e077e5e8a..7d2149cad 100644
--- a/app/controllers/debates_controller.rb
+++ b/app/controllers/debates_controller.rb
@@ -22,6 +22,7 @@ class DebatesController < ApplicationController
def index_customization
@featured_debates = @debates.featured
+ @proposal_successfull_exists = Proposal.successfull.exists?
end
def show
diff --git a/app/controllers/proposal_ballots_controller.rb b/app/controllers/proposal_ballots_controller.rb
new file mode 100644
index 000000000..4e3e99671
--- /dev/null
+++ b/app/controllers/proposal_ballots_controller.rb
@@ -0,0 +1,8 @@
+class ProposalBallotsController < ApplicationController
+ skip_authorization_check
+
+ def index
+ @proposal_ballots = Proposal.successfull.sort_by_confidence_score
+ end
+
+end
diff --git a/app/controllers/proposals_controller.rb b/app/controllers/proposals_controller.rb
index 7b3ccafe7..ede5b0f5d 100644
--- a/app/controllers/proposals_controller.rb
+++ b/app/controllers/proposals_controller.rb
@@ -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
diff --git a/app/models/proposal.rb b/app/models/proposal.rb
index 91b01f785..fc3d10738 100644
--- a/app/models/proposal.rb
+++ b/app/models/proposal.rb
@@ -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
diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb
index 6809782b1..22d628c65 100644
--- a/app/views/debates/index.html.erb
+++ b/app/views/debates/index.html.erb
@@ -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 %>
diff --git a/app/views/proposal_ballots/_successfull_proposal.html.erb b/app/views/proposal_ballots/_successfull_proposal.html.erb
new file mode 100644
index 000000000..870e61605
--- /dev/null
+++ b/app/views/proposal_ballots/_successfull_proposal.html.erb
@@ -0,0 +1,13 @@
+
+
<%= link_to proposal.title, proposal %>
+
+ <% if proposal.author.hidden? || proposal.author.erased? %>
+ <%= t("proposals.show.author_deleted") %>
+ <% else %>
+ <%= proposal.author.name %>
+ <% end %>
+
+ •
+ <%= l proposal.created_at.to_date %>
+
+
diff --git a/app/views/proposal_ballots/index.html.erb b/app/views/proposal_ballots/index.html.erb
new file mode 100644
index 000000000..00a07fb9e
--- /dev/null
+++ b/app/views/proposal_ballots/index.html.erb
@@ -0,0 +1,35 @@
+
+
+
+
+ <%= t("proposal_ballots.title") %>
+
+
+ <%= t("proposal_ballots.description_html").html_safe %>
+
+
+
+
+
<%= t("proposal_ballots.date_title") %>
+
<%= t("proposal_ballots.date") %>
+
+
+
+
+
+
+
+ <% if @proposal_ballots.present? %>
+
+ <% @proposal_ballots.each do |proposal_for_vote| %>
+ <%= render "successfull_proposal", proposal: proposal_for_vote %>
+ <% end %>
+
+ <% else %>
+
+ <%= t("proposal_ballots.nothing_to_vote") %>
+
+ <% end %>
+
+
+
diff --git a/app/views/proposals/_proposal.html.erb b/app/views/proposals/_proposal.html.erb
index 4b6f27cbc..e35f9f496 100644
--- a/app/views/proposals/_proposal.html.erb
+++ b/app/views/proposals/_proposal.html.erb
@@ -1,10 +1,12 @@
-
+
Proposal.votes_needed_for_success) %>"
+ data-type="proposal">
+
-
<% cache [locale_and_user_status(proposal), 'index', proposal, proposal.author] do %>
<%= t("proposals.proposal.proposal") %>
@@ -51,7 +53,13 @@
- <% if proposal.archived? %>
+ <% if proposal.successfull? %>
+
+
+ <%= t("proposal_ballots.successfull",
+ voting: link_to(t("proposal_ballots.voting"), proposal_ballots_path)).html_safe %>
+
+ <% elsif proposal.archived? %>
<%= t("proposals.proposal.supports", count: proposal.total_votes) %>
<%= t("proposals.proposal.archived") %>
@@ -63,7 +71,6 @@
<% end %>
-
diff --git a/app/views/proposals/_proposal_ballots_banner.html.erb b/app/views/proposals/_proposal_ballots_banner.html.erb
new file mode 100644
index 000000000..df210a535
--- /dev/null
+++ b/app/views/proposals/_proposal_ballots_banner.html.erb
@@ -0,0 +1,9 @@
+
+ <%= link_to proposal_ballots_path do %>
+
+
+
<%= t("proposal_ballots.featured_title") %>
+
<%= t("proposal_ballots.info") %>
+
+ <% end %>
+
diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb
index 9e0da05a8..5efa3e24c 100644
--- a/app/views/proposals/index.html.erb
+++ b/app/views/proposals/index.html.erb
@@ -31,7 +31,9 @@
<%= render "shared/banner" %>
<% end %>
- <% if @featured_proposals.present? %>
+ <% if @proposal_successfull_exists %>
+ <%= render "proposal_ballots_banner" %>
+ <% elsif @featured_proposals.present? %>
diff --git a/app/views/proposals/show.html.erb b/app/views/proposals/show.html.erb
index 617c11d79..5cb7867af 100644
--- a/app/views/proposals/show.html.erb
+++ b/app/views/proposals/show.html.erb
@@ -102,19 +102,24 @@