Działający edytor CodeMirror.
[redakcja.git] / project / static / js / editor.ui.js
index de2d0bf..c8d47f6 100755 (executable)
@@ -3,7 +3,7 @@
  */\r
 Editor.prototype.setupUI = function() {\r
 //     // set up the UI visually and attach callbacks\r
-//     var self = this;\r
+    var self = this;\r
 // \r
 //     var resize_start = function(event, mydata) {\r
 //         $(document).bind('mousemove', mydata, resize_changed).\r
@@ -112,83 +112,81 @@ Editor.prototype.setupUI = function() {
 //         self.savePanelOptions();      \r
 //     });\r
 //     \r
-//     /*\r
-//      * Connect panel actions\r
-//      */\r
-//     $('#panels > *.panel-wrap').each(function() {\r
-//         var panelWrap = $(this);\r
-//         // $.log('wrap: ', panelWrap);\r
-//         var panel = new Panel(panelWrap);\r
-//         panelWrap.data('ctrl', panel); // attach controllers to wraps\r
-//         panel.load($('.panel-toolbar select', panelWrap).val());\r
-// \r
-//         $('.panel-toolbar select', panelWrap).change(function() {\r
-//             var url = $(this).val();\r
-//             panelWrap.data('ctrl').load(url);\r
-//             self.savePanelOptions();\r
-//         });\r
-// \r
-//         $('.panel-toolbar button.refresh-button', panelWrap).click(\r
-//             function() {\r
-//                 panel.refresh();\r
-//             } );\r
-// \r
-//         self.rootDiv.bind('stopResize', function() {\r
-//             panel.callHook('toolbarResized');\r
-//         });\r
-//     });\r
-// \r
-//     $(document).bind('panel:contentChanged', function() {\r
-//         self.onContentChanged.apply(self, arguments)\r
-//     });  \r
-// \r
-//     /*\r
-//      * Connect various buttons\r
-//      */\r
-// \r
-//     $('#toolbar-button-quick-save').click( function (event, data) {\r
-//         self.saveToBranch();\r
-//     } );\r
-// \r
-//     $('#toolbar-button-save').click( function (event, data) {\r
-//         $('#commit-dialog').jqmShow( {callback: $.fbind(self, self.saveToBranch)} );\r
-//     } );\r
-// \r
-//     $('#toolbar-button-update').click( function (event, data) {\r
-//         if (self.updateUserBranch()) {\r
-//             // commit/update can be called only after proper, save\r
-//             // this means all panels are clean, and will get refreshed\r
-//             // do this only, when there are any changes to local branch\r
-//             self.refreshPanels();\r
-//         }\r
-//     } );\r
-// \r
-//     /* COMMIT DIALOG */\r
-//     $('#commit-dialog').\r
-//     jqm({\r
-//         modal: true,\r
-//         onShow: $.fbind(self, self.loadRelatedIssues)        \r
-//     });\r
-// \r
-//     $('#toolbar-button-commit').click( function (event, data) {\r
-//         $('#commit-dialog').jqmShow( {callback: $.fbind(self, self.sendMergeRequest)} );\r
-//     } );\r
-//     \r
-//     /* STATIC BINDS */\r
-//     $('#commit-dialog-cancel-button').click(function() {\r
-//         $('#commit-dialog-error-empty-message').hide();\r
-//         $('#commit-dialog').jqmHide();\r
-//     });   \r
-//     \r
-// \r
-//     /* SPLIT DIALOG */\r
-//     $('#split-dialog').jqm({\r
-//         modal: true,\r
-//         onShow: $.fbind(self, self.loadSplitDialog)\r
-//     }).\r
-//     jqmAddClose('button.dialog-close-button');\r
-// \r
-// // $('#split-dialog').   \r
+    /*\r
+     * Connect panel actions\r
+     */\r
+    $('#panels > *.panel-wrap').each(function() {\r
+        var panelWrap = $(this);\r
+        // $.log('wrap: ', panelWrap);\r
+        var panel = new Panel(panelWrap);\r
+        panelWrap.data('ctrl', panel); // attach controllers to wraps\r
+        panel.load($('.panel-toolbar select', panelWrap).val());\r
+\r
+        $('.panel-toolbar select', panelWrap).change(function() {\r
+            var url = $(this).val();\r
+            panelWrap.data('ctrl').load(url);\r
+            self.savePanelOptions();\r
+        });\r
+\r
+        $('.panel-toolbar button.refresh-button', panelWrap).click(\r
+            function() {\r
+                panel.refresh();\r
+            } );\r
+\r
+        self.rootDiv.bind('stopResize', function() {\r
+            panel.callHook('toolbarResized');\r
+        });\r
+    });\r
+\r
+    $(document).bind('panel:contentChanged', function() {\r
+        self.onContentChanged.apply(self, arguments)\r
+    });  \r
+\r
+    /*\r
+     * Connect various buttons\r
+     */\r
+\r
+    $('#toolbar-button-quick-save').click( function (event, data) {\r
+        self.saveToBranch();\r
+    } );\r
+\r
+    $('#toolbar-button-save').click( function (event, data) {\r
+        $('#commit-dialog').jqmShow( {callback: $.fbind(self, self.saveToBranch)} );\r
+    } );\r
+\r
+    $('#toolbar-button-update').click( function (event, data) {\r
+        if (self.updateUserBranch()) {\r
+            // commit/update can be called only after proper, save\r
+            // this means all panels are clean, and will get refreshed\r
+            // do this only, when there are any changes to local branch\r
+            self.refreshPanels();\r
+        }\r
+    } );\r
+\r
+    /* COMMIT DIALOG */\r
+    $('#commit-dialog').\r
+    jqm({\r
+        modal: true,\r
+        onShow: $.fbind(self, self.loadRelatedIssues)        \r
+    });\r
+\r
+    $('#toolbar-button-commit').click( function (event, data) {\r
+        $('#commit-dialog').jqmShow( {callback: $.fbind(self, self.sendMergeRequest)} );\r
+    } );\r
+    \r
+    /* STATIC BINDS */\r
+    $('#commit-dialog-cancel-button').click(function() {\r
+        $('#commit-dialog-error-empty-message').hide();\r
+        $('#commit-dialog').jqmHide();\r
+    });   \r
+    \r
+\r
+    /* SPLIT DIALOG */\r
+    $('#split-dialog').jqm({\r
+        modal: true,\r
+        onShow: $.fbind(self, self.loadSplitDialog)\r
+    }).\r
+    jqmAddClose('button.dialog-close-button');\r
 }\r
 \r
 Editor.prototype.loadRelatedIssues = function(hash)\r
@@ -277,7 +275,7 @@ Editor.prototype.loadSplitDialog = function(hash)
             hash.t.success();\r
         });\r
 \r
-        if($('#id_splitform-autoxml').is(':checked'))\r
+        /* if($('#id_splitform-autoxml').is(':checked'))\r
             $('#split-form-dc-subform').show();\r
         else\r
             $('#split-form-dc-subform').hide();\r
@@ -287,7 +285,7 @@ Editor.prototype.loadSplitDialog = function(hash)
                 $('#split-form-dc-subform').show();\r
             else\r
                 $('#split-form-dc-subform').hide();\r
-        });\r
+        }); */\r
     };   \r
 \r
     $.ajax({\r