summaryrefslogtreecommitdiff
path: root/ModalView.js
diff options
context:
space:
mode:
Diffstat (limited to 'ModalView.js')
-rw-r--r--ModalView.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/ModalView.js b/ModalView.js
new file mode 100644
index 0000000..b2f4c70
--- /dev/null
+++ b/ModalView.js
@@ -0,0 +1,51 @@
+
+var ModalView = View.extend({
+ events: {
+ "click .close": 'close',
+ },
+
+ initialize: function(opt){
+ if (opt && opt.parent) {
+ this.parent = opt.parent
+ }
+ },
+
+ usesFileUpload: false,
+
+ show: function(){
+ $(".mediaDrawer").removeClass("active")
+
+ if (! this.usesFileUpload) {
+ $(".fileUpload").removeClass("active")
+ }
+ if (this.fixedClose) {
+ $("#fixed_close").addClass("active")
+ $("#fixed_close").bind("click", this.hide.bind(this))
+ }
+
+ this.$el.addClass("active")
+ $("body").addClass("noOverflow")
+ },
+
+ hide: function(){
+ // $(".mediaDrawer, .room1").removeClass("active editing");
+ if (this.fixedClose) {
+ $("#fixed_close").removeClass("active")
+ $("#fixed_close").unbind("click", this.hide.bind(this))
+ }
+ this.$el.removeClass("active");
+ $("body").removeClass("noOverflow");
+ },
+
+ close: function(){
+ if (window.isModalView) {
+ window.location.pathname = "/"
+ }
+ else {
+ history.pushState(null, document.title, app.router.originalPath)
+ this.hide()
+ }
+ }
+
+})
+