diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-02 19:22:48 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-09-02 19:22:48 +0200 |
commit | 288b6190121618090107b3c0bb4f9e3539608d3b (patch) | |
tree | 4a040dfd008686ca91950ba0e60ac190cda8eb79 /module/web/static/js/views/modal | |
parent | fixed ordering (diff) | |
download | pyload-288b6190121618090107b3c0bb4f9e3539608d3b.tar.xz |
modal dialog
Diffstat (limited to 'module/web/static/js/views/modal')
-rw-r--r-- | module/web/static/js/views/modal/modalView.js | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/module/web/static/js/views/modal/modalView.js b/module/web/static/js/views/modal/modalView.js new file mode 100644 index 000000000..efc0cc3cb --- /dev/null +++ b/module/web/static/js/views/modal/modalView.js @@ -0,0 +1,76 @@ +define(['jquery', 'backbone', 'underscore', 'omniwindow'], function($, Backbone, _) { + + return Backbone.View.extend({ + + events: { + + }, + + dialog: null, + + initialize: function() { + + }, + + render: function() { + this.$el.addClass('modal'); + this.$el.addClass('modal-closed'); + this.$el.append(this.renderContent()); + this.$el.css({opacity: 0, scale: 0.7}); + $("body").append(this.el); + + this.dialog = this.$el.omniWindow({ + overlay: { + selector: '#modal-overlay', + hideClass: 'modal-closed', + animations: { + hide: function(subjects, internalCallback) { + subjects.overlay.fadeOut(400, function() { + internalCallback(subjects); + }); + }, + show: function(subjects, internalCallback) { + subjects.overlay.fadeIn(250, function() { + internalCallback(subjects); + }); + }}}, + modal: { + hideClass: 'modal-closed', + animations: { + hide: function(subjects, internalCallback) { + subjects.modal.transition({opacity: 'hide', scale: 0.7}, 250, function() { + internalCallback(subjects); + }); + }, + + show: function(subjects, internalCallback) { + subjects.modal.transition({opacity: 'show', scale: 1}, 250, function() { + internalCallback(subjects); + }); + }} + }}); + + return this; + }, + renderContent: function() { + return $('<h1>Dialog</h1>'); + }, + + show: function() { + if (this.dialog === null) + this.render(); + + this.dialog.trigger('show'); + }, + + hide: function() { + this.dialog.trigger('hide'); + }, + + destroy: function() { + this.$el.remove(); + this.dialog = null; + } + + }); +});
\ No newline at end of file |