nitdoc: Adds the github authenfication
authorStefan Lage <lagestfan@gmail.com>
Fri, 3 May 2013 23:31:41 +0000 (19:31 -0400)
committerStefan Lage <lagestfan@gmail.com>
Thu, 23 May 2013 23:02:58 +0000 (19:02 -0400)
Adds the github authenfication form with its style and JS functions which displays it or not

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

share/nitdoc/resources/icons/github-icon-w.png [new file with mode: 0644]
share/nitdoc/resources/icons/github-icon.png [new file with mode: 0644]
share/nitdoc/scripts/js-facilities.js
share/nitdoc/styles/main.css
src/nitdoc.nit

diff --git a/share/nitdoc/resources/icons/github-icon-w.png b/share/nitdoc/resources/icons/github-icon-w.png
new file mode 100644 (file)
index 0000000..ba6a6b1
Binary files /dev/null and b/share/nitdoc/resources/icons/github-icon-w.png differ
diff --git a/share/nitdoc/resources/icons/github-icon.png b/share/nitdoc/resources/icons/github-icon.png
new file mode 100644 (file)
index 0000000..8b25551
Binary files /dev/null and b/share/nitdoc/resources/icons/github-icon.png differ
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
index 20a2ac4..e61271d 100644 (file)
@@ -451,4 +451,177 @@ nav h3 a.fold {
        font-size: small;\r
        width: 75%;\r
        text-align: right;\r
-}
\ No newline at end of file
+}\r
+\r
+.popover a:hover {\r
+       color: #333;\r
+       cursor: hand; cursor: pointer;\r
+}\r
+\r
+.popover a {\r
+       color: #0D8921;\r
+       margin-bottom: 10px;\r
+}\r
+\r
+.popover {\r
+       position: absolute;\r
+       /*top: 0;\r
+       left: 0;*/\r
+       width : 220px;\r
+       height:280px;\r
+       margin-left: -102px;\r
+       z-index: 1010;\r
+       display: block;\r
+       max-width: 276px;\r
+       padding: 1px;\r
+       text-align: left;\r
+       white-space: normal;\r
+       background-color: #ffffff;\r
+       border: 1px solid #ccc;\r
+       border: 1px solid rgba(0, 0, 0, 0.2);\r
+       -webkit-border-radius: 6px;\r
+        -moz-border-radius: 6px;\r
+             border-radius: 6px;\r
+       -webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\r
+        -moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\r
+             box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);\r
+       -webkit-background-clip: padding-box;\r
+        -moz-background-clip: padding;\r
+             background-clip: padding-box;\r
+}\r
+\r
+.popover.bottom {\r
+       margin-top: 10px;\r
+}\r
+\r
+.popover-title {\r
+       padding: 8px 14px;\r
+       margin: 0;\r
+       font-size: 14px;\r
+       font-weight: normal;\r
+       line-height: 18px;\r
+       background-color: #f7f7f7;\r
+       border-bottom: 1px solid #ebebeb;\r
+       -webkit-border-radius: 5px 5px 0 0;\r
+        -moz-border-radius: 5px 5px 0 0;\r
+             border-radius: 5px 5px 0 0;\r
+}\r
+\r
+.popover-title:empty {\r
+       display: none;\r
+}\r
+\r
+.popover-content {\r
+       padding: 9px 14px;\r
+}\r
+\r
+.popover .arrow,\r
+.popover .arrow:after {\r
+       position: absolute;\r
+       display: block;\r
+       width: 0;\r
+       height: 0;\r
+       border-color: transparent;\r
+       border-style: solid;\r
+}\r
+\r
+.popover .arrow {\r
+       border-width: 11px;\r
+}\r
+\r
+.popover .arrow:after {\r
+       border-width: 10px;\r
+       content: "";\r
+}\r
+\r
+.popover.bottom .arrow {\r
+       top: -11px;\r
+       left: 50%;\r
+       margin-left: -11px;\r
+       border-bottom-color: #999;\r
+       border-bottom-color: rgba(0, 0, 0, 0.25);\r
+       border-top-width: 0;\r
+}\r
+\r
+.popover.bottom .arrow:after {\r
+       top: 1px;\r
+       margin-left: -10px;\r
+       border-bottom-color: #ffffff;\r
+       border-top-width: 0;\r
+}\r
+\r
+#logGitHub{\r
+       cursor: hand; cursor: pointer;\r
+       height: 17px;\r
+       width: 17px;\r
+}\r
+\r
+#liGitHub{\r
+       float:right;\r
+       margin-top:-4px;\r
+       height: 20px;\r
+}\r
+\r
+#liGitHub input {\r
+       margin: 4px 10px 5px 10px;\r
+       color: black;\r
+       font-style: normal;\r
+       font-size: 12px;\r
+       border: 1px solid #CCC;\r
+}\r
+\r
+#lbloginGit, #lbpasswordGit, #lbrepositoryGit, #lbbranchGit{\r
+       color: black;\r
+       font-style: normal;\r
+       margin-left: 10px;\r
+       margin-top: 10px;       \r
+}\r
+#logginMessage {\r
+       color: black;\r
+       font-style: normal;\r
+       text-align: center;\r
+       margin-top: 10px;       \r
+}\r
+\r
+#divlogIn{\r
+       text-align: center;\r
+}\r
+\r
+#signIn{\r
+       display: block;\r
+       cursor: pointer;\r
+       margin: 10px 10px 5px 10px;    \r
+       background-color: #92C929;\r
+       background-image: -webkit-gradient(linear, left top, left bottom, from(#92C929), to(#1d7900)); /* Saf4+, Chrome */\r
+       background-image: -webkit-linear-gradient(top, #92C929, #1d7900); /* Chrome 10+, Saf5.1+ */\r
+       background-image:    -moz-linear-gradient(top, #92C929, #1d7900); /* FF3.6 */\r
+       background-image:     -ms-linear-gradient(top, #92C929, #1d7900); /* IE10 */\r
+       background-image:      -o-linear-gradient(top, #92C929, #1d7900); /* Opera 11.10+ */\r
+       background-image:         linear-gradient(top, #92C929, #1d7900);\r
+       filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#92C929', EndColorStr='#1d7900'); /* IE6–IE9 */    \r
+       border-radius: 4px;\r
+       -moz-border-radius: 4px; \r
+       -webkit-border-radius: 4px;  \r
+       -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;    \r
+       box-shadow: 0px 2px 4px rgba(0,0,0, .2);\r
+       -moz-box-shadow: 0px 2px 4px rgba(0,0,0, .2);\r
+       -webkit-box-shadow: 0px 2px 4px rgba(0,0,0, .2);    \r
+       text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2);\r
+       -moz-text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2);\r
+       -webkit-text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2);    \r
+       border: 1px solid #1d7900;    \r
+       color: #fff;\r
+       font-weight: 300;\r
+       font-size: 14px;\r
+       padding: 5px 7px 5px 7px;\r
+       text-align: center;\r
+}\r
+\r
+#passwordGit, #loginGit, #repositoryGit, #branchGit {\r
+       height:30px; \r
+       width: 200px;\r
+}\r
+\r
+#imgGitHub{\r
+       width:20px;\r
+}\r
index e676f22..e366538 100644 (file)
@@ -170,8 +170,7 @@ class DocContext
                var custom_items = ""
                if self._opt_custom_menu_items.value != null then custom_items = self._opt_custom_menu_items.value.as(not null)
 
-               var action_bar = "<header><nav class='main'><ul>{custom_items}<li class=\"current\">Overview</li><li><a href='full-index.html'>Full Index</a></li><li><a href=\"help.html\">Help</a></li></ul></nav></header>\n"
-                                                       
+               var action_bar = "<header><nav class='main'><ul>{custom_items}<li class=\"current\">Overview</li><li><a href='full-index.html'>Full Index</a></li><li><a href=\"help.html\">Help</a></li><li id=\"liGitHub\" class=\"\"><a id=\"logGitHub\" class=\"btn\" ><img id=\"imgGitHub\" src=\"resources/icons/github-icon.png\" /></a><div class=\"popover bottom\"><div class=\"arrow\"></div><div><label id=\"lbloginGit\" for=\"login\">Username</label><input id=\"loginGit\" type=\"text\" name=\"login\"><label id=\"logginMessage\" >Hello <a id=\"githubAccount\" ><strong id=\"nickName\"></strong></a></label></div><div><label id=\"lbpasswordGit\" for=\"password\">Password</label><input id=\"passwordGit\" type=\"password\" name=\"password\"><div><label id=\"lbrepositoryGit\" for=\"repository\">Repository</label><input id=\"repositoryGit\" type=\"text\" name=\"repository\"></div><div><label id=\"lbbranchGit\" for=\"branch\">Branch</label><input id=\"branchGit\" type=\"text\" name=\"branch\"></div></div><div id=\"divlogIn\"><a id=\"signIn\" >Sign In</a></div></div></li></ul></nav></header>\n"
                var custom_title = "Nitdoc"
                if self._opt_custom_title.value != null then custom_title = self._opt_custom_title.value.as(not null)
                
@@ -227,7 +226,7 @@ class DocContext
                        assert mod isa MMSrcModule
                        if not mod.require_doc(self) then continue
                        self.filename = mod.html_name
-                       action_bar = "<header><nav class='main'><ul>{custom_items}<li><a href='./index.html'>Overview</a></li><li class=\"current\">{mod.name}</li><li><a href='full-index.html'>Full Index</a></li><li><a href=\"help.html\">Help</a></li></ul></nav></header>\n"
+                       action_bar = "<header><nav class='main'><ul>{custom_items}<li><a href='./index.html'>Overview</a></li><li class=\"current\">{mod.name}</li><li><a href='full-index.html'>Full Index</a></li><li><a href=\"help.html\">Help</a></li><li id=\"liGitHub\" class=\"\"><a id=\"logGitHub\" class=\"btn\" ><img id=\"imgGitHub\" src=\"resources/icons/github-icon.png\" /></a><div class=\"popover bottom\"><div class=\"arrow\"></div><div><label id=\"lbloginGit\" for=\"login\">Username</label><input id=\"loginGit\" type=\"text\" name=\"login\"><label id=\"logginMessage\" >Hello <a id=\"githubAccount\" ><strong id=\"nickName\"></strong></a></label></div><div><label id=\"lbpasswordGit\" for=\"password\">Password</label><input id=\"passwordGit\" type=\"password\" name=\"password\"></div><div><label id=\"lbrepositoryGit\" for=\"repository\">Repository</label><input id=\"repositoryGit\" type=\"text\" name=\"repository\"></div><div><label id=\"lbbranchGit\" for=\"branch\">Branch</label><input id=\"branchGit\" type=\"text\" name=\"branch\"></div><div id=\"divlogIn\"><a id=\"signIn\" >Sign In</a></div></div></li></ul></nav></header>\n"
                        clear
                        addGithubInformation
                        add("<!DOCTYPE html>")
@@ -245,7 +244,7 @@ class DocContext
                for c in mainmod.local_classes do
                        if not c.require_doc(self) then continue
                        self.filename = c.html_name
-                       action_bar = "<header><nav class='main'><ul>{custom_items}<li><a href='./index.html'>Overview</a></li><li>{c.global.intro.mmmodule.toplevel_owner.html_link(self)}</li><li class=\"current\">{c.name}</li><li><a href='full-index.html'>Full Index</a></li><li><a href=\"help.html\">Help</a></li></ul></nav></header>\n"
+                       action_bar = "<header><nav class='main'><ul>{custom_items}<li><a href='./index.html'>Overview</a></li><li>{c.global.intro.mmmodule.toplevel_owner.html_link(self)}</li><li class=\"current\">{c.name}</li><li><a href='full-index.html'>Full Index</a></li><li><a href=\"help.html\">Help</a></li><li id=\"liGitHub\" class=\"\"><a id=\"logGitHub\" class=\"btn\" ><img id=\"imgGitHub\" src=\"resources/icons/github-icon.png\" /></a><div class=\"popover bottom\"><div class=\"arrow\"></div><div><label id=\"lbloginGit\" for=\"login\">Username</label><input id=\"loginGit\" type=\"text\" name=\"login\"><label id=\"logginMessage\" >Hello <a id=\"githubAccount\" ><strong id=\"nickName\"></strong></a></label></div><div><label id=\"lbpasswordGit\" for=\"password\">Password</label><input id=\"passwordGit\" type=\"password\" name=\"password\"></div><div><label id=\"lbrepositoryGit\" for=\"repository\">Repository</label><input id=\"repositoryGit\" type=\"text\" name=\"repository\"></div><div><label id=\"lbbranchGit\" for=\"branch\">Branch</label><input id=\"branchGit\" type=\"text\" name=\"branch\"></div><div id=\"divlogIn\"><a id=\"signIn\" >Sign In</a></div></div></li></ul></nav></header>\n"
                        clear
                        addGithubInformation
                        add("<!DOCTYPE html>")
@@ -260,7 +259,7 @@ class DocContext
                end
 
                self.filename = "fullindex"
-               action_bar = "<header><nav class='main'><ul>{custom_items}<li><a href='./index.html'>Overview</a></li><li class=\"current\">Full Index</li><li><a href=\"help.html\">Help</a></li></ul></nav></header>\n"
+               action_bar = "<header><nav class='main'><ul>{custom_items}<li><a href='./index.html'>Overview</a></li><li class=\"current\">Full Index</li><li><a href=\"help.html\">Help</a></li><li id=\"liGitHub\" class=\"\"><a id=\"logGitHub\" class=\"btn\" ><img id=\"imgGitHub\" src=\"resources/icons/github-icon.png\" /></a><div class=\"popover bottom\"><div class=\"arrow\"></div><div><label id=\"lbloginGit\" for=\"login\">Username</label><input id=\"loginGit\" type=\"text\" name=\"login\"><label id=\"logginMessage\" >Hello <a id=\"githubAccount\" ><strong id=\"nickName\"></strong></a></label></div><div><label id=\"lbpasswordGit\" for=\"password\">Password</label><input id=\"passwordGit\" type=\"password\" name=\"password\"></div><div><label id=\"lbrepositoryGit\" for=\"repository\">Repository</label><input id=\"repositoryGit\" type=\"text\" name=\"repository\"></div><div><label id=\"lbbranchGit\" for=\"branch\">Branch</label><input id=\"branchGit\" type=\"text\" name=\"branch\"></div><div id=\"divlogIn\"><a id=\"signIn\" >Sign In</a></div></div></li></ul></nav></header>\n"
                clear
                addGithubInformation
                add("<!DOCTYPE html>")