From 72513bf893631ba773b7f23a260aad63f24cc7a5 Mon Sep 17 00:00:00 2001 From: jelhan Date: Mon, 6 Jun 2016 01:03:12 +0200 Subject: [PATCH] remove ember-form-master-2000 --- app/components/fm-input-group.js | 54 ----------------- app/components/fm-input.js | 6 -- app/components/fm-radio.js | 5 -- app/routes/application.js | 10 +--- .../ember-form-master-2000/fm-radio.hbs | 11 ---- app/templates/components/fm-input-group.hbs | 60 ------------------- package.json | 1 - .../components/fm-input-group-test.js | 12 ---- tests/unit/components/fm-input-group-test.js | 19 ------ 9 files changed, 1 insertion(+), 177 deletions(-) delete mode 100644 app/components/fm-input-group.js delete mode 100644 app/components/fm-input.js delete mode 100644 app/components/fm-radio.js delete mode 100644 app/templates/components/ember-form-master-2000/fm-radio.hbs delete mode 100644 app/templates/components/fm-input-group.hbs delete mode 100644 tests/integration/components/fm-input-group-test.js delete mode 100644 tests/unit/components/fm-input-group-test.js diff --git a/app/components/fm-input-group.js b/app/components/fm-input-group.js deleted file mode 100644 index 185e831..0000000 --- a/app/components/fm-input-group.js +++ /dev/null @@ -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 -}); diff --git a/app/components/fm-input.js b/app/components/fm-input.js deleted file mode 100644 index 6c6437a..0000000 --- a/app/components/fm-input.js +++ /dev/null @@ -1,6 +0,0 @@ -import FmInput from 'ember-form-master-2000/components/fm-input'; -export default FmInput.reopen({ - polyfill: function() { - this.$().updatePolyfill(); - }.on('didInsertElement') -}); diff --git a/app/components/fm-radio.js b/app/components/fm-radio.js deleted file mode 100644 index 64fadf1..0000000 --- a/app/components/fm-radio.js +++ /dev/null @@ -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 -}); diff --git a/app/routes/application.js b/app/routes/application.js index eac2b95..6eb3210 100644 --- a/app/routes/application.js +++ b/app/routes/application.js @@ -18,13 +18,5 @@ export default Ember.Route.extend({ 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') + } }); diff --git a/app/templates/components/ember-form-master-2000/fm-radio.hbs b/app/templates/components/ember-form-master-2000/fm-radio.hbs deleted file mode 100644 index 22c7862..0000000 --- a/app/templates/components/ember-form-master-2000/fm-radio.hbs +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/app/templates/components/fm-input-group.hbs b/app/templates/components/fm-input-group.hbs deleted file mode 100644 index 2adc51b..0000000 --- a/app/templates/components/fm-input-group.hbs +++ /dev/null @@ -1,60 +0,0 @@ -{{#each content as |element index|}} -
- {{!-- - 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}} - - {{/unless}} - -
- {{!-- 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}} -
- -
- - -
- - {{#if element.validations.attrs.value.messages}} - {{#if shouldShowErrors}} -
- {{fm-errortext errors=element.validations.attrs.value.messages}} -
- {{/if}} - {{/if}} -
-{{/each}} - -{{#if showErrors}} -
- {{fm-errortext errors=errors}} -
-{{/if}} diff --git a/package.json b/package.json index 1c6922f..75475bb 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,6 @@ "ember-data-model-fragments": "1.13.1", "ember-disable-proxy-controllers": "^1.0.1", "ember-export-application-global": "^1.0.4", - "ember-form-master-2000": "jelhan/ember-form-master-2000#merged", "ember-get-helper": "1.0.4", "ember-group-by": "0.0.3", "ember-i18n": "4.1.4", diff --git a/tests/integration/components/fm-input-group-test.js b/tests/integration/components/fm-input-group-test.js deleted file mode 100644 index 29acc04..0000000 --- a/tests/integration/components/fm-input-group-test.js +++ /dev/null @@ -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')); -}); diff --git a/tests/unit/components/fm-input-group-test.js b/tests/unit/components/fm-input-group-test.js deleted file mode 100644 index a42a6bc..0000000 --- a/tests/unit/components/fm-input-group-test.js +++ /dev/null @@ -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'); -});