UNPKG

ember-arcgis-page-layout

Version:

Page Layout infrastructure components

61 lines (58 loc) 1.34 kB
/** * page-body/component.js */ import Ember from 'ember'; import layout from './template'; export default Ember.Component.extend({ layout:layout, classNames: ['body-editor'], isEditing: true, /** * Get the event bus */ eventBus: Ember.inject.service('event-bus'), /** * Add handlers */ listen: function(){ this.get('eventBus').on('preview', this, 'preview'); this.get('eventBus').on('edit', this, 'edit'); }.on('init'), /** * Remove handlers */ cleanup: function(){ this.get('eventBus').off('preview', this, 'preview'); this.get('eventBus').off('edit', this, 'edit'); }.on('willDestroyElement'), /** * Enable Preview by setting isEditing to false */ preview: function(){ this.set('isEditing', false); }, /** * Enable editing by setting isEditng to true */ edit: function(){ this.set('isEditing', true); }, actions: { onLayoutDragStart(){ if(this.get('onDragStart')){ this.get('onDragStart')(); } }, onLayoutDragEnd(){ if(this.get('onDragEnd')){ this.get('onDragEnd')(); } }, onEditSettings(sectionModel, editorComponentName) { this.sendAction('onEditSettings', sectionModel, editorComponentName); }, onModelChanged() { this.sendAction('onModelChanged'); } } });