You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For almost every model that I want to edit I create a new form component that is an extension of the twbs-form component in this package. This is typically extension of the twbs-form. I feel that form should be responsible for persistence only.
I feel a fieldset element (or editor) can be used to toggle between the read-only and editable version of the model in question.
The following actions can be pushed into the component: cancel, destroy, new, and save.
The template will accept a block that should effe
Component JS
importEmberfrom'ember';exportdefaultEmber.Component.extend({/** * REQUIRED. * The action to fire when the form is reset/cancelled. */actionCancel: '',/** * REQUIRED. * The action to fire when the model is asked to be destroyed. */actionDestroy: '',/** * REQUIRED. * The action to fire when the new plus button is pressed. */actionNew: '',/** * REQUIRED. * The action to fire when the form is saved. */actionSave: '',/** * `true` shows the edit for. `false` hides the form (default). */'editor?': Ember.computed.notEmpty('modelInstance'),/** * REQUIRED. * The model instance to be edited. */modelInstance: undefined,/** * Is the model not yet persisted (e.g. brand new). */'new?': Ember.computed.bool('modelInstance.isNew'),tagName: 'fieldset'});
Component Template
<legend></legend>
{{#ifeditor?}}{{!-- some sort of form here --}}{{else}}{{yield (hashnew?=new?))
{{/if}}
The text was updated successfully, but these errors were encountered:
I've seen a pattern in my form-driven components.
twbs-form
component in this package. This is typically extension of thetwbs-form
. I feel that form should be responsible for persistence only.Component JS
Component Template
The text was updated successfully, but these errors were encountered: