A platform for community discussion. Free, open, simple.
UX: Unify reviewable scores + history
Robin Ward9ebfdaa3560e
diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-item.hbsindex 80495bcb63e..7631c0d1244 100644--- a/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs+++ b/app/assets/javascripts/discourse/templates/components/reviewable-item.hbs@@ -30,10 +30,7 @@</div>{{else}}{{#component reviewableComponent reviewable=reviewable tagName=''}}- <div class='reviewable-scores-and-history'>- {{reviewable-scores reviewable=reviewable tagName=''}}- {{reviewable-histories histories=reviewable.reviewable_histories tagName=''}}- </div>+ {{reviewable-scores reviewable=reviewable tagName=''}}{{/component}}{{/if}}</div>diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-score.hbsindex 7d8a72e8165..2a75664f9c9 100644--- a/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs+++ b/app/assets/javascripts/discourse/templates/components/reviewable-score.hbs@@ -1,4 +1,7 @@<tr class='reviewable-score'>+ <td>+ {{format-date rs.created_at}}+ </td><td>{{d-icon rs.score_type.icon}}{{title}}@@ -9,8 +12,6 @@{{avatar rs.user imageSize="tiny"}}{{rs.user.username}}{{/user-link}}- </td>- <td>{{user-flag-percentageagreed=rs.agree_stats.agreeddisagreed=rs.agree_stats.disagreed@@ -19,10 +20,21 @@<td>{{reviewable-status rs.status}}</td>+ <td class='reviewed-by'>+ {{#if rs.reviewed_by}}+ {{#user-link user=rs.reviewed_by}}+ {{avatar rs.reviewed_by imageSize="tiny"}}+ {{rs.reviewed_by.username}}+ {{/user-link}}+ {{format-date rs.reviewed_at}}+ {{else}}+ —+ {{/if}}+ </td></tr>{{#if rs.reviewable_conversation}}<tr>- <td colspan='3'>+ <td colspan='4'><div class='reviewable-conversation'>{{#each rs.reviewable_conversation.conversation_posts as |p index|}}{{reviewable-conversation-post post=p index=index}}diff --git a/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs b/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbsindex e811554285a..3ea03a10daf 100644--- a/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs+++ b/app/assets/javascripts/discourse/templates/components/reviewable-scores.hbs@@ -1,5 +1,14 @@{{#if reviewable.reviewable_scores}}<table class='reviewable-scores'>+ <thead>+ <tr>+ <th>{{i18n "review.scores.date"}}</th>+ <th>{{i18n "review.scores.type"}}</th>+ <th>{{i18n "review.scores.submitted_by"}}</th>+ <th>{{i18n "review.scores.status"}}</th>+ <th>{{i18n "review.scores.reviewed_by"}}</th>+ </tr>+ </thead><tbody>{{#each reviewable.reviewable_scores as |rs|}}{{reviewable-score rs=rs reviewable=reviewable}}diff --git a/app/assets/stylesheets/common/base/reviewables.scss b/app/assets/stylesheets/common/base/reviewables.scssindex 9a5821fe7d6..9d86d3a2053 100644--- a/app/assets/stylesheets/common/base/reviewables.scss+++ b/app/assets/stylesheets/common/base/reviewables.scss@@ -224,15 +224,15 @@margin-top: 1em;}-.reviewable-scores-and-history {- display: inline-block;- margin-top: 1em;-}-.reviewable-scores,.reviewable-histories {min-width: 50%;+ .reviewed-by {+ .date {+ margin-left: 0.5em;+ }+ }.user {display: flex;align-items: center;@@ -251,6 +251,11 @@line-height: $line-height-medium;}+ thead {+ th {+ white-space: nowrap;+ }+ }tbody {border-width: 1px;td {@@ -268,7 +273,7 @@}> tr > th,> tr > td {- padding: 0.5em;+ padding: 0.5em 1em 0.5em 0.5em;}}}diff --git a/app/controllers/reviewables_controller.rb b/app/controllers/reviewables_controller.rbindex 274e4bac74c..f91dcbf6cf2 100644--- a/app/controllers/reviewables_controller.rb+++ b/app/controllers/reviewables_controller.rb@@ -180,7 +180,8 @@ protecteddef meta_types{created_by: 'user',- target_created_by: 'user'+ target_created_by: 'user',+ reviewed_by: 'user'}enddiff --git a/app/serializers/reviewable_score_serializer.rb b/app/serializers/reviewable_score_serializer.rbindex 89165996c5f..c58568944cd 100644--- a/app/serializers/reviewable_score_serializer.rb+++ b/app/serializers/reviewable_score_serializer.rb@@ -2,10 +2,11 @@ require_dependency 'reviewable_score_type_serializer'class ReviewableScoreSerializer < ApplicationSerializer- attributes :id, :score, :agree_stats, :status+ attributes :id, :score, :agree_stats, :status, :created_at, :reviewed_athas_one :user, serializer: BasicUserSerializer, root: 'users'has_one :score_type, serializer: ReviewableScoreTypeSerializerhas_one :reviewable_conversation, serializer: ReviewableConversationSerializer+ has_one :reviewed_by, serializer: BasicUserSerializer, root: 'users'def agree_stats{diff --git a/app/serializers/reviewable_serializer.rb b/app/serializers/reviewable_serializer.rbindex ba86ea9917d..571993449ef 100644--- a/app/serializers/reviewable_serializer.rb+++ b/app/serializers/reviewable_serializer.rb@@ -25,7 +25,6 @@ class ReviewableSerializer < ApplicationSerializerhas_many :editable_fields, serializer: ReviewableEditableFieldSerializer, embed: :objectshas_many :reviewable_scores, serializer: ReviewableScoreSerializerhas_many :bundled_actions, serializer: ReviewableBundledActionSerializer- has_many :reviewable_histories, serializer: ReviewableHistorySerializer# Used to keep track of our payload attributesclass_attribute :_payload_for_serializationdiff --git a/config/locales/client.en.yml b/config/locales/client.en.ymlindex 7833fe2a51f..9b4c0520c79 100644--- a/config/locales/client.en.yml+++ b/config/locales/client.en.yml@@ -426,13 +426,13 @@ en:category: "Category:"conversation:view_full: "view full conversation"- history:- title: "History"- edited: "Edited"scores:- description: "Description"- score: "Score"+ date: "Date"+ type: "Type"+ status: "Status"submitted_by: "Submitted By"+ reviewed_by: "Reviewed By"+statuses:pending:title: "Pending"