Skip to content
This repository was archived by the owner on Oct 10, 2017. It is now read-only.

Commit

Permalink
converted to new marionette.wreqr
Browse files Browse the repository at this point in the history
  • Loading branch information
Derick Bailey committed Sep 27, 2012
1 parent 3c2cdeb commit d6669ac
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ BBCloneMail.module("MailApp.Categories", function(Categories, App, Backbone, Mar
var controller = new Controller();
Categories.controller = controller;

App.respondTo("mail:categories", controller.getAll, controller);
App.requestResponse.addHandler("mail:categories", controller.getAll, controller);
});

Categories.addFinalizer(function(){
App.removeRequestHandler("mail:categories");
App.requestResponse.removeHandler("mail:categories");
delete Categories.controller;
});
});
6 changes: 3 additions & 3 deletions public/javascripts/bbclonemail/bbclonemail.mailapp.mail.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ BBCloneMail.module("MailApp.Mail", function(Mail, App, Backbone, Marionette, $,
var controller = new Controller();
Mail.controller = controller;

App.respondTo("mail:inbox", controller.getAll, controller);
App.respondTo("mail:category", controller.getByCategory, controller);
App.requestResponse.addHandler("mail:inbox", controller.getAll, controller);
App.requestResponse.addHandler("mail:category", controller.getByCategory, controller);
});

Mail.addFinalizer(function(){
App.removeRequestHandler("mail:inbox");
App.requestResponse.removeHandler("mail:inbox");
delete Mail.controller;
});

Expand Down
8 changes: 4 additions & 4 deletions public/javascripts/bbclonemail/bbclonemail.mailapp.mailbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ BBCloneMail.module("MailApp.Mailbox", function(Mailbox, App, Backbone, Marionett

// Register command handlers to show a list of
// email items, or a single email item
App.registerCommand("show:mail:list", controller.showMailList, controller);
App.registerCommand("show:mail:item", controller.showMailItem, controller);
App.commands.addHandler("show:mail:list", controller.showMailList, controller);
App.commands.addHandler("show:mail:item", controller.showMailItem, controller);

Mailbox.controller = controller;
});

Mailbox.addFinalizer(function(){
App.removeCommand("show:mail:list");
App.removeCommand("show:mail:item");
App.commands.removeHandler("show:mail:list");
App.commands.removeHandler("show:mail:item");

delete Mailbox.controller;
});
Expand Down
3 changes: 0 additions & 3 deletions public/javascripts/vendor/marionette.wreqr.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ Backbone.Marionette.Wreqr = (function(Backbone, Marionette, _){
(function(){
"option strict";

console.log("foo");

if (Backbone && Backbone.Marionette && Backbone.Marionette.Application){
console.log("bar");

var commands = new Wreqr.Commands();
var reqres = new Wreqr.RequestResponse();
Expand Down
8 changes: 4 additions & 4 deletions spec/javascripts/inbox.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ describe("inbox", function(){
showMailListHandler = jasmine.createSpy("show mail list");
getInboxHandler = jasmine.createSpy("get inbox");

BBCloneMail.registerCommand("show:mail:list", showMailListHandler);
BBCloneMail.respondTo("mail:inbox", getInboxHandler);
BBCloneMail.commands.addHandler("show:mail:list", showMailListHandler);
BBCloneMail.requestResponse.addHandler("mail:inbox", getInboxHandler);

var emailItem = new Backbone.Model({id: 1});
var emailList = new Backbone.Collection([emailItem]);
Expand All @@ -17,8 +17,8 @@ describe("inbox", function(){
});

afterEach(function(){
BBCloneMail.removeCommand("show:mail:list");
BBCloneMail.removeRequestHandler("mail:inbox");
BBCloneMail.commands.removeHandler("show:mail:list");
BBCloneMail.requestResponse.removeHandler("mail:inbox");
});

describe("when viewing the inbox", function(){
Expand Down
4 changes: 2 additions & 2 deletions spec/javascripts/mailAppStart.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ describe("mail app start", function(){
var catCol = new Backbone.Collection([cat]);
getCategoriesHandler = jasmine.createSpy();
getCategoriesHandler.andReturn(catCol);
BBCloneMail.respondTo("mail:categories", getCategoriesHandler);
BBCloneMail.requestResponse.addHandler("mail:categories", getCategoriesHandler);

categoryNav = BBCloneMail.module("MailApp.CategoryNavigation");
categoryNav.start();
});

afterEach(function(){
categoryNav.stop();
BBCloneMail.removeRequestHandler("mail:categories");
BBCloneMail.requestResponse.removeHandler("mail:categories");
});

it("should show the list of categories", function(){
Expand Down

0 comments on commit d6669ac

Please sign in to comment.