Skip to content

Commit

Permalink
Merge branch 'release/24.03.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
adlius committed Feb 26, 2024
2 parents 435f7a9 + 78338b0 commit e520109
Show file tree
Hide file tree
Showing 140 changed files with 42,431 additions and 775 deletions.
5 changes: 5 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).

## [24.03.0] - 2024-02-26
### Added
- Integrate Cedar Embeddable Editor for adding and editing metadata

## [24.02.0] - 2024-01-30
### Changed
- Update help links for licenses on draft registrations
Expand Down Expand Up @@ -1972,6 +1976,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added
- Quick Files

[24.03.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/24.03.0
[24.02.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/24.02.0
[24.01.0]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/24.01.0
[23.15.3]: https://github.com/CenterForOpenScience/ember-osf-web/releases/tag/23.15.3
Expand Down
11 changes: 11 additions & 0 deletions app/adapters/cedar-metadata-record.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import OsfAdapter from './osf-adapter';

export default class CedarMetadataRecordAdapter extends OsfAdapter {
namespace = '_';
}

declare module 'ember-data/types/registries/adapter' {
export default interface AdapterRegistry {
'cedar-metadata-record': CedarMetadataRecordAdapter;
} // eslint-disable-line semi
}
11 changes: 11 additions & 0 deletions app/adapters/cedar-metadata-template.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import OsfAdapter from './osf-adapter';

export default class CedarMetadataTemplateAdapter extends OsfAdapter {
namespace = '_';
}

declare module 'ember-data/types/registries/adapter' {
export default interface AdapterRegistry {
'cedar-metadata-template': CedarMetadataTemplateAdapter;
} // eslint-disable-line semi
}
34 changes: 34 additions & 0 deletions app/config/environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ declare const config: {
WATER_BUTLER_ENABLED: boolean;
plauditWidgetUrl: string,
environment: any;
cedarConfig: any;
lintOnBuild: boolean;
testsEnabled: boolean;
sourcemapsEnabled: boolean;
Expand All @@ -31,6 +32,39 @@ declare const config: {
assetsPrefix: string;
sentryDSN: string | null;
googleTagManagerId: string | null;
cedarConfig: {
viewerConfig: {
showHeader: boolean,
showFooter: boolean,
expandedSampleTemplateLinks: boolean,
showSampleTemplateLinks: boolean,
defaultLanguage: string,
showTemplateData: boolean,
showInstanceData: boolean,
}
editorConfig: {
sampleTemplateLocationPrefix: string,
loadSampleTemplateName: string,
expandedSampleTemplateLinks: boolean,
showTemplateRenderingRepresentation: boolean,
showMultiInstanceInfo: boolean,
expandedInstanceDataFull: boolean,
expandedInstanceDataCore: boolean,
expandedMultiInstanceInfo: boolean,
expandedTemplateRenderingRepresentation: boolean,
showInstanceDataFull: boolean,
showTemplateSourceData: boolean,
expandedTemplateSourceData: boolean,
collapseStaticComponents: boolean,
showStaticText: boolean,
showInstanceDataCore: boolean,
showHeader: boolean,
showFooter: boolean,
showInstanceDataFull: boolean,
showTemplateSourceData: boolean,
terminologyIntegratedSearchUrl: string,
},
}
sentryOptions: {
release?: string;
ignoreErrors: string[];
Expand Down
33 changes: 24 additions & 9 deletions app/guid-file/-components/file-detail-layout/styles.scss
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
// stylelint-disable max-nesting-depth, selector-max-compound-selectors

.container {
display: flex;
flex-direction: row;
flex-grow: 1;
}

.main-column {
flex-grow: 3;
z-index: 1;
width: 70%;
min-width: 300px;

&.mobile {
width: 100%;
}

&.is-closed {
flex: 1;
width: calc(100% - 72px);
}

h3 {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 70vw;
width: 70%;
}
}

Expand All @@ -22,25 +34,28 @@
flex-basis: 300px;
flex-direction: column;
flex-grow: 1;
width: 28vw;
width: calc(30% - 72px);
min-width: 400px;

&.is-closed {
display: none;
}
}

.right-buttons {
@media (max-width: 767px) {
display: flex;
flex-direction: row;
justify-content: space-evenly;
border-top: 1px solid #ddd;
}
flex-grow: 0;
display: flex;
flex-direction: column;
border-left: 1px solid #ddd;
z-index: 1;
width: 72px;
min-width: 72px;

&.mobile {
flex-direction: row;
width: 100%;
margin-bottom: 10px;
}
}

.slide-in {
Expand Down
7 changes: 4 additions & 3 deletions app/guid-file/-components/file-detail-layout/template.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div local-class='container'>
{{#if @isMobile}}
<div local-class='main-column'>
<div local-class='main-column mobile'>
{{yield to='header'}}
<div local-class='right-buttons'>
<div local-class='right-buttons mobile'>
{{yield to='rightButtons'}}
</div>
<div>
Expand All @@ -14,7 +14,8 @@
</div>
</div>
{{else}}
<div local-class='main-column'>

<div local-class='main-column {{if @rightColumnClosed 'is-closed'}}'>
{{yield to='header'}}
{{yield to='body'}}
</div>
Expand Down
64 changes: 64 additions & 0 deletions app/guid-file/-components/file-header/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// stylelint-disable max-nesting-depth, selector-max-compound-selectors

.file-header-container {
width: 100%;

.flex-container-row {
width: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0 20px 20px;

h2 {
height: 40px;
width: 70%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.return-container {
width: 30%;
height: 70px;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
}
}

.project-link-header {
padding-bottom: 5px;

.project-link {
margin: 20px;
}
}

&.mobile {
padding: 0;

.flex-container-row {
padding: 0;
flex-direction: column;

h2,
.return-container {
width: 100%;
height: fit-content;
justify-content: flex-start;
}

h2 {
margin-top: 0;
}
}

.project-link-header {
.project-link {
margin: 0;
}
}
}
}
40 changes: 40 additions & 0 deletions app/guid-file/-components/file-header/template.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<div local-class='file-header-container {{if @isMobile 'mobile'}}'>
<h3 local-class='project-link-header'>
<OsfLink
data-test-project-link
data-analytics-name='Linked project'
local-class='project-link'
@route={{if (eq @model.fileModel.target.type 'registrations') 'guid-registration' 'guid-node'}}
@models={{array @model.fileModel.target.id}}
>
{{@model.fileModel.target.title}}
</OsfLink>
</h3>
<div local-class='flex-container-row'>
<h2 data-test-filename>
{{@model.displayName}}
{{#if @viewedVersion}}
({{t 'general.version'}}: {{@viewedVersion}})
{{/if}}
</h2>
<div local-class='return-container'>
{{#if @displayFileActions}}
<FileActionsMenu
@item={{@model}}
@onDelete={{@onDelete}}
@allowRename={{false}}
@addonsEnabled={{@model.fileModel.target.addonsEnabled}}
/>
{{else}}
<OsfLink
data-test-return-to-metadata
data-analytics-name='Return from cedar metadata template selection'
@route='guid-file.index'
@models={{array @model.fileModel.id}}
>
{{ t 'file-detail.metadata.return-to-file' fileName=@model.displayName}}
</OsfLink>
{{/if}}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default class GuidFile extends Controller {

@action
toggleRevisions() {
if (!this.model.waterButlerRevisions) {
taskFor(this.model.getRevisions).perform();
if (!this.model.file.waterButlerRevisions) {
taskFor(this.model.file.getRevisions).perform();
}
if (this.isMobile) {
this.revisionsOpened = true;
Expand Down Expand Up @@ -113,6 +113,6 @@ export default class GuidFile extends Controller {

@action
onDelete() {
this.router.transitionTo('guid-node.files', this.model.fileModel.target.get('id'));
this.router.transitionTo('guid-node.files', this.model.file.fileModel.target.get('id'));
}
}
38 changes: 38 additions & 0 deletions app/guid-file/index/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import Store from '@ember-data/store';
import Route from '@ember/routing/route';
import RouterService from '@ember/routing/router-service';
import { inject as service } from '@ember/service';
import CedarMetadataRecordModel from 'ember-osf-web/models/cedar-metadata-record';
import CedarMetadataTemplateModel from 'ember-osf-web/models/cedar-metadata-template';


export default class MetadataDetailRoute extends Route {
@service store!: Store;
@service router!: RouterService;

async model() {
const file = this.modelFor('guid-file');
const defaultIndex = 0;
const cedarMetadataRecords = await file.fileModel.queryHasMany('cedarMetadataRecords', {
'page[size]': 20,
});

for(const cedarMetadataRecord of cedarMetadataRecords) {
const template = await cedarMetadataRecord.template as CedarMetadataTemplateModel;
template.recordCreated = true;
cedarMetadataRecord.templateName = template.schemaName;
}

cedarMetadataRecords.sort(
(a: CedarMetadataRecordModel, b: CedarMetadataRecordModel) =>
a.templateName > b.templateName ? 1 : -1,
);


return {
file,
cedarMetadataRecords,
defaultIndex,
};
}
}
Loading

0 comments on commit e520109

Please sign in to comment.