datacite/bracco

View on GitHub
app/components/doi-geo-locations.js

Summary

Maintainability
B
5 hrs
Test Coverage
import Component from '@ember/component';

export default Component.extend({
  showGeoLocations: false,

  didReceiveAttrs() {
    this._super(...arguments);

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

  actions: {
    addGeoLocation() {
      this.model.get('geoLocations').createFragment();
      this.set('showGeoLocations', true);
    },
    toggleGeoLocations() {
      this.set('showGeoLocations', !this.showGeoLocations);
    }
  }
});