From db6f82fa4c3ead60645255ce358cc22bc7ea1e31 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Cabeza Date: Wed, 14 Sep 2016 11:09:36 +0200 Subject: [PATCH] Moves banner to a partial and includes it on debates index --- app/controllers/debates_controller.rb | 1 + app/views/debates/index.html.erb | 6 +++++- app/views/proposals/_proposal_ballots_banner.html.erb | 9 +++++++++ app/views/proposals/index.html.erb | 10 +--------- config/locales/en.yml | 2 +- config/locales/es.yml | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 app/views/proposals/_proposal_ballots_banner.html.erb diff --git a/app/controllers/debates_controller.rb b/app/controllers/debates_controller.rb index e077e5e8a..48aeb9167 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_ballots = Proposal.successfull.sort_by_confidence_score end def show diff --git a/app/views/debates/index.html.erb b/app/views/debates/index.html.erb index 6809782b1..ce9978172 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_ballots.present? %> + <%= render "proposals/proposal_ballots_banner" %> + <% end %> + + <% unless @tag_filter || @search_terms || !has_featured? || @proposal_ballots.present? %> <%= render "featured_debates" %> <% 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 e314b7ad4..d4756b87b 100644 --- a/app/views/proposals/index.html.erb +++ b/app/views/proposals/index.html.erb @@ -32,15 +32,7 @@ <% end %> <% if @proposal_ballots.present? %> - + <%= render "proposal_ballots_banner" %> <% elsif @featured_proposals.present? %>