forked from CenterForOpenScience/ember-osf-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
140 changed files
with
42,431 additions
and
775 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
} | ||
} |
Oops, something went wrong.