Skip to content

Commit 1583fa4

Browse files
committed
Merge branch 'release/24.07.0'
2 parents 9b0a0a7 + bd5f554 commit 1583fa4

File tree

50 files changed

+1880
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1880
-79
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

7+
## [24.07.0] - 2024-09-18
8+
### Added
9+
- Preprints Affiliation Project - FE Release
10+
- My Preprints Page: preprint card and paginated public preprint list
11+
712
## [24.06.0] - 2024-08-21
813
### Added
914
- Misc bug and a11y fixes

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}}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { render } from '@ember/test-helpers';
2+
import { hbs } from 'ember-cli-htmlbars';
3+
import { setupMirage } from 'ember-cli-mirage/test-support';
4+
import { setupIntl, TestContext } from 'ember-intl/test-support';
5+
import { setupRenderingTest } from 'ember-qunit';
6+
import { module, test } from 'qunit';
7+
8+
import { OsfLinkRouterStub } from 'ember-osf-web/tests/integration/helpers/osf-link-router-stub';
9+
10+
module('Integration | Component | preprint-card', hooks => {
11+
setupRenderingTest(hooks);
12+
setupMirage(hooks);
13+
setupIntl(hooks);
14+
15+
hooks.beforeEach(function(this: TestContext) {
16+
this.store = this.owner.lookup('service:store');
17+
this.intl = this.owner.lookup('service:intl');
18+
});
19+
20+
test('it renders', async function(this: TestContext, assert) {
21+
this.owner.unregister('service:router');
22+
this.owner.register('service:router', OsfLinkRouterStub);
23+
const preprint = server.create('preprint', {
24+
tags: ['a', 'b', 'c'],
25+
description: 'Through the night',
26+
});
27+
server.create('contributor', { preprint, index: 0, bibliographic: true });
28+
server.create('contributor', { preprint, index: 1, bibliographic: true });
29+
server.create('contributor', { preprint, index: 2, bibliographic: true });
30+
const preprintModel = await this.store.findRecord(
31+
'preprint', preprint.id, { include: ['bibliographic_contributors'] },
32+
);
33+
this.set('preprint', preprintModel);
34+
35+
await render(hbs`
36+
<Preprints::-Components::PreprintCard
37+
@preprint={{this.preprint}}
38+
@showTags={{true}}
39+
/>
40+
`);
41+
assert.dom('[data-test-preprint-title]').exists('Preprint title exists');
42+
assert.dom('[data-test-preprint-title]').hasText(preprintModel.title, 'Node title is corrent');
43+
assert.dom('[data-test-contributors-label]').exists('Contributors label exists');
44+
assert.dom('[data-test-contributors-label]').hasText(
45+
this.intl.t('node_card.contributors'),
46+
'Contributors label is correct',
47+
);
48+
});
49+
});
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { tagName } from '@ember-decorators/component';
2+
import Component from '@ember/component';
3+
import config from 'ember-osf-web/config/environment';
4+
5+
import { layout } from 'ember-osf-web/decorators/component';
6+
import Preprint from 'ember-osf-web/models/preprint';
7+
import pathJoin from 'ember-osf-web/utils/path-join';
8+
import { Permission } from 'ember-osf-web/models/osf-model';
9+
10+
import template from './template';
11+
import styles from './styles';
12+
13+
const { OSF: { url: baseURL } } = config;
14+
15+
@layout(template, styles)
16+
@tagName('')
17+
export default class PreprintCard extends Component {
18+
19+
preprint?: Preprint;
20+
delete?: (preprint: Preprint) => void;
21+
showTags = false;
22+
readOnly = false;
23+
24+
searchUrl = pathJoin(baseURL, 'search');
25+
26+
get shouldShowUpdateButton() {
27+
return this.preprint && this.preprint.currentUserPermissions.includes(Permission.Admin);
28+
}
29+
30+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
// stylelint-disable max-nesting-depth, selector-max-compound-selectors
2+
3+
.preprint-card {
4+
width: 100%;
5+
margin: 1px 0;
6+
7+
.card-contents {
8+
display: block;
9+
flex-direction: row;
10+
position: relative;
11+
display: block;
12+
padding: 10px 15px;
13+
margin-bottom: -1px;
14+
15+
.heading {
16+
display: flex;
17+
flex-direction: column;
18+
flex-wrap: wrap;
19+
justify-content: flex-start;
20+
align-items: flex-start;
21+
width: 100%;
22+
23+
:global .ember-content-placeholders-heading__title {
24+
height: 1em;
25+
margin-top: 5px;
26+
margin-bottom: 5px;
27+
28+
&:first-child {
29+
width: 100%;
30+
}
31+
}
32+
}
33+
}
34+
}
35+
36+
.label-danger {
37+
background-color: $brand-danger;
38+
}
39+
40+
.heading > span {
41+
line-height: 1.5;
42+
}
43+
44+
.label-info {
45+
background-color: darken($brand-info, 15%);
46+
}
47+
48+
.label-primary {
49+
background-color: #337ab7;
50+
}
51+
52+
.label {
53+
padding: 0.2em 0.6em 0.3em;
54+
font-size: 75%;
55+
font-weight: 700;
56+
color: #fff;
57+
text-align: center;
58+
white-space: nowrap;
59+
vertical-align: baseline;
60+
border-radius: 0.25em;
61+
display: block;
62+
margin-top: 5px;
63+
}
64+
65+
.osf-link {
66+
margin-left: 5px;
67+
margin-top: 2px;
68+
font-weight: bold;
69+
}
70+
71+
.osf-link.mobile {
72+
margin-left: 0;
73+
}
74+
75+
.body {
76+
width: 80%;
77+
78+
&.mobile {
79+
width: 90%;
80+
}
81+
}
82+
83+
dl {
84+
margin-bottom: 10px;
85+
86+
div {
87+
display: flex;
88+
89+
dt {
90+
width: 110px;
91+
margin-right: 5px;
92+
}
93+
94+
dd {
95+
flex: 1;
96+
}
97+
}
98+
}
99+
100+
.tags {
101+
margin-top: 2px;
102+
}
103+
104+
.link {
105+
composes: Button from 'osf-components/components/button/styles.scss';
106+
composes: SecondaryButton from 'osf-components/components/button/styles.scss';
107+
composes: MediumButton from 'osf-components/components/button/styles.scss';
108+
109+
&:hover {
110+
text-decoration: none !important;
111+
}
112+
}
113+
114+
.list-group-item-heading {
115+
margin-top: 0;
116+
margin-bottom: 5px;
117+
}
118+
119+
.update-button {
120+
color: $color-text-blue-dark;
121+
}

0 commit comments

Comments
 (0)