This file contains hidden or 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
require([ | |
'mocha', | |
'chai', | |
'sinon', | |
'jquery', | |
'underscore', | |
'backbone', | |
'models/mixins/synced-promise' | |
], function(mocha, chai, sinon, jQuery, lodash, Backbone, sync){ |
This file contains hidden or 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
find ./ -iname "*.js" -type f -exec sed -i 's/\t/ /g' {} \; |
This file contains hidden or 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
/** | |
* Filterable mixin for collections that need multiple filters applied simultaneously. | |
* Useful when the collection is in a grid with filter views. | |
* | |
* @example | |
* // require filterable and mix into the consuming collection. | |
* var MyCollection = Backbone.Collection.extend({ | |
* // consuming collections are encouraged to expose custom filters. | |
* addTypeFilter: function(typeId){ | |
* return this.addFilter('type', function(model){ |
This file contains hidden or 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
/** | |
* @module Layout is a composite view of child views | |
* which are assigned to regions defined in the Layout's template | |
* denoted with `data-region="keyname"` attributes. | |
* These attributes correspond with a region property with a subview reference. | |
* Views can be assigned at instantiation or after. | |
* Like a faithful parent, Layout cleans up after it's child views. | |
* | |
* TOREVISIT: layoutable as mixin | |
* |
This file contains hidden or 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
{ | |
"folder_exclude_patterns": ["bower_components", "node_modules", "dist"], | |
"bold_folder_labels": false, | |
"caret_style": "wide", | |
"color_scheme": "Packages/Theme - Nil/Big Duo.tmTheme", | |
"colored_folder_glyphs": false, | |
"draw_white_space": "selection", | |
"ensure_newline_at_eof_on_save": true, | |
"fade_fold_buttons": false, | |
"font_size": 12, |
This file contains hidden or 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
/** | |
* ImageReady promises to inform when an image is loaded. | |
* | |
* uses es6-promises. | |
* inspired by: http://www.html5rocks.com/en/tutorials/es6/promises/ | |
* | |
* @example | |
* ready(elImg).then(function(img){ | |
* console.log('image is loaded'); | |
* }, function(err){ |
This file contains hidden or 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
/** | |
* View mixin to handle keyboard events. | |
* It requires patching for method overrides. | |
* | |
* @example | |
* var KeyedView = Backbone.View.extend({}); | |
* mixer.patch(KeyedView.prototype, keyable); | |
* | |
* var keyedView = new KeyedView({ | |
* keyboardEvents: { |
This file contains hidden or 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
/** | |
* edible adds contentEditable behavior to an element | |
* | |
* uses a subset of contenteditable API: | |
* https://developer.mozilla.org/en-US/docs/Rich-Text_Editing_in_Mozilla">content editable</a></p> | |
* | |
* inspired by | |
* https://github.com/mindmup/bootstrap-wysiwyg | |
* execCmd: | |
* https://developer.mozilla.org/en-US/docs/Rich-Text_Editing_in_Mozilla |
This file contains hidden or 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
/** | |
* backbone-promises returns ES6 Promises for Backbone.sync operations. | |
* @return {Object} monkey-patched Backbone. | |
* | |
*/ | |
define(['backbone-lib', 'es6-promise'], function(Backbone, Promise){ | |
// Backbone.ajax to return native ES6 promises for ajax calls insead of jQuery.Deferreds | |
Backbone.origAjax = Backbone.ajax; | |
Backbone.ajax = function ajax(){ |
This file contains hidden or 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
/* E */ | |
// Event style (current implementation) | |
var confirm = notifier.confirm('Are you sure?'); | |
this.listenTo(confirm, 'confirm', function(){ | |
// do something | |
}); | |
this.listenTo(confirm, 'cancel', function(){ | |
// recover | |
}); |