-
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.
addresses #330
- Loading branch information
Showing
13 changed files
with
127 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
|
||
|
||
actions: { | ||
updateGeoLocationPlace(value) { | ||
this.fragment.set('geoLocationPlace', value); | ||
}, | ||
deleteGeoLocation() { | ||
this.model.get('geoLocationPlaces').removeObject(this.fragment); | ||
}, | ||
}, | ||
}); |
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,22 @@ | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
validationClass: null, | ||
|
||
didReceiveAttrs() { | ||
this._super(...arguments); | ||
|
||
if (!this.model.get('geoLocations')) { | ||
this.model.set('geoLocations', []); | ||
} | ||
if (this.model.get('geoLocations').length == 0) { | ||
this.model.get('geoLocations').createFragment(); | ||
} | ||
}, | ||
|
||
actions: { | ||
addGeoLocation() { | ||
this.model.get('geoLocations').createFragment(); | ||
}, | ||
}, | ||
}); |
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,23 @@ | ||
import DS from 'ember-data'; | ||
import Fragment from 'ember-data-model-fragments/fragment'; | ||
import { validator, buildValidations } from 'ember-cp-validations'; | ||
// import { computed } from '@ember/object'; | ||
|
||
const Validations = buildValidations({ | ||
// geoLocationPlace: [ | ||
// validator('format', { | ||
// regex: /^([^,]+)(, \w+(\(\w+\))?, \w+(-\w+)?)?$/, | ||
// message: 'Series information not in recommended format of series title, followed by comma and optional volume(issue), firstpage-lastpage', | ||
// disabled: computed('model.descriptionType', function() { | ||
// return this.model.get('descriptionType') !== 'SeriesInformation'; | ||
// }), | ||
// isWarning: true, | ||
// }), | ||
// ], | ||
}); | ||
|
||
export default Fragment.extend(Validations, { | ||
geoLocationPlace: DS.attr('string', { defaultValue: null }), | ||
// geoLocationPoint: DS.attr('string', { defaultValue: null }), | ||
// geoLocationBox: DS.attr('string', { defaultValue: null }), | ||
}); |
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,21 @@ | ||
<label for="geoLocationPlace" class="subtitle">GeoLocation Place (optional)</label> | ||
{{#if (gt index 0)}} | ||
<div class="input-group"> | ||
<input class="form-control geo-location-place-field {{if (not isSeriesInformation) 'no-error'}}" value={{fragment.geo-location-place}} | ||
oninput={{action "updateGeoLocationPlace" value="target.value"}} data-test-geo-location-place/> | ||
<span class="input-group-addon"> | ||
<BsButton @outline={{true}} @onClick={{action "deleteGeoLocation" index}}>{{fa-icon "trash" pull="left" style="margin:0;"}}</BsButton> | ||
</span> | ||
</div> | ||
{{else}} | ||
<input class="form-control geo-location-place-field {{if (not isSeriesInformation) 'no-error'}}" value={{fragment.geo-location-place}} | ||
oninput={{action "updateGeoLocationPlace" value="target.value"}} data-test-geo-location-place/> | ||
{{/if}} | ||
<div class="help-block help-block-fragment geo-location-place-field">Description of a geographic location. </div> | ||
|
||
{{!-- {{#if isSeriesInformation}} | ||
{{else}} | ||
<div class="help-block help-block-fragment geo-location-place-field">All additional information that does not fit in any of the other categories.</div> | ||
{{/if}} --}} | ||
|
||
<hr /> |
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,12 @@ | ||
<div class="form-group {{validationClass}}"> | ||
<label class="control-label col-md-3">Geo Location(s) (optional)</label> | ||
<div class="col-md-9"> | ||
{{#each model.geoLocations as |geoLocation index|}} | ||
<DoiGeoLocation @model={{model}} @fragment={{geoLocation}} @form={{form}} @index={{index}} /> | ||
{{/each}} | ||
|
||
{{#if (or (not model.geolocations) (lte model.geolocations.length 4))}} | ||
<BsButton @class="btn-sm" @id="add-geolocation" @outline={{true}} @onClick={{action "addGeoLocation"}}>{{fa-icon "plus"}} Add {{if (gt model.geolocations.length 0) "another "}}geo location</BsButton> | ||
{{/if}} | ||
</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