nitdoc: Adds the github authenfication
[nit.git] / share / nitdoc / scripts / js-facilities.js
index cb45d6e..f225447 100644 (file)
@@ -349,9 +349,13 @@ $(document).ready(function() {
        $("a[href*='#']").click( function() {\r
                highlightBlock($(this).attr("href").split(/#/)[1]);\r
        });\r
-       \r
+\r
        //Preload filter fields with query string\r
        preloadFilters();\r
+       // Hide Authenfication form\r
+       $(".popover").hide();\r
+       // Display Login modal\r
+       $("#logGitHub").click(function(){ displayLogginModal(); }); \r
 });\r
 \r
 /* Parse current URL and return anchor name */\r
@@ -399,4 +403,32 @@ function highlightBlock(a) {
        \r
        target.addClass("highlighted");\r
        target.show();\r
-}
\ No newline at end of file
+}\r
+\r
+function displayLogginModal(){\r
+       if ($('.popover').is(':hidden')) { $('.popover').show(); }\r
+       else { $('.popover').hide(); }  \r
+       updateDisplaying();\r
+}\r
+\r
+function updateDisplaying(){\r
+       $('#logginMessage').css({'display' : 'none'});\r
+       $("#liGitHub").attr("class", "");\r
+       $("#imgGitHub").attr("src", "resources/icons/github-icon.png");\r
+       $('#loginGit').val("");\r
+       $('#passwordGit').val("");\r
+       $('#nickName').text("");\r
+       $('.popover').css({'height' : '280px'});        \r
+       $('#logginMessage').css({'display' : 'none'});\r
+       $('#repositoryGit').val($('#repoName').attr('name'));\r
+       $('#branchGit').val('wikidoc');  \r
+       $('#signIn').text("Sign In");\r
+       $('#loginGit').show();\r
+       $('#passwordGit').show();\r
+       $('#lbpasswordGit').show();\r
+       $('#lbloginGit').show();        \r
+       $('#repositoryGit').show();\r
+       $('#lbrepositoryGit').show();\r
+       $('#lbbranchGit').show();  \r
+       $('#branchGit').show();  \r
+}\r