Adds featured debates
This commit is contained in:
BIN
app/assets/images/featured_debates.jpg
Normal file
BIN
app/assets/images/featured_debates.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -4,7 +4,7 @@
|
|||||||
// 02. New participation
|
// 02. New participation
|
||||||
// 03. Show participation
|
// 03. Show participation
|
||||||
// 04. List participation
|
// 04. List participation
|
||||||
// 05. Featured proposals
|
// 05. Featured
|
||||||
//
|
//
|
||||||
|
|
||||||
// 01. Votes and supports
|
// 01. Votes and supports
|
||||||
@@ -827,12 +827,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 05. Featured proposals
|
// 05. Featured
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
|
.featured-debates-container {
|
||||||
|
background: $votes-bg;
|
||||||
|
|
||||||
|
@media (min-width: $medium-breakpoint) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.debates-list {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.featured-proposals-container {
|
.featured-proposals-container {
|
||||||
background: #FED900;
|
background: #FED900;
|
||||||
margin: 0 !important;
|
|
||||||
|
|
||||||
@media (min-width: $medium-breakpoint) {
|
@media (min-width: $medium-breakpoint) {
|
||||||
margin-left: 0 !important;
|
margin-left: 0 !important;
|
||||||
@@ -841,14 +857,21 @@
|
|||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
color: $text;
|
color: $text;
|
||||||
font-size: rem-calc(24);
|
|
||||||
margin: rem-calc(12) 0 0;
|
|
||||||
position: relative;
|
|
||||||
text-transform: uppercase;
|
|
||||||
|
|
||||||
@media (min-width: $medium-breakpoint) {
|
@media (min-width: $medium-breakpoint) {
|
||||||
margin-bottom: rem-calc(27);
|
margin-bottom: rem-calc(27);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.featured-debates-container, .featured-proposals-container {
|
||||||
|
margin: 0 !important;
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: rem-calc(24);
|
||||||
|
margin: rem-calc(12) 0 0;
|
||||||
|
position: relative;
|
||||||
|
text-transform: uppercase;
|
||||||
|
|
||||||
.icon-proposals {
|
.icon-proposals {
|
||||||
font-size: rem-calc(20);
|
font-size: rem-calc(20);
|
||||||
@@ -858,34 +881,86 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.debates-list {
|
||||||
|
|
||||||
|
@media (min-width: $medium-breakpoint) {
|
||||||
|
border-left: 1px solid $votes-border;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
|
||||||
|
@media (min-width: $medium-breakpoint) {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.proposals-list {
|
.proposals-list {
|
||||||
margin: rem-calc(6) 0;
|
|
||||||
|
|
||||||
@media (min-width: $medium-breakpoint) {
|
@media (min-width: $medium-breakpoint) {
|
||||||
border-left: 1px solid #D2B400;
|
border-left: 1px solid #D2B400;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:after {
|
&:after {
|
||||||
content: none;
|
|
||||||
position: absolute;
|
|
||||||
display: block;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: #C9AF00 transparent transparent transparent;
|
border-color: #C9AF00 transparent transparent transparent;
|
||||||
bottom: rem-calc(-20);
|
|
||||||
border-left-width: 0;
|
|
||||||
border-right-color: transparent;
|
|
||||||
right: rem-calc(1);
|
|
||||||
border-width: rem-calc(14) rem-calc(14) 0 0;
|
|
||||||
|
|
||||||
@media (min-width: $medium-breakpoint) {
|
@media (min-width: $medium-breakpoint) {
|
||||||
content: " ";
|
content: " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.debates-list, .proposals-list {
|
||||||
|
margin: rem-calc(6) 0;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: none;
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
border-style: solid;
|
||||||
|
bottom: rem-calc(-20);
|
||||||
|
border-left-width: 0;
|
||||||
|
border-right-color: transparent;
|
||||||
|
right: rem-calc(1);
|
||||||
|
border-width: rem-calc(14) rem-calc(14) 0 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.debate-featured {
|
||||||
|
background: $votes-bg;
|
||||||
|
|
||||||
|
.panel h3 a {
|
||||||
|
color: #0D3F54;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.proposal-featured {
|
.proposal-featured {
|
||||||
background: #FED900;
|
background: #FED900;
|
||||||
|
|
||||||
|
.panel h3 a {
|
||||||
|
color: $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
.info {
|
||||||
|
color: #806C00 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
height: rem-calc(60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.debate-featured, .proposal-featured {
|
||||||
|
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
@@ -903,7 +978,6 @@
|
|||||||
|
|
||||||
a {
|
a {
|
||||||
clear: both;
|
clear: both;
|
||||||
color: $text;
|
|
||||||
display: block;
|
display: block;
|
||||||
font-size: rem-calc(14);
|
font-size: rem-calc(14);
|
||||||
line-height: $line-height;
|
line-height: $line-height;
|
||||||
@@ -921,14 +995,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
height: rem-calc(60);
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.info {
|
|
||||||
color: #806C00 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.supports {
|
.supports {
|
||||||
@include supports;
|
@include supports;
|
||||||
background: none;
|
background: none;
|
||||||
|
|||||||
@@ -12,11 +12,24 @@ class DebatesController < ApplicationController
|
|||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
respond_to :html, :js
|
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
|
def vote
|
||||||
@debate.register_vote(current_user, params[:value])
|
@debate.register_vote(current_user, params[:value])
|
||||||
set_debate_votes(@debate)
|
set_debate_votes(@debate)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def vote_featured
|
||||||
|
@debate.register_vote(current_user, 'yes')
|
||||||
|
set_featured_debate_votes(@debate)
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def debate_params
|
def debate_params
|
||||||
@@ -27,4 +40,7 @@ class DebatesController < ApplicationController
|
|||||||
Debate
|
Debate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_featured_debate_votes(debates)
|
||||||
|
@featured_debates_votes = current_user ? current_user.debate_votes(debates) : {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
18
app/views/debates/_featured_debate.html.erb
Normal file
18
app/views/debates/_featured_debate.html.erb
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<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>
|
||||||
@@ -44,6 +44,24 @@
|
|||||||
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
|
<%= link_to t("debates.index.start_debate"), new_debate_path, class: 'button radius expand' %>
|
||||||
</div>
|
</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>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= render @debates %>
|
<%= render @debates %>
|
||||||
<%= paginate @debates %>
|
<%= paginate @debates %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ en:
|
|||||||
debates:
|
debates:
|
||||||
index:
|
index:
|
||||||
title: "Debates"
|
title: "Debates"
|
||||||
|
featured_proposals_html: "Featured<br>debates"
|
||||||
start_debate: "Start a debate"
|
start_debate: "Start a debate"
|
||||||
select_order: "Order by"
|
select_order: "Order by"
|
||||||
select_order_long: "You are viewing debates according to:"
|
select_order_long: "You are viewing debates according to:"
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ es:
|
|||||||
debates:
|
debates:
|
||||||
index:
|
index:
|
||||||
title: "Debates"
|
title: "Debates"
|
||||||
|
featured_proposals_html: "Debates<br>destacados"
|
||||||
start_debate: "Empieza un debate"
|
start_debate: "Empieza un debate"
|
||||||
select_order: "Ordenar por"
|
select_order: "Ordenar por"
|
||||||
select_order_long: "Estás viendo los debates"
|
select_order_long: "Estás viendo los debates"
|
||||||
|
|||||||
Reference in New Issue
Block a user