Skip to content

Commit e520109

Browse files
committed
Merge branch 'release/24.03.0'
2 parents 435f7a9 + 78338b0 commit e520109

File tree

140 files changed

+42431
-775
lines changed

Some content is hidden

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

140 files changed

+42431
-775
lines changed

CHANGELOG.md

Lines changed: 5 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.03.0] - 2024-02-26
8+
### Added
9+
- Integrate Cedar Embeddable Editor for adding and editing metadata
10+
711
## [24.02.0] - 2024-01-30
812
### Changed
913
- Update help links for licenses on draft registrations
@@ -1972,6 +1976,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
19721976
### Added
19731977
- Quick Files
19741978

1979+
[24.03.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/24.03.0
19751980
[24.02.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/24.02.0
19761981
[24.01.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/24.01.0
19771982
[23.15.3]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.15.3

app/adapters/cedar-metadata-record.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default class CedarMetadataRecordAdapter extends OsfAdapter {
4+
namespace = '_';
5+
}
6+
7+
declare module 'ember-data/types/registries/adapter' {
8+
export default interface AdapterRegistry {
9+
'cedar-metadata-record': CedarMetadataRecordAdapter;
10+
} // eslint-disable-line semi
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import OsfAdapter from './osf-adapter';
2+
3+
export default class CedarMetadataTemplateAdapter extends OsfAdapter {
4+
namespace = '_';
5+
}
6+
7+
declare module 'ember-data/types/registries/adapter' {
8+
export default interface AdapterRegistry {
9+
'cedar-metadata-template': CedarMetadataTemplateAdapter;
10+
} // eslint-disable-line semi
11+
}

app/config/environment.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ declare const config: {
2121
WATER_BUTLER_ENABLED: boolean;
2222
plauditWidgetUrl: string,
2323
environment: any;
24+
cedarConfig: any;
2425
lintOnBuild: boolean;
2526
testsEnabled: boolean;
2627
sourcemapsEnabled: boolean;
@@ -31,6 +32,39 @@ declare const config: {
3132
assetsPrefix: string;
3233
sentryDSN: string | null;
3334
googleTagManagerId: string | null;
35+
cedarConfig: {
36+
viewerConfig: {
37+
showHeader: boolean,
38+
showFooter: boolean,
39+
expandedSampleTemplateLinks: boolean,
40+
showSampleTemplateLinks: boolean,
41+
defaultLanguage: string,
42+
showTemplateData: boolean,
43+
showInstanceData: boolean,
44+
}
45+
editorConfig: {
46+
sampleTemplateLocationPrefix: string,
47+
loadSampleTemplateName: string,
48+
expandedSampleTemplateLinks: boolean,
49+
showTemplateRenderingRepresentation: boolean,
50+
showMultiInstanceInfo: boolean,
51+
expandedInstanceDataFull: boolean,
52+
expandedInstanceDataCore: boolean,
53+
expandedMultiInstanceInfo: boolean,
54+
expandedTemplateRenderingRepresentation: boolean,
55+
showInstanceDataFull: boolean,
56+
showTemplateSourceData: boolean,
57+
expandedTemplateSourceData: boolean,
58+
collapseStaticComponents: boolean,
59+
showStaticText: boolean,
60+
showInstanceDataCore: boolean,
61+
showHeader: boolean,
62+
showFooter: boolean,
63+
showInstanceDataFull: boolean,
64+
showTemplateSourceData: boolean,
65+
terminologyIntegratedSearchUrl: string,
66+
},
67+
}
3468
sentryOptions: {
3569
release?: string;
3670
ignoreErrors: string[];

app/guid-file/-components/file-detail-layout/styles.scss

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
1+
// stylelint-disable max-nesting-depth, selector-max-compound-selectors
2+
13
.container {
24
display: flex;
35
flex-direction: row;
46
flex-grow: 1;
57
}
68

79
.main-column {
8-
flex-grow: 3;
910
z-index: 1;
11+
width: 70%;
12+
min-width: 300px;
13+
14+
&.mobile {
15+
width: 100%;
16+
}
17+
18+
&.is-closed {
19+
flex: 1;
20+
width: calc(100% - 72px);
21+
}
1022

1123
h3 {
1224
text-overflow: ellipsis;
1325
overflow: hidden;
1426
white-space: nowrap;
15-
max-width: 70vw;
27+
width: 70%;
1628
}
1729
}
1830

@@ -22,25 +34,28 @@
2234
flex-basis: 300px;
2335
flex-direction: column;
2436
flex-grow: 1;
25-
width: 28vw;
37+
width: calc(30% - 72px);
38+
min-width: 400px;
2639

2740
&.is-closed {
2841
display: none;
2942
}
3043
}
3144

3245
.right-buttons {
33-
@media (max-width: 767px) {
34-
display: flex;
35-
flex-direction: row;
36-
justify-content: space-evenly;
37-
border-top: 1px solid #ddd;
38-
}
3946
flex-grow: 0;
4047
display: flex;
4148
flex-direction: column;
4249
border-left: 1px solid #ddd;
4350
z-index: 1;
51+
width: 72px;
52+
min-width: 72px;
53+
54+
&.mobile {
55+
flex-direction: row;
56+
width: 100%;
57+
margin-bottom: 10px;
58+
}
4459
}
4560

4661
.slide-in {

app/guid-file/-components/file-detail-layout/template.hbs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div local-class='container'>
22
{{#if @isMobile}}
3-
<div local-class='main-column'>
3+
<div local-class='main-column mobile'>
44
{{yield to='header'}}
5-
<div local-class='right-buttons'>
5+
<div local-class='right-buttons mobile'>
66
{{yield to='rightButtons'}}
77
</div>
88
<div>
@@ -14,7 +14,8 @@
1414
</div>
1515
</div>
1616
{{else}}
17-
<div local-class='main-column'>
17+
18+
<div local-class='main-column {{if @rightColumnClosed 'is-closed'}}'>
1819
{{yield to='header'}}
1920
{{yield to='body'}}
2021
</div>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
// stylelint-disable max-nesting-depth, selector-max-compound-selectors
2+
3+
.file-header-container {
4+
width: 100%;
5+
6+
.flex-container-row {
7+
width: 100%;
8+
display: flex;
9+
flex-direction: row;
10+
justify-content: space-between;
11+
padding: 0 20px 20px;
12+
13+
h2 {
14+
height: 40px;
15+
width: 70%;
16+
overflow: hidden;
17+
text-overflow: ellipsis;
18+
white-space: nowrap;
19+
}
20+
21+
.return-container {
22+
width: 30%;
23+
height: 70px;
24+
display: flex;
25+
flex-direction: row;
26+
justify-content: flex-end;
27+
align-items: center;
28+
}
29+
}
30+
31+
.project-link-header {
32+
padding-bottom: 5px;
33+
34+
.project-link {
35+
margin: 20px;
36+
}
37+
}
38+
39+
&.mobile {
40+
padding: 0;
41+
42+
.flex-container-row {
43+
padding: 0;
44+
flex-direction: column;
45+
46+
h2,
47+
.return-container {
48+
width: 100%;
49+
height: fit-content;
50+
justify-content: flex-start;
51+
}
52+
53+
h2 {
54+
margin-top: 0;
55+
}
56+
}
57+
58+
.project-link-header {
59+
.project-link {
60+
margin: 0;
61+
}
62+
}
63+
}
64+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<div local-class='file-header-container {{if @isMobile 'mobile'}}'>
2+
<h3 local-class='project-link-header'>
3+
<OsfLink
4+
data-test-project-link
5+
data-analytics-name='Linked project'
6+
local-class='project-link'
7+
@route={{if (eq @model.fileModel.target.type 'registrations') 'guid-registration' 'guid-node'}}
8+
@models={{array @model.fileModel.target.id}}
9+
>
10+
{{@model.fileModel.target.title}}
11+
</OsfLink>
12+
</h3>
13+
<div local-class='flex-container-row'>
14+
<h2 data-test-filename>
15+
{{@model.displayName}}
16+
{{#if @viewedVersion}}
17+
({{t 'general.version'}}: {{@viewedVersion}})
18+
{{/if}}
19+
</h2>
20+
<div local-class='return-container'>
21+
{{#if @displayFileActions}}
22+
<FileActionsMenu
23+
@item={{@model}}
24+
@onDelete={{@onDelete}}
25+
@allowRename={{false}}
26+
@addonsEnabled={{@model.fileModel.target.addonsEnabled}}
27+
/>
28+
{{else}}
29+
<OsfLink
30+
data-test-return-to-metadata
31+
data-analytics-name='Return from cedar metadata template selection'
32+
@route='guid-file.index'
33+
@models={{array @model.fileModel.id}}
34+
>
35+
{{ t 'file-detail.metadata.return-to-file' fileName=@model.displayName}}
36+
</OsfLink>
37+
{{/if}}
38+
</div>
39+
</div>
40+
</div>

app/guid-file/controller.ts renamed to app/guid-file/index/controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export default class GuidFile extends Controller {
4040

4141
@action
4242
toggleRevisions() {
43-
if (!this.model.waterButlerRevisions) {
44-
taskFor(this.model.getRevisions).perform();
43+
if (!this.model.file.waterButlerRevisions) {
44+
taskFor(this.model.file.getRevisions).perform();
4545
}
4646
if (this.isMobile) {
4747
this.revisionsOpened = true;
@@ -113,6 +113,6 @@ export default class GuidFile extends Controller {
113113

114114
@action
115115
onDelete() {
116-
this.router.transitionTo('guid-node.files', this.model.fileModel.target.get('id'));
116+
this.router.transitionTo('guid-node.files', this.model.file.fileModel.target.get('id'));
117117
}
118118
}

app/guid-file/index/route.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Store from '@ember-data/store';
2+
import Route from '@ember/routing/route';
3+
import RouterService from '@ember/routing/router-service';
4+
import { inject as service } from '@ember/service';
5+
import CedarMetadataRecordModel from 'ember-osf-web/models/cedar-metadata-record';
6+
import CedarMetadataTemplateModel from 'ember-osf-web/models/cedar-metadata-template';
7+
8+
9+
export default class MetadataDetailRoute extends Route {
10+
@service store!: Store;
11+
@service router!: RouterService;
12+
13+
async model() {
14+
const file = this.modelFor('guid-file');
15+
const defaultIndex = 0;
16+
const cedarMetadataRecords = await file.fileModel.queryHasMany('cedarMetadataRecords', {
17+
'page[size]': 20,
18+
});
19+
20+
for(const cedarMetadataRecord of cedarMetadataRecords) {
21+
const template = await cedarMetadataRecord.template as CedarMetadataTemplateModel;
22+
template.recordCreated = true;
23+
cedarMetadataRecord.templateName = template.schemaName;
24+
}
25+
26+
cedarMetadataRecords.sort(
27+
(a: CedarMetadataRecordModel, b: CedarMetadataRecordModel) =>
28+
a.templateName > b.templateName ? 1 : -1,
29+
);
30+
31+
32+
return {
33+
file,
34+
cedarMetadataRecords,
35+
defaultIndex,
36+
};
37+
}
38+
}

0 commit comments

Comments
 (0)