refactoring
[fnpeditor.git] / modules / data / saveDialog.js
index 0bdb718..d0049d5 100644 (file)
@@ -1,56 +1,56 @@
-define([\r
-'libs/text!./saveDialog.html',\r
-'libs/underscore-min',\r
-'libs/backbone-min',\r
-'libs/jquery-1.9.1.min'\r
-], function(saveDialogTemplate, _, Backbone, $) {\r
-\r
-    var DialogView = Backbone.View.extend({\r
-        template: _.template(saveDialogTemplate),\r
-        events: {\r
-            'click .save-btn': 'onSave',\r
-            'click .cancel-btn': 'close',\r
-            'click .close': 'close'\r
-        },\r
-        initialize: function() {\r
-            _.bindAll(this);\r
-            this.actionsDisabled = false;\r
-        },\r
-        show: function() {           \r
-            this.setElement(this.template());\r
-            this.$el.modal({backdrop: 'static'});\r
-            this.$el.modal('show');\r
-            this.$('textarea').focus();\r
-\r
-        },\r
-        onSave: function(e) {\r
-            e.preventDefault();\r
-            var view = this;\r
-            this.trigger('save', {\r
-                data: {description: view.$el.find('textarea').val()},\r
-                success: function() { view.actionsDisabled = false; view.close(); },\r
-                error: function() { view.actionsDisabled = false; view.close(); },\r
-            });\r
-        },\r
-        close: function(e) {\r
-            if(e)\r
-                e.preventDefault();\r
-            if(!this.actionsDisabled) {\r
-                this.$el.modal('hide');\r
-                this.$el.remove();\r
-            }\r
-        },\r
-        toggleButtons: function(toggle) {\r
-            this.$('.btn, button').toggleClass('disabled', !toggle);\r
-            this.$('textarea').attr('disabled', !toggle);\r
-            this.actionsDisabled = !toggle;\r
-        }\r
-    });\r
-\r
-    return {\r
-        create: function() {\r
-            return new DialogView();\r
-        }\r
-    };\r
-\r
+define([
+'libs/text!./saveDialog.html',
+'libs/underscore-min',
+'libs/backbone-min',
+'libs/jquery-1.9.1.min'
+], function(saveDialogTemplate, _, Backbone, $) {
+
+    var DialogView = Backbone.View.extend({
+        template: _.template(saveDialogTemplate),
+        events: {
+            'click .save-btn': 'onSave',
+            'click .cancel-btn': 'close',
+            'click .close': 'close'
+        },
+        initialize: function() {
+            _.bindAll(this);
+            this.actionsDisabled = false;
+        },
+        show: function() {           
+            this.setElement(this.template());
+            this.$el.modal({backdrop: 'static'});
+            this.$el.modal('show');
+            this.$('textarea').focus();
+
+        },
+        onSave: function(e) {
+            e.preventDefault();
+            var view = this;
+            this.trigger('save', {
+                data: {description: view.$el.find('textarea').val()},
+                success: function() { view.actionsDisabled = false; view.close(); },
+                error: function() { view.actionsDisabled = false; view.close(); },
+            });
+        },
+        close: function(e) {
+            if(e)
+                e.preventDefault();
+            if(!this.actionsDisabled) {
+                this.$el.modal('hide');
+                this.$el.remove();
+            }
+        },
+        toggleButtons: function(toggle) {
+            this.$('.btn, button').toggleClass('disabled', !toggle);
+            this.$('textarea').attr('disabled', !toggle);
+            this.actionsDisabled = !toggle;
+        }
+    });
+
+    return {
+        create: function() {
+            return new DialogView();
+        }
+    };
+
 });
\ No newline at end of file