Adds static featured debates
This commit is contained in:
@@ -929,12 +929,13 @@
|
||||
|
||||
.debate-featured {
|
||||
background: $votes-bg;
|
||||
margin: rem-calc(12) 0 !important;
|
||||
|
||||
.panel h3 a {
|
||||
color: #0D3F54;
|
||||
}
|
||||
|
||||
.info {
|
||||
.info, .info a {
|
||||
color: white !important;
|
||||
}
|
||||
|
||||
@@ -960,7 +961,6 @@
|
||||
}
|
||||
|
||||
.debate-featured, .proposal-featured {
|
||||
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
padding-left: 0;
|
||||
|
||||
@@ -12,24 +12,11 @@ class DebatesController < ApplicationController
|
||||
load_and_authorize_resource
|
||||
respond_to :html, :js
|
||||
|
||||
def index_customization
|
||||
@featured_debates = Debate.all.sort_by_confidence_score.limit(3) if (@search_terms.blank? && @tag_filter.blank?)
|
||||
if @featured_debates.present?
|
||||
set_featured_debate_votes(@featured_debates)
|
||||
@resources = @resources.where('debates.id NOT IN (?)', @featured_debates.map(&:id))
|
||||
end
|
||||
end
|
||||
|
||||
def vote
|
||||
@debate.register_vote(current_user, params[:value])
|
||||
set_debate_votes(@debate)
|
||||
end
|
||||
|
||||
def vote_featured
|
||||
@debate.register_vote(current_user, 'yes')
|
||||
set_featured_debate_votes(@debate)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def debate_params
|
||||
@@ -40,7 +27,4 @@ class DebatesController < ApplicationController
|
||||
Debate
|
||||
end
|
||||
|
||||
def set_featured_debate_votes(debates)
|
||||
@featured_debates_votes = current_user ? current_user.debate_votes(debates) : {}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<div id="<%= dom_id(debate) %>" class="debate-featured small-12 column">
|
||||
<div class="panel">
|
||||
<div class="content small-12 medium-9 left">
|
||||
<h3><%= link_to debate.title, debate %></h3>
|
||||
<div class="info">
|
||||
<span class="author">
|
||||
<% if debate.author.hidden? || debate.author.erased? %>
|
||||
<%= t("debates.show.author_deleted") %>
|
||||
<% else %>
|
||||
<%= debate.author.name %>
|
||||
<% end %>
|
||||
</span>
|
||||
<span> • </span>
|
||||
<%= t("debates.debate.votes", count: debate.total_votes) %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
27
app/views/debates/_featured_debates_static.html.erb
Normal file
27
app/views/debates/_featured_debates_static.html.erb
Normal file
@@ -0,0 +1,27 @@
|
||||
<div class="debate-featured small-12 column">
|
||||
<div class="panel">
|
||||
<div class="content small-12 left">
|
||||
<h3>
|
||||
<%= link_to "¿Y si cualquiera pudiera entrevistar a manuela carmena o los otros concejales?", "https://decide.madrid.es/debates/4299" %></h3>
|
||||
<div class="info">
|
||||
<span class="author">
|
||||
<%= link_to "ParticipaciónYTransparenciaAytoMadrid", "https://decide.madrid.es/users/52055"%>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="debate-featured small-12 column">
|
||||
<div class="panel">
|
||||
<div class="content small-12 left">
|
||||
<h3>
|
||||
<%= link_to "#Túpreguntas: carlos sánchez mato, concejal de economía y hacienda.", "https://decide.madrid.es/debates/4298" %></h3>
|
||||
<div class="info">
|
||||
<span class="author">
|
||||
<%= link_to "CARLOS SANCHEZ", "https://decide.madrid.es/users/13"%>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -44,23 +44,19 @@
|
||||
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
|
||||
</div>
|
||||
|
||||
<% if @featured_debates.present? %>
|
||||
<div id="featured-debates" class="row featured-debates-container">
|
||||
<div class="small-12 medium-3 column">
|
||||
<h2>
|
||||
<%= t("debates.index.featured_proposals_html") %>
|
||||
</h2>
|
||||
<span class="show-for-medium-up">
|
||||
<%= image_tag("featured_debates.jpg", size: "210x135") %>
|
||||
</span>
|
||||
</div>
|
||||
<div class="small-12 medium-9 column debates-list">
|
||||
<% @featured_debates.each do |featured_debate| %>
|
||||
<%= render "featured_debate", debate: featured_debate %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="featured-debates" class="row featured-debates-container">
|
||||
<div class="small-12 medium-3 column">
|
||||
<h2>
|
||||
<%= t("debates.index.featured_debates_html") %>
|
||||
</h2>
|
||||
<span class="show-for-medium-up">
|
||||
<%= image_tag("featured_debates.jpg", size: "210x135") %>
|
||||
</span>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="small-12 medium-9 column debates-list">
|
||||
<%= render "featured_debates_static", debate: @debate %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render @debates %>
|
||||
<%= paginate @debates %>
|
||||
|
||||
@@ -79,7 +79,7 @@ en:
|
||||
debates:
|
||||
index:
|
||||
title: "Debates"
|
||||
featured_proposals_html: "Featured<br>debates"
|
||||
featured_debates_html: "Featured<br>debates"
|
||||
start_debate: "Start a debate"
|
||||
select_order: "Order by"
|
||||
select_order_long: "You are viewing debates according to:"
|
||||
|
||||
@@ -79,7 +79,7 @@ es:
|
||||
debates:
|
||||
index:
|
||||
title: "Debates"
|
||||
featured_proposals_html: "Debates<br>destacados"
|
||||
featured_debates_html: "Debates<br>destacados"
|
||||
start_debate: "Empieza un debate"
|
||||
select_order: "Ordenar por"
|
||||
select_order_long: "Estás viendo los debates"
|
||||
|
||||
Reference in New Issue
Block a user