diff --git a/app/models/community.rb b/app/models/community.rb
index 9a18f3510..f1640c8e9 100644
--- a/app/models/community.rb
+++ b/app/models/community.rb
@@ -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
diff --git a/app/models/poll.rb b/app/models/poll.rb
index 756c01eec..f01960bd6 100644
--- a/app/models/poll.rb
+++ b/app/models/poll.rb
@@ -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) }
diff --git a/app/views/dashboard/polls/_poll.html.erb b/app/views/dashboard/polls/_poll.html.erb
index 3c6ff0b44..f437428ac 100644
--- a/app/views/dashboard/polls/_poll.html.erb
+++ b/app/views/dashboard/polls/_poll.html.erb
@@ -19,11 +19,9 @@
<% 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 %>
-
- <%= t('.view_responses') %>
-
+ <%= link_to t('.view_responses'), proposal_dashboard_poll_path(proposal, poll), class: 'button' %>
<% end %>
diff --git a/app/views/dashboard/polls/_poll_header.html.erb b/app/views/dashboard/polls/_poll_header.html.erb
index 2204f5e0f..7bc148ca5 100644
--- a/app/views/dashboard/polls/_poll_header.html.erb
+++ b/app/views/dashboard/polls/_poll_header.html.erb
@@ -1,7 +1,3 @@
-<%= link_to t("admin.polls.edit.title"),
- edit_proposal_dashboard_poll_path(proposal, poll),
- class: "button hollow float-right" %>
-
<%= poll.name %>
diff --git a/app/views/proposals_dashboard/_comment.html.erb b/app/views/proposals_dashboard/_comment.html.erb
new file mode 100644
index 000000000..4bb5bc88e
--- /dev/null
+++ b/app/views/proposals_dashboard/_comment.html.erb
@@ -0,0 +1,10 @@
+
+ <%= comment.body %>
+
+ <%= comment.commentable.title %>
+ -
+ <%= l(comment.updated_at.to_date) %>
+ -
+ <%= comment.author.name %>
+
+
diff --git a/app/views/proposals_dashboard/_topic.html.erb b/app/views/proposals_dashboard/_topic.html.erb
deleted file mode 100644
index becd154c6..000000000
--- a/app/views/proposals_dashboard/_topic.html.erb
+++ /dev/null
@@ -1,8 +0,0 @@
-
- <%= topic.title %>
-
- <%= l(topic.updated_at.to_date) %>
- -
- <%= topic.author.name %>
-
-
diff --git a/app/views/proposals_dashboard/community.html.erb b/app/views/proposals_dashboard/community.html.erb
index 6a4a1997c..54c15bf0e 100644
--- a/app/views/proposals_dashboard/community.html.erb
+++ b/app/views/proposals_dashboard/community.html.erb
@@ -27,13 +27,13 @@
-<% if proposal.community.topics.any? %>
+<% if proposal.community.comments.any? %>
-
<%= t('.latest_topics') %>
+ <%= t('.latest_comments') %>
- <%= render partial: 'topic', collection: proposal.community.topics %>
+ <%= render partial: 'comment', collection: proposal.community.comments.sort_by_newest.limit(5) %>
<% end %>
diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml
index 8ff50b829..519a9981a 100644
--- a/config/locales/en/general.yml
+++ b/config/locales/en/general.yml
@@ -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:
diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml
index 3c2d6fdd9..e4823db03 100644
--- a/config/locales/es/general.yml
+++ b/config/locales/es/general.yml
@@ -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: