Merge pull request #585 from cobbspur/dropzone2

Updates to modals
This commit is contained in:
Hannah Wolfe 2013-09-02 15:36:53 -07:00
commit 888cf2131e
2 changed files with 8 additions and 7 deletions

View File

@ -1,12 +1,12 @@
<aside class="modal-background"></aside> <aside class="modal-background"></aside>
<article class="modal{{#if options.type}}-{{options.type}}{{/if}} {{#if options.style}}modal-style-{{options.style}}{{/if}} {{options.animation}} js-modal"> <article class="modal{{#if options.type}}-{{options.type}}{{/if}} {{#if options.style}}modal-style-{{options.style}}{{/if}} {{options.animation}} js-modal">
<header class="modal-header"><h1>{{content.title}}</h1>{{#if options.close}}<a class="close" href="#"><span class="hidden">Close</span></a>{{/if}}</header> {{#if content.title}}<header class="modal-header"><h1>{{content.title}}</h1>{{#if options.close}}<a class="close" href="#"><span class="hidden">Close</span></a>{{/if}}</header>{{/if}}
<section class="modal-content"> <section class="modal-content">
</section> </section>
{{#if options.confirm}} {{#if options.confirm}}
<footer class="modal-footer"> <footer class="modal-footer">
<button class="button-add js-button-accept">{{options.confirm.accept.text}}</button> <button class="js-button-accept {{#if options.confirm.accept.buttonClass}}{{options.confirm.accept.buttonClass}}{{else}}button-add{{/if}}">{{options.confirm.accept.text}}</button>
<button class="button-delete js-button-reject">{{options.confirm.reject.text}}</button> <button class="js-button-reject {{#if options.confirm.reject.buttonClass}}{{options.confirm.reject.buttonClass}}{{else}}button-delete{{/if}}">{{options.confirm.reject.text}}</button>
</footer> </footer>
{{/if}} {{/if}}
</article> </article>

View File

@ -281,11 +281,11 @@
} else { } else {
// Initiate functions for buttons here so models don't get tied up. // Initiate functions for buttons here so models don't get tied up.
this.acceptModal = function () { this.acceptModal = function () {
this.model.options.confirm.accept.func(); this.model.options.confirm.accept.func.call(this);
self.removeElement(); self.removeElement();
}; };
this.rejectModal = function () { this.rejectModal = function () {
this.model.options.confirm.reject.func(); this.model.options.confirm.reject.func.call(this);
self.removeElement(); self.removeElement();
}; };
shortcut.remove("ESC"); shortcut.remove("ESC");
@ -308,11 +308,12 @@
if (document.body.style.webkitFilter !== undefined) { // Detect webkit filters if (document.body.style.webkitFilter !== undefined) { // Detect webkit filters
$("body").addClass("blur"); $("body").addClass("blur");
} }
if (_.isFunction(this.model.options.afterRender)) {
this.model.options.afterRender.call(this);
}
if (this.model.options.animation) { if (this.model.options.animation) {
this.animate(this.$el.children(".js-modal")); this.animate(this.$el.children(".js-modal"));
} }
var self = this; var self = this;
$(window).on('resize', self.resize); $(window).on('resize', self.resize);