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
// This is heavily based on Backbone.SubRoute (https://github.com/ModelN/backbone.subroute) by Dave Cadwallader, who | |
// helped me out in this discussion thread: | |
// https://groups.google.com/forum/?fromgroups=#!topic/backbone-marionette/KTw7USoA6Gs | |
;define([ | |
'underscore', | |
'marionette' | |
], | |
/** | |
* A module that defines and adds Marionette.SubAppRouter to the Marionette object |
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
define([ | |
"underscore", | |
"backbone", | |
"marionette", | |
"vent" | |
], | |
/** | |
* Creates the primary `Marionette.Application` object that runs the admin framework. Provides a central point | |
* from which all other sub-applications are started, shown, hidden, and stopped. |
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 result = Marionette.ItemView.prototype.render.apply(this, arguments); | |
// FIX: Issue 351 - https://github.com/marionettejs/backbone.marionette/pull/351 | |
// inject regions into template | |
var that = this; | |
_.each(this.regionManagers, function(region){ | |
if (region.currentView) { | |
that.$el.find(region.el).html(region.currentView.$el); | |
} | |
}); |
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 SelectView = Marionette.ItemView.extend({ | |
initialize: function(options) { | |
this.bindTo(this, "selected", onSelect); | |
this.bindTo(this, "deselected", onDeselect); | |
}, | |
onSelect: function() { | |
this.model.fetch(); | |
}, |
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
// This code assumes you start all your sub-apps during the root-app's init | |
// phase. If not, this same logic can be bound to a different event (ex. start). | |
rootApp.on("initialize:after", function () { | |
vent.trigger("system:default:region:set", rootApp.body); | |
}); | |
// Then in some other sub-application | |
define([ | |
'marionette', | |
'mysupervent' |
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
/** | |
* jQuery UI Toggle Switch | |
* | |
* http://taitems.tumblr.com/post/17853682273/jquery-ui-toggleswitch-ux-lab-005 | |
* | |
* Depends: | |
* jquery.ui.slider.js | |
*/ | |
(function (factory) { | |
if (typeof exports === 'object') { |
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
/** | |
* Converts a "flat" object with namespaced keys into a hierarchical object | |
* @param {object} flat - A "flat" object with namespaced keys to turn into a hierarchical object | |
* @returns object - the hierarchical object | |
*/ | |
var _paths2obj = function (flat) { | |
var root = {}, | |
keys = _.keys(flat), | |
parts, entry, currentPart, pointer, i, il; | |
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
define([ | |
'jquery', | |
'underscore', | |
'text!./skeletonMarkup.html', | |
'jqueryui/widget', | |
'jqueryui/sortable', | |
'jqueryui/spinner' | |
], function ($, _, markup) { | |
'use strict'; |
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
// Use AMD loader if present, if not use global jQuery | |
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD. Register as an anonymous module. | |
define(['jquery'], factory); | |
} else { | |
// Browser globals | |
factory(root.jQuery); | |
} | |
}(this, function ($) { |
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
(function (root, factory) { | |
if (typeof define === 'function' && define.amd) { | |
// AMD. Register as an anonymous module. | |
define(['jquery'], factory); | |
} else { | |
// Browser globals | |
factory(root.jQuery); | |
} | |
}(this, function ($) { | |
OlderNewer