Skip to content

Commit 59c97db

Browse files
committed
Merge branch 'release/24.04.0'
2 parents df27b3f + 429e66c commit 59c97db

File tree

23 files changed

+266
-99
lines changed

23 files changed

+266
-99
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ 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.04.0] - 2024-04-30
8+
### Added
9+
- Misc bug and a11y fixes
10+
711
## [24.03.0] - 2024-02-26
812
### Added
913
- Integrate Cedar Embeddable Editor for adding and editing metadata

app/preprints/detail/controller.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ export default class PrePrintsDetailController extends Controller {
8181
});
8282
}
8383

84+
get displayTitle(): string {
85+
if (this.model.preprint.isWithdrawn) {
86+
return this.intl.t('preprints.detail.withdrawn_title', {
87+
title: this.model.preprint.title,
88+
});
89+
}
90+
return this.model.preprint.title;
91+
}
92+
8493
private isAdmin(): boolean {
8594
// True if the current user has admin permissions for the node that contains the preprint
8695
return (this.model.preprint.currentUserPermissions).includes(Permission.Admin);

app/preprints/detail/route.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ import Ready from 'ember-osf-web/services/ready';
1717
import Theme from 'ember-osf-web/services/theme';
1818
import captureException from 'ember-osf-web/utils/capture-exception';
1919
import pathJoin from 'ember-osf-web/utils/path-join';
20+
import Intl from 'ember-intl/services/intl';
2021
import PrePrintsDetailController from './controller';
2122

23+
2224
/**
2325
* @module ember-preprints
2426
* @submodule routes
@@ -40,6 +42,7 @@ export default class PreprintsDetail extends Route {
4042
@service currentUser!: CurrentUser;
4143
@service metaTags!: MetaTags;
4244
@service ready!: Ready;
45+
@service intl!: Intl;
4346

4447
headTags?: HeadTagDef[];
4548

@@ -116,8 +119,12 @@ export default class PreprintsDetail extends Route {
116119
const doi = (identifiers as Identifier[]).find(identifier => identifier.category === 'doi');
117120
const image = 'engines-dist/registries/assets/img/osf-sharing.png';
118121

122+
const preprintTitle = preprint.isWithdrawn ?
123+
this.intl.t('preprints.detail.withdrawn_title', { title: preprint.title }) :
124+
preprint.title;
125+
119126
const metaTagsData = {
120-
title: preprint.title,
127+
title: preprintTitle,
121128
description: preprint.description,
122129
publishedDate: moment(preprint.datePublished).format('YYYY-MM-DD'),
123130
modifiedDate: moment(preprint.dateModified).format('YYYY-MM-DD'),

app/preprints/detail/template.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{page-title this.model.preprint.title replace=false}}
1+
{{page-title this.displayTitle replace=false}}
22

33

44
<div
@@ -9,7 +9,7 @@
99
>
1010
<div local-class='header-container'>
1111
<div local-class='preprint-title-container'>
12-
<h1 data-test-preprint-title>{{this.model.preprint.title}}</h1>
12+
<h1 data-test-preprint-title>{{this.displayTitle}}</h1>
1313
{{#unless this.model.preprint.isWithdrawn}}
1414
<div class='edit-preprint-button'>
1515
{{#if (and this.userIsContrib (not this.isPendingWithdrawal))}}

lib/analytics-page/addon/components/analytics-charts/component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,13 @@ export default class AnalyticsChart extends Component<AnalyticsChartArgs> {
298298
} else {
299299
const data: PopularPageDatum[] = this.args.chartsDataTaskInstance.value!.popular_pages as any;
300300
const aggregatedResults: { [name: string]: PopularPageDisplay } = {};
301+
301302
data.forEach(datum => {
302-
const displayDatum = this.popularPageDisplay(datum);
303-
const priorDisplay = aggregatedResults[displayDatum.name];
304-
if (priorDisplay) {
305-
priorDisplay.count += displayDatum.count;
303+
const cleanTitle = datum.title.replace(/^OSF \| /, '');
304+
const displayDatum = { name: cleanTitle, count: datum.count };
305+
306+
if (aggregatedResults[displayDatum.name]) {
307+
aggregatedResults[displayDatum.name].count += displayDatum.count;
306308
} else {
307309
aggregatedResults[displayDatum.name] = displayDatum;
308310
}

lib/osf-components/addon/components/carousel/component.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ export default class Carousel extends Component {
2222

2323
@action
2424
changeSlide(direction: string) {
25-
const activeSlide = this.carouselItems.findBy('active');
26-
const activeIndex = activeSlide!.index;
27-
let newIndex = direction === 'previous' ? activeIndex - 1 : activeIndex + 1;
25+
const activeIndex = this.carouselItems.findIndex(item => item.isActive);
26+
let newIndex = activeIndex;
2827

29-
if (newIndex > this.carouselItems.length - 1) {
30-
newIndex = 0;
31-
} else if (newIndex < 0) {
32-
newIndex = this.carouselItems.length - 1;
28+
if (direction === 'previous') {
29+
newIndex = activeIndex - 1 < 0 ? this.carouselItems.length - 1 : activeIndex - 1;
30+
} else if (direction === 'next') {
31+
newIndex = activeIndex + 1 >= this.carouselItems.length ? 0 : activeIndex + 1;
3332
}
3433

35-
this.carouselItems[activeIndex].set('isActive', false);
36-
this.carouselItems[newIndex].set('isActive', true);
34+
this.carouselItems.forEach((item, index) => {
35+
item.set('isActive', index === newIndex);
36+
});
3737
}
3838

3939
@action
Lines changed: 57 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,73 @@
1+
// stylelint-disable max-nesting-depth, selector-max-compound-selectors
2+
13
.carousel-container {
24
position: relative;
3-
}
45

5-
.dot-nav {
6-
margin: 0;
7-
padding: 0;
8-
list-style: none;
9-
text-align: center;
106

11-
li {
12-
display: inline-block;
13-
margin: 0 5px;
14-
width: 16px;
15-
height: 16px;
7+
.dot-nav {
8+
margin: 0;
9+
padding: 0;
10+
text-align: center;
11+
12+
13+
.dot-nav-item {
14+
display: inline-block;
15+
margin: 0 5px;
16+
width: 16px;
17+
height: 16px;
18+
background-color: #a5b3bd;
19+
border-radius: 50%;
20+
transition: background-color 0.1s;
21+
cursor: pointer;
22+
text-indent: -999px;
23+
overflow: hidden;
24+
25+
26+
&.current,
27+
&:hover {
28+
background-color: #fff;
29+
box-shadow: inset 0 0 0 2px #263947;
30+
}
31+
}
1632
}
1733

18-
button {
19-
left: 0;
34+
.item-list {
2035
width: 100%;
21-
height: 100%;
22-
border: 0;
23-
border-radius: 50%;
24-
background-color: #a5b3bd;
25-
text-indent: -999em;
26-
transition: background-color 0.1s;
27-
}
36+
padding: 0 15px;
2837

29-
.current button,
30-
button:hover {
31-
background-color: #fff;
32-
box-shadow: inset 0 0 0 2px #263947;
3338
}
34-
}
3539

36-
.item-list {
37-
width: 100%;
38-
padding: 0 15px;
39-
40-
li {
41-
display: none;
42-
height: inherit;
43-
animation-name: fade;
44-
animation-duration: 1s;
40+
.btn {
41+
position: absolute;
42+
top: 50%;
43+
transform: translateY(-50%);
44+
background: inherit;
45+
border: 0;
46+
cursor: pointer;
4547
}
46-
}
4748

48-
.arrow-previous {
49-
transform: rotate(180deg);
50-
}
49+
.arrow-previous {
50+
left: 0;
51+
transform: rotate(180deg);
52+
}
5153

52-
.btn {
53-
position: absolute;
54-
top: 50%;
55-
background: inherit;
56-
border: 0;
57-
}
54+
.btn-next {
55+
right: 0;
56+
}
5857

59-
.btn-next {
60-
right: 0;
61-
}
58+
.visually-hidden {
59+
position: absolute;
60+
width: 1px;
61+
height: 1px;
62+
margin: -1px;
63+
padding: 0;
64+
overflow: hidden;
65+
clip: rect(0, 0, 0, 0);
66+
border: 0;
67+
}
6268

63-
@keyframes fade {
64-
from { opacity: 0.4; }
65-
to { opacity: 1; }
69+
@keyframes fade {
70+
from { opacity: 0.4; }
71+
to { opacity: 1; }
72+
}
6673
}

lib/osf-components/addon/components/carousel/template.hbs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,32 +5,26 @@
55
...attributes
66
>
77
{{yield (hash header=(component 'carousel/x-header'))}}
8-
<ol data-test-dot-navigation local-class='dot-nav' role='tablist'>
8+
<div data-test-dot-navigation local-class='dot-nav' role='tablist'>
99
{{#each this.carouselItems as |item|}}
10-
<li
10+
<div
1111
data-test-navigation-item
1212
role='tab'
13-
local-class={{if item.isActive 'current' ''}}
13+
tabindex='0'
14+
local-class='dot-nav-item {{if item.isActive 'current'}}'
1415
aria-selected={{if item.isActive 'true' 'false'}}
16+
{{on 'click' (fn this.navClick item)}}
1517
>
16-
<Button
17-
data-test-navigation-button
18-
data-analytics-name='Go to slide {{item.slideIndex}}'
19-
data-slide={{item.index}}
20-
aria-label={{t 'osf-components.carousel.go_to_slide' slideIndex=item.slideIndex}}
21-
{{action this.navClick item}}
22-
>
23-
<span>{{item.slideIndex}}</span>
24-
{{#if item.isActive}}
25-
<span>{{t 'osf-components.carousel.current_slide'}}</span>
26-
{{/if}}
27-
</Button>
28-
</li>
18+
<span class='visually-hidden'>{{t 'osf-components.carousel.go_to_slide' slideIndex=item.slideIndex}}</span>
19+
{{#if item.isActive}}
20+
<span class='visually-hidden'>{{t 'osf-components.carousel.current_slide'}}</span>
21+
{{/if}}
22+
</div>
2923
{{/each}}
30-
</ol>
31-
<ul data-test-carousel-list local-class='item-list'>
24+
</div>
25+
<div data-test-carousel-list local-class='item-list'>
3226
{{yield (hash slide=(component 'carousel/x-item' register=(action this.register) allItems=this.carouselItems))}}
33-
</ul>
27+
</div>
3428
<Button
3529
data-test-carousel-button-previous
3630
data-analytics-name='Previous slide'
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// stylelint-disable selector-no-qualifying-type
2-
li.active {
2+
3+
4+
.item {
35
left: 0;
4-
display: block;
6+
display: none;
7+
8+
&.active {
9+
display: block;
10+
}
11+
512
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<li local-class={{if this.isActive 'active'}} ...attributes>{{yield}}</li>
1+
<div local-class='item {{if this.isActive 'active'}}' ...attributes>{{yield}}</div>

0 commit comments

Comments
 (0)