use ember-bootstrap in create/index, create/meta, create/settings

This commit is contained in:
jelhan 2016-05-26 13:01:23 +02:00
parent 79f6e3411b
commit 32f9c3e633
6 changed files with 102 additions and 63 deletions

View file

@ -0,0 +1,5 @@
import SimpleSelect from 'ember-simple-select/components/simple-select';
export default SimpleSelect.reopen({
classNames: ['form-control']
});

View file

@ -26,6 +26,8 @@ export default Ember.Controller.extend(Validations, {
} }
}, },
description: Ember.computed.alias('model.description'),
init() { init() {
this.get('i18n.locale'); this.get('i18n.locale');
}, },

View file

@ -1,19 +1,30 @@
<div class="box"> <div class="box">
{{#fm-form action='submit'}} {{#bs-form
{{fm-field formLayout="horizontal"
type='select' model=this
value=pollType action="submit"
content=pollTypes }}
optionValuePath='id' {{#bs-form-element
optionLabelPath='label' classNames='poll-type'
label=(t 'create.index.input.pollType.label') label=(t 'create.index.input.pollType.label')
errors=validations.attrs.pollType.messages property="pollType"
class='poll-type' as |value id|
}} }}
{{#fm-submit {{simple-select
inputWrapperClass='col-sm-10 col-sm-offset-2' id=id
}} content=pollTypes
{{t 'create.next'}} optionLabelPath="label"
{{/fm-submit}} optionValuePath="id"
{{/fm-form}} value=value
action=(action (mut value) value='id')
}}
{{/bs-form-element}}
{{#bs-form-element}}
{{bs-button
defaultText=(t 'create.next')
type="primary"
buttonType="submit"
}}
{{/bs-form-element}}
{{/bs-form}}
</div> </div>

View file

@ -1,23 +1,29 @@
<div class="box"> <div class="box">
{{#fm-form action='submit'}} {{#bs-form
{{fm-field formLayout="horizontal"
value=title model=this
action="submit"
}}
{{bs-form-element
classNames='title'
controlType="text"
label=(t 'create.meta.input.title.label') label=(t 'create.meta.input.title.label')
placeholder=(t 'create.meta.input.title.placeholder') placeholder=(t 'create.meta.input.title.placeholder')
errors=validations.attrs.title.messages property="title"
class='title'
}} }}
{{fm-field {{bs-form-element
type='textarea' classNames='description'
value=model.description controlType="textarea"
label=(t 'create.meta.input.description.label') label=(t 'create.meta.input.description.label')
placeholder=(t 'create.meta.input.description.placeholder') placeholder=(t 'create.meta.input.description.placeholder')
class='description' property="description"
}} }}
{{#fm-submit {{#bs-form-element}}
inputWrapperClass='col-sm-10 col-sm-offset-2' {{bs-button
}} defaultText=(t 'create.next')
{{t 'create.next'}} type="primary"
{{/fm-submit}} buttonType="submit"
{{/fm-form}} }}
{{/bs-form-element}}
{{/bs-form}}
</div> </div>

View file

@ -1,43 +1,57 @@
<div class="box"> <div class="box">
{{#fm-form action='submit'}} {{#bs-form
{{fm-field formLayout="horizontal"
type='select' model=this
content=answerTypes action="submit"
value=answerType }}
optionValuePath='id' {{#bs-form-element
optionLabelPath='label' classNames='answer-type'
label=(t 'create.settings.answerType.label') label=(t 'create.settings.answerType.label')
errors=validations.attrs.answerType.messages property="answerType"
class='answer-type' as |value id|
}} }}
{{fm-field {{simple-select
type='select' id=id
content=expirationDurations content=answerTypes
value=expirationDuration optionLabelPath="label"
optionValuePath='id' optionValuePath="id"
optionLabelPath='label' value=value
action=(action (mut value) value='id')
}}
{{/bs-form-element}}
{{#bs-form-element
classNames='expiration-duration'
label=(t 'create.settings.expirationDate.label') label=(t 'create.settings.expirationDate.label')
errors=validations.attrs.expirationDuration.messages property='expirationDuration'
class='expiration-duration' as |value id|
}} }}
{{fm-checkbox {{simple-select
checked=anonymousUser id=id
content=expirationDurations
optionLabelPath='label'
optionValuePath='id'
value=value
action=(action (mut value) value='id')
}}
{{/bs-form-element}}
{{bs-form-element
classNames='anonymous-user'
controlType='checkbox'
label=(t 'create.settings.anonymousUser.label') label=(t 'create.settings.anonymousUser.label')
errors=validations.attrs.anonymousUser.messages value=anonymousUser
class='anonymous-user'
inputWrapperClass='col-sm-10 col-sm-offset-2'
}} }}
{{fm-checkbox {{bs-form-element
checked=forceAnswer classNames='force-answer'
controlType='checkbox'
label=(t 'create.settings.forceAnswer.label') label=(t 'create.settings.forceAnswer.label')
errors=validations.attrs.forceAnswer.messages value=forceAnswer
class='force-answer'
inputWrapperClass='col-sm-10 col-sm-offset-2'
}} }}
{{#fm-submit {{#bs-form-element}}
inputWrapperClass='col-sm-10 col-sm-offset-2' {{bs-button
}} defaultText=(t 'create.next')
{{t 'create.next'}} type="primary"
{{/fm-submit}} buttonType="submit"
{{/fm-form}} }}
{{/bs-form-element}}
{{/bs-form}}
</div> </div>

View file

@ -62,6 +62,7 @@
"ember-i18n-cp-validations": "2.2.0", "ember-i18n-cp-validations": "2.2.0",
"ember-moment": "4.1.0", "ember-moment": "4.1.0",
"ember-radio-button": "^0.1.2", "ember-radio-button": "^0.1.2",
"ember-simple-select": "0.5.0",
"ember-suave": "1.2.3", "ember-suave": "1.2.3",
"ember-truth-helpers": "1.2.0", "ember-truth-helpers": "1.2.0",
"express": "^4.8.5", "express": "^4.8.5",