Sha256: 8758f5c837cb10f509afe54ed90f24b9f92cb824476635906181fd131f430f42

Contents?: true

Size: 1.26 KB

Versions: 11

Compression:

Stored size: 1.26 KB

Contents

Informant.AppController = Backbone.Controller.extend({
  routes: {
    "/": "root",
    "/locus/:locusId/entries": "entryIndex",
    "/locus/:locusId/entries/new": "entryNew",
    "/locus/:locusId/entries/:entryId/edit": "entryEdit",
    "/locus/:locusId/buckets/:bucketId/entries": "entryIndex"
  },
  
  initialize: function(options) {
    this._current_nav_link = window.location.hash;
    this._locus = new Informant.LocusList();
    this._sidebar = new Informant.SidebarView({ collection: this._locus });
    this._entryIndex = new Informant.EntryIndexView();
    this._locus.fetch();
  },
  
  root: function() {
  },

  entryIndex: function(locusId,bucketId) {
    var locus = this._locus.get(locusId);
    if ( bucketId ) {
      var bucket = locus.buckets.get(bucketId);
    }    
    var entries = (bucket || locus).entries

    this._current_nav_link = entries.path();
    this._entryIndex.render(entries);
  },
  
  entryNew: function(locusId) {
    var locus = this._locus.get(locusId);
    var entry = locus.entries.add().last();
    new Informant.EntryEditView({ model: entry });
  },
  
  entryEdit: function(locusId,entryId) {
    var locus = this._locus.get(locusId);
    var entry = locus.entries.get(entryId);
    new Informant.EntryEditView({ model: entry });
  }
    
});

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
c2-0.1.13 public/javascripts/c2/informant/controllers/app.js
c2-0.1.12 public/javascripts/c2/informant/controllers/app.js
c2-0.1.11 public/javascripts/c2/informant/controllers/app.js
c2-0.1.10 public/javascripts/c2/informant/controllers/app.js
c2-0.1.9 public/javascripts/c2/informant/controllers/app.js
c2-0.1.8 public/javascripts/c2/informant/controllers/app.js
c2-0.1.7 public/javascripts/c2/informant/controllers/app.js
c2-0.1.6 public/javascripts/c2/informant/controllers/app.js
c2-0.1.5 public/javascripts/c2/informant/controllers/app.js
c2-0.1.4 public/javascripts/c2/informant/controllers/app.js
c2-0.1.3 public/javascripts/c2/informant/controllers/app.js