Created
June 2, 2015 13:54
-
-
Save belackriv/e7ac085e6211aa7b19e5 to your computer and use it in GitHub Desktop.
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 DialogRegion = Backbone.Marionette.Region.extend({ | |
el: '#form_dialog_div', | |
constructor: function () { | |
_.bindAll(this, "getEl", "showDialog", "hideDialog"); | |
Backbone.Marionette.Region.prototype.constructor.apply(this, arguments); | |
this.on("show", this.showDialog, this); | |
}, | |
getEl: function (selector) { | |
var $el = $(selector); | |
return $el; | |
}, | |
showDialog: function (view) { | |
view.on("close", this.hideDialog, this); | |
var dialogOptions = (typeof view.dialogOptions === 'function')?view.dialogOptions():view.dialogOptions; | |
this.$el.dialog(dialogOptions); | |
this.$el.dialog('open'); | |
}, | |
hideDialog: function () { | |
this.$el.dialog('close'); | |
} | |
}); | |
var BaseLayoutView = Backbone.Marionette.LayoutView.extend({ | |
template: "#base_layout_template", | |
regions: { | |
dialog: DialogRegion | |
}, | |
ui:{ | |
createButton: '.tsg-parts-entity-access-create-entry-button' | |
}, | |
events:{ | |
'click @ui.createButton': 'createNewEntry' | |
}, | |
createNewEntry: function(){ | |
this.showChildView('dialog', new EntityAccessListCreateNewDialogView({ | |
collection: this.getRegion('detailsTbody').currentView.collection | |
})); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment