Skip to content

Commit

Permalink
Merge branch 'release/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescdavis committed Apr 9, 2019
2 parents 03cc149 + 336d6fa commit b23dd8b
Show file tree
Hide file tree
Showing 31 changed files with 2,977 additions and 311 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.10.0] - 2019-04-09
### Added
- Preprint withdrawals

## [0.9.1] - 2019-03-11
### Fixed
- pass all links instead of just download link to file-renderer component
Expand Down Expand Up @@ -34,6 +38,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [0.7.0] - 2018-09-04
### Added
- Custom dimensions to `trackPage` for Google Analytics
- Tombstone for withdrawn preprints
- Withdrawn section to moderation list
- Ability to withdraw from `preprint-detail` page

### Fixed
- Use `name` field for contributors on preprint-detail page
Expand Down
3 changes: 3 additions & 0 deletions app/components/action-feed-entry/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ const SUBMIT = 'submit';
const ACCEPT = 'accept';
const REJECT = 'reject';
const EDIT_COMMENT = 'edit_comment';
const WITHDRAW = 'withdraw';

const ICONS = Object.freeze({
[SUBMIT]: 'fa-hourglass-o',
[ACCEPT]: 'fa-check-circle-o',
[REJECT]: 'fa-times-circle-o',
[WITHDRAW]: 'fa-times-circle-o',
[EDIT_COMMENT]: 'fa-comment-o',
});

Expand All @@ -19,6 +21,7 @@ const CLASS_NAMES = Object.freeze({
[ACCEPT]: 'accept-icon',
[REJECT]: 'reject-icon',
[EDIT_COMMENT]: 'edit-comment-icon',
[WITHDRAW]: 'reject-icon',
});

/**
Expand Down
10 changes: 8 additions & 2 deletions app/components/moderation-base/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,20 @@ export default Component.extend({
store: service(),

providerName: alias('theme.provider.name'),

tabs: computed('theme.reviewableStatusCounts.pending', function() {
tabs: computed('theme.{reviewableStatusCounts.pending,requestStatusCounts.pending}', function() {
return [
{
nameKey: 'global.submissions',
route: 'preprints.provider.moderation',
hasCount: true,
count: this.get('theme.reviewableStatusCounts.pending'),
},
{
nameKey: 'global.withdrawalRequests',
route: 'preprints.provider.withdrawals',
hasCount: true,
count: this.get('theme.requestStatusCounts.pending'),
},
{
nameKey: 'global.moderators',
route: 'preprints.provider.moderators',
Expand All @@ -40,4 +45,5 @@ export default Component.extend({
},
];
}),

});
25 changes: 22 additions & 3 deletions app/components/moderation-list-row/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ const submittedOnLabel = {
ltDay: 'components.moderationListRow.submission.submitted',
};

const withdrawnOnLabel = {
gtDay: 'components.moderationListRow.submission.withdrawnOn',
ltDay: 'components.moderationListRow.submission.withdrawn',
};

const ACTION_LABELS = Object.freeze({
[ACCEPTED]: {
gtDay: 'components.moderationListRow.submission.acceptedOn',
Expand Down Expand Up @@ -74,11 +79,25 @@ export default Component.extend({
return i18n.t(labels, { timeDate: submitDate });
}),

// translations for withdrawn on label
withdrawnOnLabel: computed('submission.dateWithdrawn', function() {
const i18n = this.get('i18n');
const [withdrawnDate, gtDayWithdrawn] = this.formattedDateLabel(this.get('submission.dateWithdrawn'));
const dayValue = gtDayWithdrawn ? 'gtDay' : 'ltDay';
const labels = withdrawnOnLabel[dayValue];
return i18n.t(labels, { timeDate: withdrawnDate, moderatorName: this.get('latestActionCreator') });
}),

icon: computed('submission.reviewsState', function() {
return this.get(`iconClass.${this.get('submission.reviewsState')}`);
}),

didReceiveAttrs() {
this.iconClass = {
accepted: 'fa-check-circle-o accepted',
pending: 'fa-hourglass-o pending',
rejected: 'fa-times-circle-o rejected',
accepted: ['fa-check-circle-o accepted'],
pending: ['fa-hourglass-o pending'],
rejected: ['fa-times-circle-o rejected'],
withdrawn: ['fa-circle-o rejected', 'fa-minus rejected'],
};
this.get('fetchData').perform();
},
Expand Down
16 changes: 16 additions & 0 deletions app/components/moderation-list-row/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@
color: $color-action-accept;
}

.withdrawn {
color: $color-action-reject;

&:nth-child(2) {
font-size: 13px;
padding-left: 24px;
line-height: 2.5em;

@media screen and (max-width: 731px) {
font-size: 10px;
padding-left: 22px;
line-height: inherit;
}
}
}

.submission-info {
padding: 10px 20px;
color: $color-text-gray-dark;
Expand Down
24 changes: 16 additions & 8 deletions app/components/moderation-list-row/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@
{{else}}
{{#link-to 'preprints.provider.preprint-detail' theme.id submission.id}}
<div data-status={{submission.reviewsState}} local-class="flex-container">
<i class="fa fa-lg {{get iconClass submission.reviewsState}}" local-class="{{get iconClass submission.reviewsState}} status-icon"></i>
<span class="fa-stack">
{{#each icon as |class|}}
<i class="fa fa-lg {{class}} fa-stack-1x" local-class="{{submission.reviewsState}} status-icon"></i>
{{/each}}
</span>
<div title={{submission.title}} local-class="submission-info">
<div local-class="submission-title">{{submission.title}}</div>
<div local-class="submission-body">
<div>
{{submittedOnLabel}}
{{#each firstContributors as |contributor| ~}}
<li>{{contributor.users.fullName}}</li>
{{/each}}
{{#if (gt additionalContributors 0)}}
+ {{additionalContributors}}
{{#if (not-eq submission.reviewsState 'withdrawn')}}
{{submittedOnLabel}}
{{#each firstContributors as |contributor| ~}}
<li>{{contributor.users.fullName}}</li>
{{/each}}
{{#if (gt additionalContributors 0)}}
+ {{additionalContributors}}
{{/if}}
{{else}}
{{withdrawnOnLabel}}
{{/if}}
</div>
{{#if (not-eq submission.reviewsState 'pending')}}
{{#if (and (not-eq submission.reviewsState 'pending') (not-eq submission.reviewsState 'withdrawn'))}}
<div>{{reviewedOnLabel}}</div>
{{/if}}
</div>
Expand Down
60 changes: 42 additions & 18 deletions app/components/moderation-list/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,48 @@ export default Component.extend({
classNames: ['content'],

didReceiveAttrs() {
this.set('statusButtons', [
{
status: 'pending',
iconClass: 'fa-hourglass-o icon-pending',
labelKey: 'components.moderationList.pending',
},
{
status: 'accepted',
iconClass: 'fa-check-circle-o icon-accepted',
labelKey: 'components.moderationList.accepted',
},
{
status: 'rejected',
iconClass: 'fa-times-circle-o icon-rejected',
labelKey: 'components.moderationList.rejected',
},
]);

if (this.get('isSubmissions')) {
this.set('statusButtons', [
{
status: 'pending',
iconClass: ['fa-hourglass-o icon-pending'],
labelKey: 'components.moderationList.pending',
},
{
status: 'accepted',
iconClass: ['fa-check-circle-o icon-accepted'],
labelKey: 'components.moderationList.accepted',
},
{
status: 'rejected',
iconClass: ['fa-times-circle-o icon-rejected'],
labelKey: 'components.moderationList.rejected',
},
{
status: 'withdrawn',
iconClass: ['fa-circle-o icon-accepted', 'fa-minus icon-withdrawn'],
labelKey: 'components.moderationList.withdrawn',
},
]);
} else if (this.get('isRequests')) {
this.set('statusButtons', [
{
status: 'pending',
iconClass: ['fa-hourglass-o icon-pending'],
labelKey: 'components.moderationList.pending',
},
{
status: 'accepted',
iconClass: ['fa-check-circle-o icon-accepted'],
labelKey: 'components.moderationList.approved',
},
{
status: 'rejected',
iconClass: ['fa-times-circle-o icon-rejected'],
labelKey: 'components.moderationList.declined',
},
]);
}
this.set('sortOptions', [
{
sort: '-date_last_transitioned',
Expand Down
34 changes: 27 additions & 7 deletions app/components/moderation-list/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
outline: none;
padding: 6px 0;

@media screen and (max-width: $screen-small-tablet) {
@media screen and (max-width: 731px) {
font-size: 16px;
}

@media screen and (max-width: $screen-medium-small) {
@media screen and (max-width: 543px) {
font-size: 14px;
}

@media screen and (max-width: $screen-xs) {
@media screen and (max-width: 488px) {
display: block;
}
}
Expand All @@ -35,7 +35,7 @@
border: 1px solid $color-border;
padding: 10px 20px;

@media screen and (max-width: $screen-small-tablet) {
@media screen and (max-width: 731px) {
.moderation-list-heading {
padding-left: 20px;
}
Expand All @@ -48,20 +48,40 @@
:global(.icon-rejected) {
-webkit-text-stroke: 1px $color-bg-gray-light;
}

:global(.icon-withdrawn) {
-webkit-text-stroke: 1px $color-bg-gray-light;
}

:global(.fa-stack) {
line-height: 0.8em;
height: 1em;
width: 1em;
}

:global(.fa-minus) {
font-size: 14px;
line-height: 1.25em;

@media screen and (max-width: 731px) {
font-size: 10px;
line-height: inherit;
}
}

:global(.dropdown-toggle) {
color: $color-text-gray-dark;
text-decoration: none;

@media screen and (max-width: $screen-xs) {
@media screen and (max-width: 488px) {
margin-top: -2.3em;
}
}

:global(.dropdown-menu) {
background: $color-bg-gray-light;

@media screen and (max-width: $screen-xs) {
@media screen and (max-width: 488px) {
margin-top: -0.7em;
}

Expand All @@ -88,7 +108,7 @@
margin: 0;
margin-right: 20px;

@media screen and (max-width: $screen-small-tablet) {
@media screen and (max-width: 731px) {
margin-right: 1px;
}
}
Expand Down
38 changes: 34 additions & 4 deletions app/components/moderation-list/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,23 @@
<div local-class="reviews-list-heading">
{{#each statusButtons as |statusButton|}}
<button class="btn" local-class="reviews-btn-filter {{if (eq status statusButton.status) 'active-filter'}}"
{{action statusChanged statusButton.status}}>
<i class="fa {{statusButton.iconClass}}"></i>
<span>{{get theme.reviewableStatusCounts statusButton.status}}</span>
{{action statusChanged statusButton.status}}>
{{#if isSubmissions}}
<span class="fa-stack">
{{#each statusButton.iconClass as |class|}}
<i class="fa {{class}} fa-stack-1x"></i>
{{/each}}
</span>
<span>{{get theme.reviewableStatusCounts statusButton.status}}</span>
{{/if}}
{{#if isRequests}}
<span class="fa-stack">
{{#each statusButton.iconClass as |class|}}
<i class="fa {{class}} fa-stack-1x"></i>
{{/each}}
</span>
<span>{{get theme.requestStatusCounts statusButton.status}}</span>
{{/if}}
{{t statusButton.labelKey}}
</button>
{{/each}}
Expand All @@ -32,7 +46,7 @@
{{#if loading}}
{{moderation-list-row-skeleton}}
{{else}}
{{#if (eq submissions.length 0)}}
{{#if (and isSubmissions (eq submissions.length 0))}}
<div class="text-center p-v-md {{local-class 'moderation-list-row' from='reviews/components/moderation-list-row/styles'}}">
{{t 'components.moderationList.noSubmissions'}}
</div>
Expand All @@ -48,6 +62,22 @@
}}
</div>
{{/if}}
{{#if (and isRequests (eq requests.length 0))}}
<div class="text-center p-v-md {{local-class 'moderation-list-row' from='reviews/components/moderation-list-row/styles'}}">
{{t 'components.moderationList.noRequests'}}
</div>
{{else}}
{{#each requests as |request|}}
{{request-list-row request=request}}
{{/each}}
<div class="pull-right text-right">
{{pagination-pager
count=totalPages
current=page
change=(action pageChanged)
}}
</div>
{{/if}}
{{/if}}
</div>
</div>
Expand Down
Loading

0 comments on commit b23dd8b

Please sign in to comment.