diff --git a/Gemfile b/Gemfile index 1819992d3..e61e92e25 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ gem 'turbolinks' gem 'sprockets', '~> 3.6.3' gem 'devise', '~> 3.5.7' +gem 'devise_security_extension' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' gem 'omniauth' @@ -41,7 +42,7 @@ gem 'ckeditor', '~> 4.2.0' gem 'invisible_captcha', '~> 0.9.1' gem 'cancancan' gem 'social-share-button' -gem 'initialjs-rails', '0.2.0.1' +gem 'initialjs-rails', '0.2.0.4' gem 'unicorn', '~> 5.1.0' gem 'paranoia' gem 'rinku', require: 'rails_rinku' @@ -79,7 +80,7 @@ group :development, :test do gem 'i18n-tasks' gem 'capistrano', '3.5.0', require: false gem "capistrano-bundler", '1.1.4', require: false - gem "capistrano-rails", '1.1.7', require: false + gem "capistrano-rails", '1.1.8', require: false gem "capistrano-rvm", require: false gem 'capistrano3-delayed-job', '~> 1.0' gem "bullet" diff --git a/Gemfile.lock b/Gemfile.lock index 121d7b86e..68570d756 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -51,7 +51,7 @@ GEM safely_block (>= 0.1.1) user_agent_parser uuidtools - airbrussh (1.0.2) + airbrussh (1.1.1) sshkit (>= 1.6.1, != 1.7.0) akami (1.3.1) gyoku (>= 0.4.0) @@ -70,7 +70,7 @@ GEM bullet (5.2.0) activesupport (>= 3.0.0) uniform_notifier (~> 1.10.0) - byebug (9.0.5) + byebug (9.0.6) cancancan (1.15.0) capistrano (3.5.0) airbrussh (>= 1.0.0) @@ -81,8 +81,8 @@ GEM capistrano-bundler (1.1.4) capistrano (~> 3.1) sshkit (~> 1.2) - capistrano-harrow (0.5.2) - capistrano-rails (1.1.7) + capistrano-harrow (0.5.3) + capistrano-rails (1.1.8) capistrano (~> 3.1) capistrano-bundler (~> 1.1) capistrano-rvm (0.1.2) @@ -120,7 +120,7 @@ GEM term-ansicolor (~> 1.3) thor (~> 0.19.1) tins (>= 1.6.0, < 2) - daemons (1.2.3) + daemons (1.2.4) dalli (2.7.6) database_cleaner (1.5.3) debug_inspector (0.0.2) @@ -138,6 +138,9 @@ GEM warden (~> 1.2.3) devise-async (0.10.2) devise (>= 3.2, < 4.0) + devise_security_extension (0.10.0) + devise (>= 3.0.0, < 4.0) + railties (>= 3.2.6, < 5.0) diff-lcs (1.2.5) docile (1.1.5) easy_translate (0.5.0) @@ -176,7 +179,7 @@ GEM geocoder (1.3.7) globalid (0.3.7) activesupport (>= 4.1.0) - groupdate (3.0.1) + groupdate (3.0.2) activesupport (>= 3) gyoku (1.3.1) builder (>= 2.1.2) @@ -196,8 +199,8 @@ GEM parser (>= 2.2.3.0) term-ansicolor (>= 1.3.2) terminal-table (>= 1.5.1) - initialjs-rails (0.2.0.1) - railties (>= 3.1, < 5.0) + initialjs-rails (0.2.0.4) + railties (>= 3.1, < 6.0) invisible_captcha (0.9.1) rails jquery-rails (4.1.1) @@ -228,14 +231,14 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) - minitest (5.9.0) + minitest (5.9.1) multi_json (1.12.1) multi_xml (0.5.5) multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (3.2.0) - newrelic_rpm (3.16.0.318) + newrelic_rpm (3.16.3.323) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) @@ -315,7 +318,7 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) raindrops (0.16.0) - rake (11.2.2) + rake (11.3.0) redcarpet (3.3.4) referer-parser (0.3.0) request_store (1.3.1) @@ -328,7 +331,7 @@ GEM rspec-core (~> 3.5.0) rspec-expectations (~> 3.5.0) rspec-mocks (~> 3.5.0) - rspec-core (3.5.1) + rspec-core (3.5.4) rspec-support (~> 3.5.0) rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) @@ -336,7 +339,7 @@ GEM rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.5.0) - rspec-rails (3.5.1) + rspec-rails (3.5.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -386,7 +389,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.11.1) + sshkit (1.11.3) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) term-ansicolor (1.3.2) @@ -408,7 +411,7 @@ GEM tilt (>= 1.4, < 3) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (3.0.1) + uglifier (3.0.2) execjs (>= 0.3.0, < 3) unicorn (5.1.0) kgio (~> 2.6) @@ -447,7 +450,7 @@ DEPENDENCIES cancancan capistrano (= 3.5.0) capistrano-bundler (= 1.1.4) - capistrano-rails (= 1.1.7) + capistrano-rails (= 1.1.8) capistrano-rvm capistrano3-delayed-job (~> 1.0) capybara @@ -460,6 +463,7 @@ DEPENDENCIES delayed_job_active_record (~> 4.1.0) devise (~> 3.5.7) devise-async + devise_security_extension email_spec factory_girl_rails faker @@ -468,7 +472,7 @@ DEPENDENCIES fuubar groupdate i18n-tasks - initialjs-rails (= 0.2.0.1) + initialjs-rails (= 0.2.0.4) invisible_captcha (~> 0.9.1) jquery-rails jquery-ui-rails @@ -506,4 +510,4 @@ DEPENDENCIES whenever BUNDLED WITH - 1.12.5 + 1.13.1 diff --git a/README.md b/README.md index 2690b84a7..b6c10b878 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ cd consul bundle install cp config/database.yml.example config/database.yml cp config/secrets.yml.example config/secrets.yml -rake db:create bin/rake db:setup bin/rake db:dev_seed RAILS_ENV=test rake db:setup diff --git a/README_ES.md b/README_ES.md index 6051f1343..6f0f413ec 100644 --- a/README_ES.md +++ b/README_ES.md @@ -34,7 +34,6 @@ cd consul bundle install cp config/database.yml.example config/database.yml cp config/secrets.yml.example config/secrets.yml -rake db:create bin/rake db:setup bin/rake db:dev_seed RAILS_ENV=test rake db:setup 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/images/ballot_tiny.gif b/app/assets/images/ballot_tiny.gif new file mode 100644 index 000000000..976d37591 Binary files /dev/null and b/app/assets/images/ballot_tiny.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/layout.scss b/app/assets/stylesheets/layout.scss index b99f0300a..c180735eb 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -732,6 +732,56 @@ form { // 07. Callout // ----------- +.callout-slide { + animation-duration: 1s; + -webkit-animation-duration: 1s; + animation-fill-mode: both; + -webkit-animation-fill-mode: both; + animation-name: slide; + -webkit-animation-name: slide; +} + +@-webkit-keyframes slide { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slide { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.notice-container { + min-width: $line-height*12; + position: absolute; + right: 24px; + top: 24px; + + .notice { + height: $line-height*4; + + .notice-text { + width: 95%; + } + } +} + .callout { font-size: $small-font-size; diff --git a/app/assets/stylesheets/participation.scss b/app/assets/stylesheets/participation.scss index ffe08617f..efd385c19 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 @@ -269,6 +270,21 @@ } } +.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); + } + + p { + font-size: $small-font-size; + } +} + // 02. New participation // --------------------- @@ -548,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; } } @@ -574,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); } @@ -732,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); @@ -750,7 +766,7 @@ right: -1px; border-width: 13px 13px 0 0; - @include breakpoint(small) { + @include breakpoint(medium) { content: ""; } } @@ -762,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; @@ -771,7 +787,7 @@ } } - @include breakpoint(small) { + @include breakpoint(medium) { .like, .unlike { span.percentage { @@ -790,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); @@ -808,7 +824,7 @@ right: -1px; border-width: 13px 13px 0 0; - @include breakpoint(small) { + @include breakpoint(medium) { content: ""; } } @@ -819,7 +835,7 @@ padding-top: rem-calc(12); vertical-align: top; - @include breakpoint(small) { + @include breakpoint(medium) { display: block; float: none; margin-left: 0; @@ -840,7 +856,7 @@ min-height: rem-calc(180); padding-top: 0; - @include breakpoint(small) { + @include breakpoint(medium) { padding-top: $line-height*1.5; } @@ -929,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) { @@ -1029,3 +1046,112 @@ } } } + +// 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_tiny.gif") no-repeat; + background-position: 75% 0; + position: relative; + + h2, a:hover h2 { + color: #FFD200 !important; + } + + p { + color: white; + } + + @include breakpoint(medium) { + margin-left: 0 !important; + margin-right: 0 !important; + } + + @include breakpoint(large) { + background: #2D3E50 image-url("ballot.gif") no-repeat; + background-position: 90% 0; + } +} + +.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/concerns/commentable_actions.rb b/app/controllers/concerns/commentable_actions.rb index 3a79238ea..3f4398797 100644 --- a/app/controllers/concerns/commentable_actions.rb +++ b/app/controllers/concerns/commentable_actions.rb @@ -12,7 +12,7 @@ module CommentableActions @tag_cloud = tag_cloud @banners = Banner.with_active - + set_resource_votes(@resources) set_resources_instance end 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 578395ab3..ede5b0f5d 100644 --- a/app/controllers/proposals_controller.rb +++ b/app/controllers/proposals_controller.rb @@ -12,7 +12,7 @@ class ProposalsController < ApplicationController invisible_captcha only: [:create, :update], honeypot: :subtitle - has_orders %w{hot_score confidence_score created_at relevance}, only: :index + has_orders %w{hot_score confidence_score created_at relevance archival_date}, only: :index has_orders %w{most_voted newest oldest}, only: :show load_and_authorize_resource @@ -26,8 +26,10 @@ class ProposalsController < ApplicationController end def index_customization + discard_archived load_retired - load_featured + load_proposal_ballots + load_featured unless @proposal_successfull_exists end def vote @@ -80,6 +82,10 @@ class ProposalsController < ApplicationController @featured_proposals_votes = current_user ? current_user.proposal_votes(proposals) : {} end + def discard_archived + @resources = @resources.not_archived unless @current_order == "archival_date" + end + def load_retired if params[:retired].present? @resources = @resources.retired @@ -90,11 +96,15 @@ class ProposalsController < ApplicationController end def load_featured - @featured_proposals = Proposal.all.sort_by_confidence_score.limit(3) if (!@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?) + @featured_proposals = Proposal.not_archived.sort_by_confidence_score.limit(3) if (!@advanced_search_terms && @search_terms.blank? && @tag_filter.blank? && params[:retired].blank?) if @featured_proposals.present? set_featured_proposal_votes(@featured_proposals) @resources = @resources.where('proposals.id NOT IN (?)', @featured_proposals.map(&:id)) 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 9a92a8d18..7bd4b7a92 100644 --- a/app/models/proposal.rb +++ b/app/models/proposal.rb @@ -44,9 +44,13 @@ class Proposal < ActiveRecord::Base scope :sort_by_random, -> { reorder("RANDOM()") } scope :sort_by_relevance, -> { all } scope :sort_by_flags, -> { order(flags_count: :desc, updated_at: :desc) } + scope :sort_by_archival_date, -> { archived.sort_by_confidence_score } + scope :archived, -> { where("proposals.created_at <= ?", Setting["months_to_archive_proposals"].to_i.months.ago)} + scope :not_archived, -> { where("proposals.created_at > ?", Setting["months_to_archive_proposals"].to_i.months.ago)} 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 @@ -119,7 +123,7 @@ class Proposal < ActiveRecord::Base end def register_vote(user, vote_value) - if votable_by?(user) + if votable_by?(user) && !archived? vote_by(voter: user, vote: vote_value) end end @@ -155,6 +159,14 @@ 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 + def notifications proposal_notifications end diff --git a/app/models/user.rb b/app/models/user.rb index 60bc2364a..916c3d0b9 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,8 +2,8 @@ class User < ActiveRecord::Base include Verification - devise :database_authenticatable, :registerable, :confirmable, - :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :async + devise :database_authenticatable, :registerable, :confirmable, :recoverable, :rememberable, + :trackable, :validatable, :omniauthable, :async, :password_expirable, :secure_validatable acts_as_voter acts_as_paranoid column: :hidden_at 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/devise/password_expired/show.html.erb b/app/views/devise/password_expired/show.html.erb new file mode 100644 index 000000000..33dc82f71 --- /dev/null +++ b/app/views/devise/password_expired/show.html.erb @@ -0,0 +1,13 @@ +

<%= t("devise.password_expired.expire_password") %>

+ +<%= form_for(resource, :as => resource_name, :url => [resource_name, :password_expired], :html => { :method => :put }) do |f| %> + + <%= f.password_field :current_password %>

+ + <%= f.label t("devise.password_expired.new_password") %> + <%= f.password_field :password, label: false %>

+ + <%= f.password_field :password_confirmation %>

+ +

<%= f.submit t("devise.password_expired.change_password") %>

+<% end %> \ No newline at end of file diff --git a/app/views/direct_messages/show.html.erb b/app/views/direct_messages/show.html.erb index 30a771a39..8d0f62d84 100644 --- a/app/views/direct_messages/show.html.erb +++ b/app/views/direct_messages/show.html.erb @@ -13,6 +13,6 @@

<%= @direct_message.title %>

-

<%= @direct_message.body %>

+

<%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %>

diff --git a/app/views/layouts/_flash.html.erb b/app/views/layouts/_flash.html.erb index d07259c5c..9f55b449a 100644 --- a/app/views/layouts/_flash.html.erb +++ b/app/views/layouts/_flash.html.erb @@ -1,10 +1,12 @@ <% flash.each do |flash_key, flash_message| %> -
-
+
+
- <%= flash_message %> +
+ <%= flash_message %> +
<% end %> diff --git a/app/views/mailer/direct_message_for_receiver.html.erb b/app/views/mailer/direct_message_for_receiver.html.erb index 2523f3502..ac86b994a 100644 --- a/app/views/mailer/direct_message_for_receiver.html.erb +++ b/app/views/mailer/direct_message_for_receiver.html.erb @@ -3,9 +3,9 @@ <%= @direct_message.title %> -

- <%= @direct_message.body %> -

+
+ <%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %> +
diff --git a/app/views/mailer/direct_message_for_sender.html.erb b/app/views/mailer/direct_message_for_sender.html.erb index 4cf832414..127526cf4 100644 --- a/app/views/mailer/direct_message_for_sender.html.erb +++ b/app/views/mailer/direct_message_for_sender.html.erb @@ -9,7 +9,7 @@ <%= @direct_message.title %> -

- <%= @direct_message.body %> -

+
+ <%= simple_format text_with_links(@direct_message.body), {}, sanitize: false %> +
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 70c2b9c89..2c7bb272a 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") %> @@ -50,11 +52,26 @@
-
- <%= render 'votes', - { proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %> +
+ <% 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") %>

+
+ <% else %> +
+ <%= render 'votes', + { proposal: proposal, vote_url: vote_proposal_path(proposal, value: 'yes') } %> +
+ <% 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 @@ + diff --git a/app/views/proposals/index.html.erb b/app/views/proposals/index.html.erb index 6f6516890..5efa3e24c 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -30,8 +30,10 @@ <% if has_banners %> <%= 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 3a9869d83..5cb7867af 100644 --- a/app/views/proposals/show.html.erb +++ b/app/views/proposals/show.html.erb @@ -102,11 +102,23 @@