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() {
this.get('i18n.locale');
},

View file

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

View file

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

View file

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

View file

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