Merge pull request #233 from medialab-prado/issue_232

Fixes #232
This commit is contained in:
Juan Salvador Pérez García
2018-07-19 11:18:54 +02:00
committed by GitHub
9 changed files with 25 additions and 22 deletions

View File

@@ -27,7 +27,11 @@ class Community < ActiveRecord::Base
end
def comments_count
Comment.where(commentable: topics).count
comments.count
end
def comments
Comment.where(commentable: topics)
end
def debates_count

View File

@@ -39,6 +39,7 @@ class Poll < ActiveRecord::Base
scope :overlaping_with, lambda { |poll|
where('? < ends_at and ? >= starts_at', poll.starts_at.beginning_of_day, poll.ends_at.end_of_day)
.where.not(id: poll.id)
.where(related: poll.related)
}
scope :sort_for_list, -> { order(:geozone_restricted, :starts_at, :name) }

View File

@@ -19,11 +19,9 @@
<div class="card-section text-center">
<% if poll.incoming? %>
<%= link_to 'Editar encuesta', edit_proposal_dashboard_poll_path(proposal, poll), class: 'button hollow' %>
<%= link_to t('.edit_poll'), edit_proposal_dashboard_poll_path(proposal, poll), class: 'button hollow' %>
<% else %>
<a href='#' class="button">
<%= t('.view_responses') %>
</a>
<%= link_to t('.view_responses'), proposal_dashboard_poll_path(proposal, poll), class: 'button' %>
<% end %>
</div>
<div class="card-section">

View File

@@ -1,7 +1,3 @@
<%= link_to t("admin.polls.edit.title"),
edit_proposal_dashboard_poll_path(proposal, poll),
class: "button hollow float-right" %>
<h2 class="inline-block">
<%= poll.name %>
</h2>

View File

@@ -0,0 +1,10 @@
<li>
<%= comment.body %>
<p class="help-text">
<%= comment.commentable.title %>
-
<%= l(comment.updated_at.to_date) %>
-
<%= comment.author.name %>
</p>
</li>

View File

@@ -1,8 +0,0 @@
<li>
<strong><%= topic.title %></strong>
<p class="help-text">
<%= l(topic.updated_at.to_date) %>
-
<%= topic.author.name %>
</p>
</li>

View File

@@ -27,13 +27,13 @@
</div>
</div>
<% if proposal.community.topics.any? %>
<% if proposal.community.comments.any? %>
<div class="action-title">
<h5><%= t('.latest_topics') %></h5>
<h5><%= t('.latest_comments') %></h5>
<hr>
</div>
<ul>
<%= render partial: 'topic', collection: proposal.community.topics %>
<%= render partial: 'comment', collection: proposal.community.comments.sort_by_newest.limit(5) %>
</ul>
<% end %>

View File

@@ -560,7 +560,7 @@ en:
participants: Participants
debates: Debates
comments: Comments
latest_topics: Latest topics
latest_comments: Latest messages
dashboard:
polls:
index:
@@ -577,6 +577,7 @@ en:
one: "%{count} response"
other: "%{count} responses"
view_responses: View responses
edit_poll: Edit survey
show_results: Show results
show_results_help: If you check this box the results will be public and all users will be able to see them
form:

View File

@@ -560,7 +560,7 @@ es:
participants: Participantes
debates: Debates
comments: Comentarios
latest_topics: Últimos debates
latest_comments: Últimos mensajes
dashboard:
polls:
index:
@@ -577,6 +577,7 @@ es:
one: "%{count} respuesta"
other: "%{count} respuestas"
view_responses: Ver respuestas
edit_poll: Editar encuesta
show_results: Mostrar resultados
show_results_help: Si marcas esta casilla los resultados serán públicos y todos los usuarios podrán verlos
form: