nitdoc: Adds action to commit button when we are in "edit mode".
authorStefan Lage <lagestfan@gmail.com>
Fri, 24 May 2013 01:20:53 +0000 (21:20 -0400)
committerStefan Lage <lagestfan@gmail.com>
Fri, 24 May 2013 02:26:49 +0000 (22:26 -0400)
This function display a commit form.
Adds a another function to close this form.

signed-off by: Stefan Lage <lagestfan@gmail.com>

share/nitdoc/resources/icons/close.png [new file with mode: 0755]
share/nitdoc/scripts/js-facilities.js

diff --git a/share/nitdoc/resources/icons/close.png b/share/nitdoc/resources/icons/close.png
new file mode 100755 (executable)
index 0000000..c11f7af
Binary files /dev/null and b/share/nitdoc/resources/icons/close.png differ
index b3e5d9d..75f618b 100644 (file)
@@ -399,7 +399,7 @@ $(document).ready(function() {
                displayLogginModal();\r
        });\r
 \r
-       // Open edit file\r
+       // Activate edit mode\r
        $('pre[class=text_label]').click(function(){\r
                // the customer is loggued ?\r
                if(!sessionStarted || userName == ""){\r
@@ -434,6 +434,7 @@ $(document).ready(function() {
                }\r
        });\r
 \r
+       // Disable the edit mode\r
        $('a[id=cancelBtn]').click(function(){\r
                if(editComment > 0){ editComment -= 1; }\r
                // Hide itself\r
@@ -446,6 +447,42 @@ $(document).ready(function() {
                $(this).prev().prev().show();\r
         });\r
 \r
+       // Display commit form\r
+       $('a[id=commitBtn]').click(function(){\r
+               updateComment = $(this).prev().prev().val();\r
+               commentType = $(this).prev().prev().prev().attr('type');\r
+\r
+               if(updateComment == ""){ displayMessage('The comment field is empty!', 40, 45); }\r
+               else{\r
+                       if(!sessionStarted){\r
+                               displayMessage("You need to be loggued before commit something", 45, 40);\r
+                               displayLogginModal();\r
+                               return;\r
+                       }\r
+                       $('#commitMessage').val('New commit');\r
+                       pathFile = $(this).prev().prev().prev().attr('tag');\r
+                       $('#modal').show().prepend('<a class="close"><img src="resources/icons/close.png" class="btn_close" title="Close" alt="Close" /></a>');\r
+                       $('body').append('<div id="fade"></div>');\r
+                       $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();\r
+               }\r
+        });\r
+\r
+       // Close commit form\r
+       $('.btn_close').click(function(){\r
+               $(this).hide();                 \r
+               $(this).next().hide();                  \r
+               if(editComment > 0){ editComment -= 1; }\r
+        });\r
+\r
+       //Close Popups and Fade Layer\r
+       $('body').on('click', 'a.close, #fade', function() {\r
+               if(editComment > 0){ editComment -= 1; }\r
+               $('#fade , #modal').fadeOut(function() {\r
+                       $('#fade, a.close').remove();  \r
+               });             \r
+               $('#modalQuestion').hide();\r
+       });\r
+\r
 });\r
 \r
 /* Parse current URL and return anchor name */\r