Refactoring
[fnpeditor.git] / fnpjs / layout.js
index 99b2e58..05252fb 100644 (file)
@@ -1,31 +1,37 @@
-define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($ ,_) {\r
-    'use strict';\r
-      \r
-    var Layout = function(template) {\r
-        var layout = this;\r
-        this.dom = $(_.template(template)());\r
-        this.views = {};\r
-        \r
-        this.dom.onShow = function() {\r
-            _.values(layout.views).forEach(function(view) {\r
-                if(view.onShow)\r
-                    view.onShow();\r
-            });\r
-        };\r
-        \r
-    };\r
-    \r
-    Layout.prototype.setView = function(place, view) {\r
-        this.dom.find('[fnpjs-place=' + place + ']').append(view);\r
-        this.views[place] = view;\r
-        if(this.dom.is(':visible') && view.onShow) {\r
-            view.onShow();\r
-        }\r
-    };\r
-    \r
-    Layout.prototype.getAsView = function() {\r
-        return this.dom\r
-    };\r
-    \r
-    return {Layout: Layout};\r
+define(['libs/jquery-1.9.1.min', 'libs/underscore-min'], function($ ,_) {
+    'use strict';
+      
+    var Layout = function(template) {
+        var layout = this;
+        this.dom = $(_.template(template)());
+        this.views = {};
+        
+        this.dom.onShow = function() {
+            _.values(layout.views).forEach(function(view) {
+                if(view.onShow)
+                    view.onShow();
+            });
+        };
+        this.dom.onHide = function() {
+            _.values(layout.views).forEach(function(view) {
+                if(view.onHide)
+                    view.onHide();
+            });
+        };
+        
+    };
+    
+    Layout.prototype.setView = function(place, view) {
+        this.dom.find('[fnpjs-place=' + place + ']').append(view);
+        this.views[place] = view;
+        if(this.dom.is(':visible') && view.onShow) {
+            view.onShow();
+        }
+    };
+    
+    Layout.prototype.getAsView = function() {
+        return this.dom;
+    };
+    
+    return {Layout: Layout};
 });
\ No newline at end of file