UX: Unify reviewable scores + history

This commit is contained in:
Robin Ward 2019-04-09 16:43:08 -04:00
parent 103918af0f
commit 9ebfdaa356
8 changed files with 45 additions and 21 deletions

View File

@ -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>
{{/component}}
{{/if}}
</div>

View File

@ -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-percentage
agreed=rs.agree_stats.agreed
disagreed=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}}
&mdash;
{{/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}}

View File

@ -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}}

View File

@ -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;
}
}
}

View File

@ -180,7 +180,8 @@ protected
def meta_types
{
created_by: 'user',
target_created_by: 'user'
target_created_by: 'user',
reviewed_by: 'user'
}
end

View File

@ -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_at
has_one :user, serializer: BasicUserSerializer, root: 'users'
has_one :score_type, serializer: ReviewableScoreTypeSerializer
has_one :reviewable_conversation, serializer: ReviewableConversationSerializer
has_one :reviewed_by, serializer: BasicUserSerializer, root: 'users'
def agree_stats
{

View File

@ -25,7 +25,6 @@ class ReviewableSerializer < ApplicationSerializer
has_many :editable_fields, serializer: ReviewableEditableFieldSerializer, embed: :objects
has_many :reviewable_scores, serializer: ReviewableScoreSerializer
has_many :bundled_actions, serializer: ReviewableBundledActionSerializer
has_many :reviewable_histories, serializer: ReviewableHistorySerializer
# Used to keep track of our payload attributes
class_attribute :_payload_for_serialization

View File

@ -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"