ember-arcgis-page-layout
Version:
Page Layout infrastructure components
62 lines (52 loc) • 1.9 kB
JavaScript
/**
* page-save-controls:component
*/
import Ember from 'ember';
import layout from './template';
export default Ember.Component.extend({
layout: layout,
i18nScope:'layout',
validOrgs: ['LjjARY1mkhxulWPq','97KLIFOSt5CxbiRI', 'bkrWlSKcjUDFDtgw', 'VjKJdBIEYrE5kSOl','WUQfmD5lsOhcAT0g'],
saved:false,
eventBus: Ember.inject.service('event-bus'),
classNames:['page-save-controls'],
saveButtonDisabled: Ember.computed('model.hasDirtyAttributes', function(){
//For UC2016 Save button is always enabled
//Issue to track down inconsistentcies https://github.com/ArcGIS/composer/issues/11323
return false; //this.model.get('hasDirtyAttributes') ? '' : 'disabled';
}),
// TODO: Determine a better means to show/hide save-as-template Org membership is too coarse grained
canSaveAsTemplate: Ember.computed('session', function(){
return false; // this.get('session').isInAnyOrg(this.get('validOrgs'));
}),
titleI18nKey: Ember.computed('i18nScope', function(){
return this.get('i18nScope') + '.pageSaveControls.title';
}),
doShowViewButton: true, //Ember.computed.and('model.public', 'onView'),
siteUrl: Ember.computed('model.url', 'modul.customDomain', function() {
return this.get('model.customDomain') || this.get('model.url');
}),
actions: {
save: function(){
this.set('saved', true);
this.get('onSave')();
},
saveAsTemplate: function(){
this.set('saved', true);
this.get('onSaveAsTemplate')();
},
publish: function(){
this.get('onPublish')();
},
preview: function(){
console.log('publish-controls:actions:preview');
this.set('isPreview', true);
this.get('eventBus').trigger('preview');
},
edit: function(){
console.log('publish-controls:actions:edit');
this.set('isPreview', false);
this.get('eventBus').trigger('edit');
},
}
});