Skip to content

Instantly share code, notes, and snippets.

@acorncom
Created October 6, 2016 15:36
Show Gist options
  • Save acorncom/2bc15bb888bfec58faf62c523e7e0566 to your computer and use it in GitHub Desktop.
Save acorncom/2bc15bb888bfec58faf62c523e7e0566 to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
import config from './config/environment';
const Router = Ember.Router.extend({
location: config.locationType,
rootURL: config.rootURL
});
Router.map(function() {
this.route('app', function() {
this.route('dashboard', function() {
this.route('overview');
}
);
this.route('conversations');
this.route('analytics');
});
});
export default Router;
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
classNames: ['app-navigation']
});
import Ember from 'ember';
let navItems = [{
title: 'Dashboard',
url: 'app.dashboard',
subItems: [
{
title: 'Overview',
    url: 'app.dashboard.overview'
}, {
title: 'Title',
    url: 'app.dashboard.overview'
}
]
}, {
title: 'Conversations',
url: 'app.conversations'
}, {
title: 'Analytics',
url: 'app.analytics',
subItems: [
{
title: 'Overview',
    url: 'app.dashboard.overview'
}, {
title: 'Title',
    url: 'app.dashboard.overview'
}
]
}];
export default Ember.Route.extend({
model() {
return navItems;
},
renderTemplate(controller, model) {
// render the standard template
this._super(controller, model);
// Render the nav into the application template
this.render('app-navigation', {
into: 'app',
outlet: 'nav-menu'
});
},
init: function() {
Ember.$(function() {
Ember.$('nav#menu').mmenu();
});
}
});
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
import Ember from 'ember';
export default Ember.Route.extend({
});
<nav id="menu">
<ul>
{{#each model as |navItems|}}
<li>
{{#if navItems.subItems}}
<span>{{navItems.title}}</span>
<ul>
{{#each navItems.subItems as |subitem|}}
<li>
{{#link-to subitem.url}}
{{subitem.title}}
{{/link-to}}
</li>
{{/each}}
</ul>
{{else}}
{{#link-to navItems.url}}
{{navItems.title}}
{{/link-to}}
{{/if}}
</li>
{{/each}}
</ul>
</nav>
<div id="page">
<div class="header">
</div>
{{outlet 'nav-menu'}}
<div class="app-body">
{{outlet}}
</div>
</div>
import Ember from 'ember';
export default function destroyApp(application) {
Ember.run(application, 'destroy');
}
import Resolver from '../../resolver';
import config from '../../config/environment';
const resolver = Resolver.create();
resolver.namespace = {
modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix
};
export default resolver;
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;
}
import resolver from './helpers/resolver';
import {
setResolver
} from 'ember-qunit';
setResolver(resolver);
{
"version": "0.10.5",
"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.8.0",
"ember-data": "2.8.0",
"ember-template-compiler": "2.8.0",
"ember-testing": "2.8.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment