Skip to content

Instantly share code, notes, and snippets.

@kyleshevlin
Created October 19, 2016 18:53

Revisions

  1. kyleshevlin revised this gist Oct 19, 2016. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion templates.application.hbs
    Original file line number Diff line number Diff line change
    @@ -16,5 +16,4 @@
    {{#w.section as |h|}}
    {{h.contact}}
    {{/w.section}}

    {{/my-wrap}}
  2. kyleshevlin created this gist Oct 19, 2016.
    4 changes: 4 additions & 0 deletions components.my-contact.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    });
    4 changes: 4 additions & 0 deletions components.my-mission.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    });
    4 changes: 4 additions & 0 deletions components.my-news.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    });
    4 changes: 4 additions & 0 deletions components.my-panel.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    });
    4 changes: 4 additions & 0 deletions components.my-section.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    });
    4 changes: 4 additions & 0 deletions components.my-wrap.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    import Ember from 'ember';

    export default Ember.Component.extend({
    });
    6 changes: 6 additions & 0 deletions controllers.application.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    import Ember from 'ember';

    export default Ember.Controller.extend({
    appName: 'Ember Twiddle',
    panels: [1, 2, 3] // this could be any number of items
    });
    20 changes: 20 additions & 0 deletions templates.application.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    {{#my-wrap as |w|}}
    {{#each panels as |panel|}}
    {{#w.section item=panel as |p|}}
    {{p.panel}}
    {{/w.section}}
    {{/each}}

    {{#w.section as |f|}}
    {{f.mission}}
    {{/w.section}}

    {{#w.section as |g|}}
    {{g.news}}
    {{/w.section}}

    {{#w.section as |h|}}
    {{h.contact}}
    {{/w.section}}

    {{/my-wrap}}
    3 changes: 3 additions & 0 deletions templates.components.my-contact.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <p>
    And a contact section that goes here.
    </p>
    3 changes: 3 additions & 0 deletions templates.components.my-mission.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <p>
    My mission is to figure out how to let my parent component assign indexes to these damn children or some other attribute I can test against and figure out which one is the "active" child component in the viewport!
    </p>
    3 changes: 3 additions & 0 deletions templates.components.my-news.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <p>
    There's a news section in the app here.
    </p>
    1 change: 1 addition & 0 deletions templates.components.my-panel.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    Panel: {{item}}
    8 changes: 8 additions & 0 deletions templates.components.my-section.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    {{yield
    (hash
    panel=(component 'my-panel' item=item)
    mission=(component 'my-mission')
    news=(component 'my-news')
    contact=(component 'my-contact')
    )
    }}
    3 changes: 3 additions & 0 deletions templates.components.my-wrap.hbs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    <div class="wrap-inner">
    {{yield (hash section=(component 'my-section' item=item))}}
    </div>
    5 changes: 5 additions & 0 deletions tests.helpers.destroy-app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    import Ember from 'ember';

    export default function destroyApp(application) {
    Ember.run(application, 'destroy');
    }
    11 changes: 11 additions & 0 deletions tests.helpers.resolver.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    import Resolver from '../../resolver';
    import config from '../../config/environment';

    const resolver = Resolver.create();

    resolver.namespace = {
    modulePrefix: config.modulePrefix,
    podModulePrefix: config.podModulePrefix
    };

    export default resolver;
    21 changes: 21 additions & 0 deletions tests.helpers.start-app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    import Ember from 'ember';
    import Application from '../../app';
    import config from '../../config/environment';

    const { run } = Ember;
    const assign = Ember.assign || Ember.merge;

    export default function startApp(attrs) {
    let application;

    let attributes = assign({rootElement: "#test-root"}, config.APP);
    attributes = assign(attributes, attrs); // use defaults, but you can override;

    run(() => {
    application = Application.create(attributes);
    application.setupForTesting();
    application.injectTestHelpers();
    });

    return application;
    }
    6 changes: 6 additions & 0 deletions tests.test-helper.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    import resolver from './helpers/resolver';
    import {
    setResolver
    } from 'ember-qunit';

    setResolver(resolver);
    18 changes: 18 additions & 0 deletions twiddle.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    {
    "version": "0.10.6",
    "EmberENV": {
    "FEATURES": {}
    },
    "options": {
    "use_pods": false,
    "enable-testing": false
    },
    "dependencies": {
    "jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js",
    "ember": "2.9.0",
    "ember-data": "2.9.0",
    "ember-template-compiler": "2.9.0",
    "ember-testing": "2.9.0"
    },
    "addons": {}
    }