Skip to content

Instantly share code, notes, and snippets.

@dadamssg
Created April 24, 2015 20:33
Show Gist options
  • Save dadamssg/d03fb1e32016ae79404e to your computer and use it in GitHub Desktop.
Save dadamssg/d03fb1e32016ae79404e to your computer and use it in GitHub Desktop.
// app/routes/category/index.js
import Ember from 'ember';
import Protected from '../protected';
export default Protected.extend({
model: function (params) {
var url = this.store.adapterFor('application').getBaseUrl() + '/categories/'+ params.category + '/assets';
this.controllerFor('categories').set('activeCategory', params.category);
return Ember.$.getJSON(url).then(function (data) {
return data.assets;
});
}
});
import Ember from 'ember';
import config from './config/environment';
var Router = Ember.Router.extend({
location: config.locationType
});
export default Router.map(function() {
this.route('login', { path: '/login' });
this.route('register', { path: '/register' });
this.route('confirm', { path: '/confirm/:token'});
this.route('forgot', { path: '/forgot'});
this.route('change-password', { path: '/change-password/:token'});
this.resource('admin', { path: '/admin' }, function () {
this.resource('account', { path: '/account' }, function() {
this.route('picture', { path: '/picture'});
});
this.resource('categories', { path: '/categories' }, function () {
this.resource('category', { path: '/:category' }, function () {
this.route('add_asset', { path: '/add'});
});
});
this.resource('assets', { path: '/assets' }, function () {
this.route('asset', { path: '/:id' });
});
});
});
{{#link-to 'category.index' 'electronics' tagName="h4" class="pointer"}}
Electronics
{{/link-to}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment