nitdoc: migrate github commitbox to jQuery.UI widget
[nit.git] / share / nitdoc / js / plugins / github / ui.js
index edb8035..b185b5f 100644 (file)
@@ -27,8 +27,9 @@ define([
        "plugins/github/utils",\r
        "plugins/github/commentbox",\r
        "plugins/github/modalbox",\r
+       "plugins/github/commitbox",\r
        "base64"\r
-], function($, UI, User, GithubAPI, Utils, CommentBox, ModalBox, Base64) {\r
+], function($, UI, User, GithubAPI, Utils, CommentBox, ModalBox, CommitBox, Base64) {\r
        var UI = {\r
                openedComments: 0,      // currently edited comments count\r
                user: false,            // logged user\r
@@ -90,6 +91,7 @@ define([
 \r
                // Attach edit button on each comment\r
                attachCommentEvents: function() {\r
+                       $("body").commitbox();\r
                        // Blocks without comment\r
                        $("span.noComment").each(function() {\r
                                //FIXME this should be done by nitdoc\r
@@ -136,6 +138,11 @@ define([
                                        }\r
 \r
                                        baseTextarea.commentbox();\r
+                                       baseTextarea.bind("commentbox_commit", function(event, data) {\r
+                                               $("body").commitbox("open", infos.namespace, infos.user, infos.isNew ? true : false)\r
+                                               //infos.message = $("#nitdoc-github-commit-message").val() + "\n\n" + infos.user.signedOff;\r
+                                               //UI.saveChanges(infos);\r
+                                       });\r
                                        baseTextarea.bind("commentbox_preview", function(event, data) {\r
                                                var converter = new Markdown.Converter()\r
                                                var html = converter.makeHtml(data.value);\r