This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var App = new Backbone.Marionette.Application(); | |
App.addRegions({ | |
main: '#main' | |
}); | |
App.addInitializer(function() { | |
console.log('here'); | |
App.main.show(new MainLayout()) | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#form').submit(function(e) { | |
e.preventDefault(); | |
var data = { | |
subject: $('[name=body]).val(), | |
body: $('[name=body]).val() | |
}; | |
$.ajax({ | |
url: SALES_FORCE_URL, | |
method: 'POST', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
(function(){ | |
function customScript() { | |
/* Your custom code */ | |
} | |
if (window.addEventListener) { | |
window.addEventListener("load",customScript,false); | |
} else if (window.attachEvent) { | |
window.attachEvent("onload",customScript); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
(function() { | |
function customScript() { | |
/* Your custom code */ | |
} | |
if (window.addEventListener) { | |
window.addEventListener("load",customScript,false); | |
} else if (window.attachEvent) { | |
window.attachEvent("onload",customScript); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
(function() { | |
function customScript() { | |
/* Your custom code */ | |
} | |
if (window.addEventListener) { | |
window.addEventListener("load",customScript,false); | |
} else if (window.attachEvent) { | |
window.attachEvent("onload",customScript); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Pass a Model class to modify. Will prevent concurrent ajax calls on model instances, instead queueing each call to `save`/`destroy`/`fetch` and running them sequentially. | |
// save/fetch/destroy still return jquery deferred promises so usage shoud not change. | |
function sequentialSyncModel(Model) { | |
function getWrappedMethod(method) { | |
return function() { | |
if (!this._steps) { | |
this._steps = []; | |
} | |
var currentArgs = arguments.length ? Array.prototype.slice.call(arguments, 0) : []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = new Application(); | |
App.selectedTodos = new Backbone.Collection(); | |
// List Route | |
const collection = new TodoCollection(); | |
collection.fetch().then(() => { | |
const listView = new ListView({collection}).render(); | |
}); | |
// ListView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should be able to select a TodoModel', () => { | |
const collection = new TodoCollection(); | |
const listView = new ListView({collection}); | |
const model = new TodoModel(); | |
listView.select(model); // Throws exception - App is not defined! | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it('should be able to select a TodoModel', () => { | |
const collection = new TodoCollection(); | |
const selectedTodos = new TodoCollection(); | |
const listView = new ListView({collection, selectedTodos}); | |
const model = new TodoModel(); | |
listView.select(model); // Works great! | |
expect(listView.isSelected(model)).toBe(true); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const App = new Application(); | |
App.selectedTodos = new Backbone.Collection(); | |
// List Route | |
const collection = new TodoCollection(); | |
collection.fetch().then(() => { | |
const listView = new ListView({ | |
collection, | |
selectedTodos: App.selectedTodos | |
}).render(); |
OlderNewer