Skip to content

Instantly share code, notes, and snippets.

@kitsuneyo
Created May 4, 2018 08:58
Show Gist options
  • Save kitsuneyo/0928137196b52930000bf911ffe4ea9a to your computer and use it in GitHub Desktop.
Save kitsuneyo/0928137196b52930000bf911ffe4ea9a to your computer and use it in GitHub Desktop.
{{!-- templates/components/my-form.hbs --}}
{{#bs-form model=changeset
formLayout="vertical"
onSubmit=(action submit changeset)
class='mb-5' as |form|}}
{{!-- other stuff --}}
{{form.element controlType="power-select"
property="mediaLicense"
label="Media license"
options=mediaLicenses
optionLabelPath="name"}}
{{bs-button defaultText="Save"
type="primary"
buttonType="submit"}}
{{/bs-form}}
// routes/show.js
model(params) {
return RSVP.hash({
image: this.get('store').findRecord('image', params.id),
mediaLicenses: this.get('store')
.findAll(
'media-license',
{ fields: { media_licenses: 'name' } }
)
});
},
# templates/show.hbs
{{my-form changeset=(changeset model.image validations)
submit=(action "submit")
mediaLicenses=model.mediaLicenses}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment