remove ember-form-master-2000
This commit is contained in:
parent
5b8d59c00b
commit
72513bf893
9 changed files with 1 additions and 177 deletions
|
@ -1,54 +0,0 @@
|
||||||
import Ember from 'ember';
|
|
||||||
|
|
||||||
export default Ember.Component.extend({
|
|
||||||
actions: {
|
|
||||||
add(element) {
|
|
||||||
this.sendAction('addElement', element);
|
|
||||||
},
|
|
||||||
|
|
||||||
del(element) {
|
|
||||||
if (this.get('canDeleteInputFields')) {
|
|
||||||
this.sendAction('deleteElement', element);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
userInteraction() {
|
|
||||||
if (!this.get('shouldShowErrors')) {
|
|
||||||
this.set('shouldShowErrors', true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
canDeleteInputFields: Ember.computed('minimumInputFields', 'content.[]', function() {
|
|
||||||
if (this.get('content.length') > this.get('minimumInputFields')) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
canNotDeleteInputFields: Ember.computed('canDeleteInputFields', function() {
|
|
||||||
return !this.get('canDeleteInputFields');
|
|
||||||
}),
|
|
||||||
|
|
||||||
classNames: ['grouped-input'],
|
|
||||||
classNameBindings: ['errorClass'],
|
|
||||||
|
|
||||||
errors: [],
|
|
||||||
|
|
||||||
errorClass: Ember.computed('showErrors', 'errors', function() {
|
|
||||||
if (this.get('showErrors')) {
|
|
||||||
return this.get('fmConfig').errorClass;
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
fmConfig: Ember.inject.service('fm-config'),
|
|
||||||
|
|
||||||
minimumInputFields: 1,
|
|
||||||
|
|
||||||
shouldShowErrors: false,
|
|
||||||
|
|
||||||
step: undefined,
|
|
||||||
|
|
||||||
type: undefined
|
|
||||||
});
|
|
|
@ -1,6 +0,0 @@
|
||||||
import FmInput from 'ember-form-master-2000/components/fm-input';
|
|
||||||
export default FmInput.reopen({
|
|
||||||
polyfill: function() {
|
|
||||||
this.$().updatePolyfill();
|
|
||||||
}.on('didInsertElement')
|
|
||||||
});
|
|
|
@ -1,5 +0,0 @@
|
||||||
import FmRadio from 'ember-form-master-2000/components/fm-radio';
|
|
||||||
import layout from 'croodle/templates/components/ember-form-master-2000/fm-radio';
|
|
||||||
export default FmRadio.reopen({
|
|
||||||
layout
|
|
||||||
});
|
|
|
@ -18,13 +18,5 @@ export default Ember.Route.extend({
|
||||||
parentView: 'application'
|
parentView: 'application'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
beforeModel() {
|
|
||||||
this.set('fmConfig.formClass', 'form-horizontal');
|
|
||||||
this.set('fmConfig.inputWrapperClass', 'col-sm-10');
|
|
||||||
this.set('fmConfig.labelClass', 'col-sm-2 control-label');
|
|
||||||
},
|
|
||||||
|
|
||||||
fmConfig: Ember.inject.service('fm-config')
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
<label>
|
|
||||||
<input type='radio'
|
|
||||||
name={{parentView.name}}
|
|
||||||
value={{get content optionValuePath}}
|
|
||||||
checked={{checked}}>
|
|
||||||
<span class={{get content optionValuePath}}>
|
|
||||||
<span class={{content.icon}}></span>
|
|
||||||
{{get content optionLabelPath}}
|
|
||||||
{{isSelected}}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
|
@ -1,60 +0,0 @@
|
||||||
{{#each content as |element index|}}
|
|
||||||
<div class='form-group {{if (and shouldShowErrors (get element elementErrorsPath)) "has-error"}}'>
|
|
||||||
{{!--
|
|
||||||
index should be false for first element
|
|
||||||
so we could use an if helper to determine
|
|
||||||
if label should be passed in or not
|
|
||||||
--}}
|
|
||||||
{{#unless index}}
|
|
||||||
<label class='col-sm-2 col-md-2 control-label'>{{label}}</label>
|
|
||||||
{{/unless}}
|
|
||||||
|
|
||||||
<div class='col-sm-8 col-md-9 col-xs-10 {{if index 'col-sm-offset-2 col-md-offset-2'}}'>
|
|
||||||
{{!-- ToDo:
|
|
||||||
property of element used as value should be configurable
|
|
||||||
(mut (get element 'title')) does not work
|
|
||||||
perhaps it's only working since Ember 2.2 ?
|
|
||||||
https://guides.emberjs.com/v2.2.0/templates/input-helpers/#toc_binding-dynamic-attribute
|
|
||||||
--}}
|
|
||||||
{{fm-input
|
|
||||||
class='form-control'
|
|
||||||
step=step
|
|
||||||
type=type
|
|
||||||
value=element.title
|
|
||||||
errors=(get element elementErrorsPath)
|
|
||||||
onUserInteraction='userInteraction'
|
|
||||||
}}
|
|
||||||
|
|
||||||
{{#if shouldShowErrors}}
|
|
||||||
{{#if (get element elementErrorsPath)}}
|
|
||||||
{{fm-errortext errors=(get element elementErrorsPath)}}
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class='col-sm-2 col-md-1 col-xs-2'>
|
|
||||||
<button {{action 'del' element}} class="delete" disabled={{canNotDeleteInputFields}}>
|
|
||||||
<span class='glyphicon glyphicon-trash' aria-hidden='true'></span>
|
|
||||||
<span class='sr-only'>{{t 'create.options.button.delete.label'}}</span>
|
|
||||||
</button>
|
|
||||||
<button {{action 'add' element}} class="add">
|
|
||||||
<span class='glyphicon glyphicon-plus' aria-hidden='true'></span>
|
|
||||||
<span class='sr-only'>{{t 'create.options.button.add.label'}}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{#if element.validations.attrs.value.messages}}
|
|
||||||
{{#if shouldShowErrors}}
|
|
||||||
<div class='col-sm-10 col-sm-offset-2 has-error'>
|
|
||||||
{{fm-errortext errors=element.validations.attrs.value.messages}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/each}}
|
|
||||||
|
|
||||||
{{#if showErrors}}
|
|
||||||
<div class='col-sm-10 col-sm-offset-2'>
|
|
||||||
{{fm-errortext errors=errors}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
|
@ -55,7 +55,6 @@
|
||||||
"ember-data-model-fragments": "1.13.1",
|
"ember-data-model-fragments": "1.13.1",
|
||||||
"ember-disable-proxy-controllers": "^1.0.1",
|
"ember-disable-proxy-controllers": "^1.0.1",
|
||||||
"ember-export-application-global": "^1.0.4",
|
"ember-export-application-global": "^1.0.4",
|
||||||
"ember-form-master-2000": "jelhan/ember-form-master-2000#merged",
|
|
||||||
"ember-get-helper": "1.0.4",
|
"ember-get-helper": "1.0.4",
|
||||||
"ember-group-by": "0.0.3",
|
"ember-group-by": "0.0.3",
|
||||||
"ember-i18n": "4.1.4",
|
"ember-i18n": "4.1.4",
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
|
||||||
import hbs from 'htmlbars-inline-precompile';
|
|
||||||
|
|
||||||
moduleForComponent('fm-input-group', 'Integration | Component | fm input group', {
|
|
||||||
integration: true
|
|
||||||
});
|
|
||||||
|
|
||||||
test('has class input-group', function(assert) {
|
|
||||||
this.render(hbs`{{fm-input-group}}`);
|
|
||||||
|
|
||||||
assert.ok(this.$('div').hasClass('grouped-input'));
|
|
||||||
});
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { moduleForComponent, test } from 'ember-qunit';
|
|
||||||
|
|
||||||
moduleForComponent('fm-input-group', 'Unit | Component | fm input group', {
|
|
||||||
// Specify the other units that are required for this test
|
|
||||||
// needs: ['component:foo', 'helper:bar'],
|
|
||||||
unit: true
|
|
||||||
});
|
|
||||||
|
|
||||||
test('it renders', function(assert) {
|
|
||||||
assert.expect(2);
|
|
||||||
|
|
||||||
// Creates the component instance
|
|
||||||
let component = this.subject();
|
|
||||||
assert.equal(component._state, 'preRender');
|
|
||||||
|
|
||||||
// Renders the component to the page
|
|
||||||
this.render();
|
|
||||||
assert.equal(component._state, 'inDOM');
|
|
||||||
});
|
|
Loading…
Reference in a new issue