Skip to content

Commit

Permalink
Merge pull request #407 from datacite/alternate-identifiers
Browse files Browse the repository at this point in the history
use alternative-identifier instead of identifier
  • Loading branch information
Martin Fenner authored May 4, 2020
2 parents 284ecbc + 73c25e7 commit 1e64a15
Show file tree
Hide file tree
Showing 188 changed files with 5,532 additions and 11,666 deletions.
15 changes: 6 additions & 9 deletions app/components/doi-alternate-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,20 @@ export default Component.extend({
if (!this.selected.includes(select.searchText)) {
this.alternateIdentifierTypes.push(select.searchText);
select.actions.choose(select.searchText);
this.fragment.set('identifierType', select.searchText);
this.fragment.set('alternateIdentifierType', select.searchText);
this.set('alternateIdentifierTypes', alternateIdentifierTypeList);
}
}
},
updateIdentifier(value) {
this.fragment.set('identifier', value);
},
updateIdentifierType(value) {
this.fragment.set('identifierType', value);
updateAlternateIdentifier(value) {
this.fragment.set('alternateIdentifier', value);
},
selectAlternateIdentifierType(alternateIdentifierType) {
this.fragment.set('identifierType', alternateIdentifierType);
this.fragment.set('alternateIdentifierType', alternateIdentifierType);
this.set('alternateIdentifierTypes', alternateIdentifierTypeList);
},
deleteIdentifier() {
this.model.get('identifiers').removeObject(this.fragment);
deleteAlternateIdentifier() {
this.model.get('alternateIdentifiers').removeObject(this.fragment);
},
},
});
8 changes: 4 additions & 4 deletions app/components/doi-alternate-identifiers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ export default Component.extend({
didReceiveAttrs() {
this._super(...arguments);

if (!this.model.get('identifiers')) {
this.model.set('identifiers', []);
if (!this.model.get('alternateIdentifiers')) {
this.model.set('alternateIdentifiers', []);
}
},

actions: {
addIdentifier() {
this.model.get('identifiers').createFragment();
addAlternateIdentifier() {
this.model.get('alternateIdentifiers').createFragment();
this.set('showAlternateIdentifiers', true);
},
toggleAlternateIdentifiers() {
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/dois/show/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export default Controller.extend({
}));

// only store identifiers with a text
doi.set('identifiers', A(doi.get('identifiers')).filter(function(identifier) {
return !isBlank(identifier.identifier);
doi.set('alternateIdentifiers', A(doi.get('alternateIdentifiers')).filter(function(alternateIdentifier) {
return !isBlank(alternateIdentifier.identifier);
}));

// only store rights with a text
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/dois/show/modify.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default Controller.extend({
doi.set('language', null);
doi.set('subjects', null);
doi.set('contributors', null);
doi.set('identifiers', null);
doi.set('alternateIdentifiers', null);
doi.set('relatedIdentifiers', null);
doi.set('fundingReferences', null);
doi.set('geoLocations', null);
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/repositories/show/dois/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ export default Controller.extend({
}));

// only store identifiers with a text
doi.set('identifiers', A(doi.get('identifiers')).filter(function(identifier) {
return !isBlank(identifier.identifier);
doi.set('alternateIdentifiers', A(doi.get('alternateIdentifiers')).filter(function(alternateIdentifier) {
return !isBlank(alternateIdentifier.identifier);
}));

// only store rights with a text
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/repositories/show/dois/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default Controller.extend({
doi.set('subjects', null);
doi.set('language', null);
doi.set('contributors', null);
doi.set('identifiers', null);
doi.set('alternateIdentifiers', null);
doi.set('relatedIdentifiers', null);
doi.set('fundingReferences', null);
doi.set('geoLocations', null);
Expand Down
6 changes: 3 additions & 3 deletions app/helpers/doi-form-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ export function doiFormErrors([ model ]) {
errorAttributes = errorAttributes.concat(contributor.validations.errors.mapBy('attribute'));
});
}
if (model.identifiers) {
model.identifiers.forEach((identifier) => {
errorAttributes = errorAttributes.concat(identifier.validations.errors.mapBy('attribute'));
if (model.alternateIdentifiers) {
model.alternateIdentifiers.forEach((alternateIdentifier) => {
errorAttributes = errorAttributes.concat(alternateIdentifier.validations.errors.mapBy('attribute'));
});
}
if (model.subjects) {
Expand Down
10 changes: 5 additions & 5 deletions app/models/identifier.js → app/models/alternate-identifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import { computed } from '@ember/object';
import { isBlank } from '@ember/utils';

const Validations = buildValidations({
identifierType: [
alternateIdentifierType: [
validator('presence', {
presence: true,
message: 'Alternate Identifier must include Identifier Type',
disabled: computed('model.identifier', function() {
return isBlank(this.model.get('identifier'));
disabled: computed('model.alternateIdentifier', function() {
return isBlank(this.model.get('alternateIdentifier'));
}),
}),
],
});

export default Fragment.extend(Validations, {
identifier: DS.attr('string', { defaultValue: null }),
identifierType: DS.attr('string', { defaultValue: null }),
alternateIdentifier: DS.attr('string', { defaultValue: null }),
alternateIdentifierType: DS.attr('string', { defaultValue: null }),
});
2 changes: 1 addition & 1 deletion app/models/doi.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default DS.Model.extend(Validations, {
publicationYear: DS.attr('number'),
subjects: fragmentArray('subject', { defaultValue: [] }),
contributors: fragmentArray('contributor', { defaultValue: [] }),
identifiers: fragmentArray('identifier', { defaultValue: [] }),
alternateIdentifiers: fragmentArray('alternateIdentifier', { defaultValue: [] }),
dates: fragmentArray('date', { defaultValue: [] }),
language: DS.attr('string'),
types: DS.attr(),
Expand Down
8 changes: 4 additions & 4 deletions app/templates/components/doi-alternate-identifier.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="input-group">
<input type="text" class="form-control alternate-identifier-field" value={{fragment.identifier}} placeholder="Alternate Identifier" oninput={{action "updateIdentifier" value="target.value"}} data-test-alternate-identifier/>
<input type="text" class="form-control alternate-identifier-field" value={{fragment.alternateIdentifier}} placeholder="Alternate Identifier" oninput={{action "updateAlternateIdentifier" value="target.value"}} data-test-alternate-identifier/>
<span class="input-group-btn">
<BsButton @outline={{true}} @onClick={{action "deleteIdentifier" index}}>{{fa-icon "trash"}}</BsButton>
<BsButton @outline={{true}} @onClick={{action "deleteAlternateIdentifier" index}}>{{fa-icon "trash"}}</BsButton>
</span>
</div>

Expand All @@ -11,11 +11,11 @@
<div class="power-select-fragment" disabled={{this.controlledIdentifierType}} data-test-alternate-identifier-type>
{{#form.element
controlType="power-select"
value=fragment.identifierType
value=fragment.alternateIdentifierType
helpText="The type of Alternate Identifier."
options=alternateIdentifierTypeList
disabled=controlledIdentifierType
destination=fragment.identifierType as |el|
destination=fragment.alternateIdentifierType as |el|
}}
{{el.control
onChange=(action "selectAlternateIdentifierType")
Expand Down
18 changes: 9 additions & 9 deletions app/templates/components/doi-alternate-identifiers.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
<div class="col-md-9">
<div class="label-vertical">An identifier or identifiers other than the primary Identifier applied to the resource being registered.</div>
{{#if showAlternateIdentifiers}}
{{#each model.identifiers as |identifier index|}}
<DoiAlternateIdentifier @model={{model}} @fragment={{identifier}} @form={{form}} @index={{index}} />
{{#each model.alternateIdentifiers as |alternateIdentifier index|}}
<DoiAlternateIdentifier @model={{model}} @fragment={{alternateIdentifier}} @form={{form}} @index={{index}} />
{{/each}}

{{#if (lte model.identifiers.length 4)}}
<BsButton @class="btn-sm" @id="add-alternate-identifier" @outline={{true}} @onClick={{action "addIdentifier"}}>{{fa-icon "plus"}} Add {{if (gt model.identifiers.length 1) "another "}} alternate identifier</BsButton>
{{#if (lte model.alternateIdentifiers.length 4)}}
<BsButton @class="btn-sm" @id="add-alternate-identifier" @outline={{true}} @onClick={{action "addAlternateIdentifier"}}>{{fa-icon "plus"}} Add {{if (gt model.alternateIdentifiers.length 1) "another "}} alternate identifier</BsButton>
{{/if}}

{{#if (gt model.identifiers.length 0)}}
<BsButton @id="toggle-alternate-identifiers" @class="btn-sm" @outline={{true}} @onClick={{action "toggleAlternateIdentifiers"}}>{{fa-icon "eye-slash"}} Hide {{pluralize model.identifiers.length 'alternate identifier'}}</BsButton>
{{#if (gt model.alternateIdentifiers.length 0)}}
<BsButton @id="toggle-alternate-identifiers" @class="btn-sm" @outline={{true}} @onClick={{action "toggleAlternateIdentifiers"}}>{{fa-icon "eye-slash"}} Hide {{pluralize model.alternateIdentifiers.length 'alternate identifier'}}</BsButton>
{{/if}}
{{else}}
{{#if (gt model.identifiers.length 0)}}
<BsButton @id="toggle-alternate-identifiers" @class="btn-sm" @outline={{true}} @onClick={{action "toggleAlternateIdentifiers"}}>{{fa-icon "eye"}} Show {{pluralize model.identifiers.length 'alternate identifier'}}</BsButton>
{{#if (gt model.alternateIdentifiers.length 0)}}
<BsButton @id="toggle-alternate-identifiers" @class="btn-sm" @outline={{true}} @onClick={{action "toggleAlternateIdentifiers"}}>{{fa-icon "eye"}} Show {{pluralize model.alternateIdentifiers.length 'alternate identifier'}}</BsButton>
{{else}}
<BsButton @class="btn-sm btn-warning" @id="add-alternate-identifier" @outline={{true}} @onClick={{action "addIdentifier"}}>{{fa-icon "plus"}} Add alternate identifier</BsButton>
<BsButton @class="btn-sm btn-warning" @id="add-alternate-identifier" @outline={{true}} @onClick={{action "addAlternateIdentifier"}}>{{fa-icon "plus"}} Add alternate identifier</BsButton>
{{/if}}
{{/if}}
</div>
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | provider/visiting provider TIB dois",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:55.018Z",
"time": 161,
"startedDateTime": "2020-05-04T16:39:28.152Z",
"time": 104,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 161
"wait": 104
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | provider/visiting provider TIB info",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:53.906Z",
"time": 84,
"startedDateTime": "2020-05-04T16:39:27.204Z",
"time": 79,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 84
"wait": 79
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | provider/visiting provider TIB prefixes",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:54.642Z",
"time": 131,
"startedDateTime": "2020-05-04T16:39:27.836Z",
"time": 124,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 131
"wait": 124
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | provider/visiting provider TIB repositories",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:54.134Z",
"time": 177,
"startedDateTime": "2020-05-04T16:39:27.539Z",
"time": 90,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 177
"wait": 90
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | provider/visiting provider TIB",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:53.462Z",
"time": 121,
"startedDateTime": "2020-05-04T16:39:26.909Z",
"time": 102,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 121
"wait": 102
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | repository/visiting repository AWI dois",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:56.909Z",
"time": 123,
"startedDateTime": "2020-05-04T16:39:29.758Z",
"time": 134,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 123
"wait": 134
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"_recordingName": "Acceptance | anonymous | repository/visiting repository AWI info",
"browser": {
"name": "Chrome",
"version": "81.0.4044.122"
"version": "81.0.4044.129"
},
"creator": {
"comment": "persister:rest",
Expand Down Expand Up @@ -63,16 +63,16 @@
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-23T07:28:55.880Z",
"time": 104,
"startedDateTime": "2020-05-04T16:39:28.811Z",
"time": 95,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 104
"wait": 95
}
}
],
Expand Down
Loading

0 comments on commit 1e64a15

Please sign in to comment.