-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #693 from datacite/fabrica-improvements-main
Fabrica improvements - Final Review
- Loading branch information
Showing
124 changed files
with
2,704 additions
and
1,642 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
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
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,14 @@ | ||
import Component from '@ember/component'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
currentUser: service(), | ||
|
||
classNames: [], | ||
|
||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
|
||
this.set('currentUser', this.currentUser); | ||
}, | ||
}); |
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,18 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
tagName: 'div', | ||
|
||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
|
||
}, | ||
|
||
didRender() { | ||
this._super(...arguments); | ||
|
||
window.MathJax.typesetClear([this.get('element')]); | ||
this.element.innerHTML = this.text | ||
window.MathJax.typeset([this.get('element')]); | ||
} | ||
}); |
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 |
---|---|---|
@@ -1,16 +1,52 @@ | ||
import Component from '@ember/component'; | ||
import { inject as service } from '@ember/service'; | ||
import { isBlank } from '@ember/utils'; | ||
import mime from 'mime/lite' | ||
|
||
const FORMATS = Object.keys(mime._extensions) | ||
|
||
function getMatchingFormats(input) { | ||
const matchingFormats = FORMATS.filter(ext => ext.includes(input.toLowerCase())) | ||
return matchingFormats | ||
} | ||
|
||
export default Component.extend({ | ||
store: service(), | ||
|
||
init(...args) { | ||
this._super(...args); | ||
this.formats = FORMATS; | ||
|
||
this.selected = this.selected || []; | ||
}, | ||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
}, | ||
|
||
actions: { | ||
updateFormat(value) { | ||
this.set('fragment', value); | ||
createOnEnter(select, e) { | ||
if ( | ||
e.keyCode === 13 && | ||
select.isOpen && | ||
!select.highlighted && | ||
!isBlank(select.searchText) | ||
) { | ||
if (!this.selected.includes(select.searchText)) { | ||
this.formats.push(select.searchText); | ||
select.actions.choose(select.searchText); | ||
this.model.get('formats').replace(this.index, 1, [ select.searchText ]); | ||
this.set('formats', FORMATS); | ||
} | ||
} | ||
}, | ||
searchFormat(query) { | ||
this.set('formats', getMatchingFormats(query)) | ||
}, | ||
selectFormat() { | ||
this.model.get('formats').replace(this.index, 1, [ this.fragment ]); | ||
selectFormat(formatExtension) { | ||
this.model.get('formats').replace(this.index, 1, [ formatExtension ]); | ||
}, | ||
deleteFormat() { | ||
this.model.get('formats').removeAt(this.index); | ||
}, | ||
}, | ||
} | ||
} | ||
}); |
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 |
---|---|---|
|
@@ -93,5 +93,5 @@ export default Component.extend({ | |
selectMetadata(metadata) { | ||
this.showMetadata(metadata); | ||
}, | ||
}, | ||
} | ||
}); |
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,41 @@ | ||
import Component from '@ember/component'; | ||
import Papa from 'papaparse'; | ||
import FileSaver from 'file-saver'; | ||
import currentDate from '../utils/current-date'; | ||
import formatCreators from '../utils/format-creators'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
classNames: [], | ||
|
||
actions: { | ||
exportBasicMetadata(model) { | ||
let dois = []; | ||
|
||
this.model.forEach(function(doi) { | ||
dois.push({ | ||
"doi" : doi.doi, | ||
"url" : doi.url, | ||
"registered": doi.registered, | ||
"state": doi.state, | ||
"resourceTypeGeneral": doi.types.resourceTypeGeneral, | ||
"resourceType": doi.types.resourceType, | ||
"title": doi.title, | ||
"author": formatCreators(doi.creators, {}), | ||
"publisher": doi.publisher, | ||
"publicationYear": doi.publicationYear | ||
}); | ||
}); | ||
|
||
var csv = Papa.unparse(dois); | ||
|
||
var FileSaver = require('file-saver'); | ||
var blob = new Blob([csv], {type: "text/csv;charset=utf-8"}); | ||
var filename = currentDate() | ||
+ (this.client_id ? '-' + this.client_id : '-' + 'dois') | ||
+ (this.page ? '-' + this.page : '') | ||
+ ".csv"; | ||
FileSaver.saveAs(blob, filename); | ||
} | ||
} | ||
}) |
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,14 @@ | ||
import Component from '@ember/component'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Component.extend({ | ||
currentUser: service(), | ||
|
||
init(...args) { | ||
this._super(...args); | ||
}, | ||
|
||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
} | ||
}); |
Oops, something went wrong.