From 35ce4d76a6943f587ba795fb9957c8644bdbef85 Mon Sep 17 00:00:00 2001 From: Todd Jordan Date: Tue, 2 Aug 2016 15:38:07 -0400 Subject: [PATCH] intermediate work on renderer --- addon/components/dynamic-form.js | 3 ++- addon/dynamic-forms/renderers/ember.js | 5 ++--- app/dynamic-forms/renderers/ember.js | 3 +++ app/renderers/alpaca.js | 3 --- index.js | 2 +- tests/dummy/config/environment.js | 4 ++++ 6 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 app/dynamic-forms/renderers/ember.js delete mode 100644 app/renderers/alpaca.js diff --git a/addon/components/dynamic-form.js b/addon/components/dynamic-form.js index 63612e2..52fde18 100644 --- a/addon/components/dynamic-form.js +++ b/addon/components/dynamic-form.js @@ -23,13 +23,14 @@ const DynamicForm = Ember.Component.extend({ let container = getOwner(this); let config = container.resolveRegistration('config:environment'); if (config.dynamicForms && config.dynamicForms.renderer) { + Ember.Logger.debug('found renderer', config.dynamicForms.renderer); renderer = container.lookup(`${config.dynamicForms.renderer}:dynamic-forms.renderers`); } else { renderer = container.lookup('alpaca:dynamic-forms.renderers'); } this.set('_renderer', renderer); } - renderer.render(this.get('renderSchema'), this.$()); + renderer.render(this.get('renderSchema'), this); }, didInsertElement() { diff --git a/addon/dynamic-forms/renderers/ember.js b/addon/dynamic-forms/renderers/ember.js index 316b558..8fdf1fa 100644 --- a/addon/dynamic-forms/renderers/ember.js +++ b/addon/dynamic-forms/renderers/ember.js @@ -2,11 +2,10 @@ import Ember from 'ember'; export default Ember.Object.extend({ render(schema, component) { + Ember.Logger.debug('render!'); component.set('layout', Ember.computed(function () { return Ember.HTMLBars.compile(` - {{#each fields as |field|}} - {{component field.type}} - {{/each}} + hello world `); })); // iterate fields in schema diff --git a/app/dynamic-forms/renderers/ember.js b/app/dynamic-forms/renderers/ember.js new file mode 100644 index 0000000..faccafd --- /dev/null +++ b/app/dynamic-forms/renderers/ember.js @@ -0,0 +1,3 @@ +import Ember from 'ember-cli-dynamic-forms/dynamic-forms/renderers/ember'; + +export default Ember; diff --git a/app/renderers/alpaca.js b/app/renderers/alpaca.js deleted file mode 100644 index 3416ac3..0000000 --- a/app/renderers/alpaca.js +++ /dev/null @@ -1,3 +0,0 @@ -import Alpaca from 'ember-cli-dynamic-forms/renderers/alpaca'; - -export default Alpaca; diff --git a/index.js b/index.js index db8ba68..d6e2227 100644 --- a/index.js +++ b/index.js @@ -31,6 +31,6 @@ module.exports = { }, isDevelopingAddon: function () { - return false; + return true; } }; diff --git a/tests/dummy/config/environment.js b/tests/dummy/config/environment.js index c59bcd5..5d7dde6 100644 --- a/tests/dummy/config/environment.js +++ b/tests/dummy/config/environment.js @@ -43,5 +43,9 @@ module.exports = function(environment) { } + ENV.dynamicForms = { + renderer: 'ember' + }; + return ENV; };