From 6caed50915a006175b767644a03c32c3c7e84f6b Mon Sep 17 00:00:00 2001 From: cobbspur Date: Sat, 31 Aug 2013 20:10:17 +0100 Subject: [PATCH] Updates to modals issue #432 - adds configurable button classes - adds optional title - added afterRender callback - changed context for accept and reject methods --- core/client/tpl/modal.hbs | 6 +++--- core/client/views/base.js | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/core/client/tpl/modal.hbs b/core/client/tpl/modal.hbs index 44dd969bd2..6860803727 100644 --- a/core/client/tpl/modal.hbs +++ b/core/client/tpl/modal.hbs @@ -1,12 +1,12 @@
- + {{#if content.title}}{{/if}} {{#if options.confirm}} {{/if}}
\ No newline at end of file diff --git a/core/client/views/base.js b/core/client/views/base.js index ebd77c810d..fca4343bb2 100644 --- a/core/client/views/base.js +++ b/core/client/views/base.js @@ -281,11 +281,11 @@ } else { // Initiate functions for buttons here so models don't get tied up. this.acceptModal = function () { - this.model.options.confirm.accept.func(); + this.model.options.confirm.accept.func.call(this); self.removeElement(); }; this.rejectModal = function () { - this.model.options.confirm.reject.func(); + this.model.options.confirm.reject.func.call(this); self.removeElement(); }; shortcut.remove("ESC"); @@ -308,11 +308,12 @@ if (document.body.style.webkitFilter !== undefined) { // Detect webkit filters $("body").addClass("blur"); } - + if (_.isFunction(this.model.options.afterRender)) { + this.model.options.afterRender.call(this); + } if (this.model.options.animation) { this.animate(this.$el.children(".js-modal")); } - var self = this; $(window).on('resize', self.resize);