Skip to content

Commit f7bcde1

Browse files
bp-cosJohnetordoffbrianjgeigercslzchen
authored
[ENG-5028] [ENG-5919] Preprints Affiliation Project PR (FE) (#2321)
* Added a new relationship for the affiliated institutions * updates to the serializers * Updates to the component and initial tests * Added a trait * Added more tests and updates * Added more tests to the scenario * Updates to persist affiliated institutions * Fixed the tests * Added logic for mobile and to only display if there are affilitiated institutions * added functionality that all preprints are selected on create mode. Added a test * Added a description for the institutional affiliations * Added a label for accessibility * add affiliated institution details to preprints * add affiliated institution links and logs to the preprint detail page. * improve logo size and shape * update css to new techniques * make links open in new tab * restrict image sizes * fix single quotes * add tests for preprint affiliations and clean up css * Added some test fixes * Add code for institutions preprint affiliations widget on reviews section * fix component to add title to css and conditional template * refactor to reviewsPage and fix linting error and tests * make Institutional affiliations label disappear if no institutions * add hover-text and simplify css * Updates to make affiliated institutions read-only and fixed a bug on edit * Fixed a test * Updated the logic on selecting and persisting of affiliated institutions * Fixed the tests * Added the ability to make the assertion page read-only for non-admins * Added the cancel button * add tooltip and make add contributor widget only visible to admins * Added a link test * Fixed a missed translation on a cancel button for mobile * Fixed the initial issue with read/write users and updated the tests * Added another test * Updated logic and tests to allow admin and write users access * Fixed a test with new mirage settings * Added logic to fix a bug on preprint edit flow with affiliated institutions * allow write contribs to add affiliations * improve permission handling * Updates to mirage to handle adding and removing affiliated institutions * reintroduce isAdmin * [ENG-5919] Feature/preprints affiliations merged to development (#2319) * fix preprint resubmission workflow * Update test for review-action model to reflect target relationship change * delete review-action relationship from child classes * ENG-6008: Add My Preprints route and page template * setup mirage route and view * change defaultSortKey attribute * Bump version no. Add CHANGELOG * create preprint card * fix date format * formatting changes * remove unnecessary controller and old logic * Add tests * remove unused classes and services * Moved changes to preprints-paginated-list branch * remove redundant pagination component * add usePlaceholders property * Don't double-add relationships * Removed the cancel button * Fixed some typos --------- Co-authored-by: John Tordoff <johnetordoff@gmail.com> Co-authored-by: Brian J. Geiger <bgeiger@pobox.com> Co-authored-by: Brian J. Geiger <bgeiger@cos.io> Co-authored-by: Longze Chen <cslzchen@gmail.com>
1 parent 5551456 commit f7bcde1

File tree

40 files changed

+1362
-56
lines changed

40 files changed

+1362
-56
lines changed

app/models/preprint.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import AbstractNodeModel from 'ember-osf-web/models/abstract-node';
55
import CitationModel from 'ember-osf-web/models/citation';
66
import PreprintRequestModel from 'ember-osf-web/models/preprint-request';
77
import { ReviewsState } from 'ember-osf-web/models/provider';
8+
import ReviewActionModel from 'ember-osf-web/models/review-action';
9+
import InstitutionModel from 'ember-osf-web/models/institution';
810

911
import ContributorModel from './contributor';
1012
import FileModel from './file';
@@ -81,6 +83,12 @@ export default class PreprintModel extends AbstractNodeModel {
8183
@belongsTo('preprint-provider', { inverse: 'preprints' })
8284
provider!: AsyncBelongsTo<PreprintProviderModel> & PreprintProviderModel;
8385

86+
@hasMany('institution')
87+
affiliatedInstitutions!: AsyncHasMany<InstitutionModel>;
88+
89+
@hasMany('review-action')
90+
reviewActions!: AsyncHasMany<ReviewActionModel>;
91+
8492
@hasMany('contributors', { inverse: 'preprint'})
8593
contributors!: AsyncHasMany<ContributorModel> & ContributorModel;
8694

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.osf-institution-link-flex {
2+
img {
3+
width: 35px;
4+
height: 35px;
5+
}
6+
7+
a {
8+
padding-bottom: 5px;
9+
}
10+
11+
.img-circle {
12+
border-radius: 50%;
13+
margin-right: 15px;
14+
}
15+
16+
.img-responsive {
17+
max-width: 100%;
18+
}
19+
20+
.img-horizontal {
21+
margin-top: 10px;
22+
}
23+
24+
.link-horizontal {
25+
display: inline;
26+
}
27+
28+
.link-vertical {
29+
display: block;
30+
}
31+
32+
}
33+
34+
.title {
35+
margin-top: 10px;
36+
font-weight: bold;
37+
font-size: 18px;
38+
padding-bottom: 10px;
39+
}
40+
41+
.content-container {
42+
width: 100%;
43+
margin-top: 20px;
44+
45+
h4 {
46+
margin-top: 10px;
47+
margin-bottom: 10px;
48+
font-weight: bold;
49+
}
50+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{#if @preprint.affiliatedInstitutions}}
2+
<div local-class='content-container'>
3+
<div local-class='title'>
4+
{{t 'preprints.detail.affiliated_institutions'}}
5+
</div>
6+
<div local-class='osf-institution-link-flex'>
7+
{{#each @preprint.affiliatedInstitutions as |institution|}}
8+
<OsfLink @href={{institution.links.html}} @target='_blank' local-class='{{if @isReviewPage 'link-horizontal'}}{{unless @isReviewPage 'link-vertical'}}'>
9+
<img
10+
data-test-preprint-institution-list={{institution.id}}
11+
local-class='img-circle img-responsive {{if @isReviewPage 'img-horizontal'}}'
12+
src={{institution.logoRoundedUrl}}
13+
alt={{institution.name}}
14+
>
15+
{{#if @isReviewPage}}
16+
<EmberTooltip>
17+
{{institution.name}}
18+
</EmberTooltip>
19+
{{else}}
20+
{{institution.name}}
21+
{{/if}}
22+
</OsfLink>
23+
{{/each}}
24+
</div>
25+
</div>
26+
{{/if}}

0 commit comments

Comments
 (0)