From 0e8746299dcd0a7b6d7a210ca1558f932dca7088 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Salvador=20P=C3=A9rez=20Garc=C3=ADa?= Date: Wed, 18 Jul 2018 16:50:51 +0200 Subject: [PATCH] Fixes #232 In proposal's dashboard, inside community section, the latests topics has been replaced by latest messages. --- app/models/community.rb | 6 +++++- app/views/proposals_dashboard/_comment.html.erb | 10 ++++++++++ app/views/proposals_dashboard/_topic.html.erb | 8 -------- app/views/proposals_dashboard/community.html.erb | 6 +++--- config/locales/en/general.yml | 2 +- config/locales/es/general.yml | 2 +- 6 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 app/views/proposals_dashboard/_comment.html.erb delete mode 100644 app/views/proposals_dashboard/_topic.html.erb 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/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') %>

    <% end %> diff --git a/config/locales/en/general.yml b/config/locales/en/general.yml index 8ff50b829..fadb75182 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: diff --git a/config/locales/es/general.yml b/config/locales/es/general.yml index 3c2d6fdd9..91a461d55 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: