Skip to content

Instantly share code, notes, and snippets.

@smoyte
Created August 23, 2013 00:05
Show Gist options
  • Select an option

  • Save smoyte/6314207 to your computer and use it in GitHub Desktop.

Select an option

Save smoyte/6314207 to your computer and use it in GitHub Desktop.

Revisions

  1. Thomas Smyth renamed this gist Aug 23, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. Thomas Smyth created this gist Aug 23, 2013.
    33 changes: 33 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    window.Myember = Ember.Application.create();

    Myember.Router.map(function () {
    this.resource('kb_glyprobs', {path: '/glycemic-problems'}, function() {
    this.route('page', { path: '/page/:page_id' });
    });
    });

    Myember.KbGlyprobsPageRoute = Ember.Route.extend({
    model: function(params) {
    return Myember.KbGlyprobPage.find(params.page_id);
    },
    renderTemplate: function() {
    this.render('foo1');
    },
    serialize: function(model) {
    return {page_id: model.page_id};
    }
    });

    Myember.KbGlyprobPage = Ember.Object.extend({
    });

    Myember.KbGlyprobPage.reopenClass({
    find: function(page_id) {
    return {
    page_id: page_id,
    other_pages: [Myember.KbGlyprobPage.create({page_id: 2}), Myember.KbGlyprobPage.create({page_id: 3})],
    // imagine these were objects fetched from server
    objs: [Ember.Object.create({id: 11}), Ember.Object.create({id: 12}), Ember.Object.create({id: 13})]
    };
    }
    });