Skip to content

Instantly share code, notes, and snippets.

@belackriv
Created June 2, 2015 13:54
Show Gist options
  • Save belackriv/e7ac085e6211aa7b19e5 to your computer and use it in GitHub Desktop.
Save belackriv/e7ac085e6211aa7b19e5 to your computer and use it in GitHub Desktop.
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