src/nitdoc: remove old nitdoc
[nit.git] / share / nitdoc / js / plugins / github / loginbox.js
diff --git a/share/nitdoc/js/plugins/github/loginbox.js b/share/nitdoc/js/plugins/github/loginbox.js
deleted file mode 100644 (file)
index 55fbffe..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/* This file is part of NIT ( http://www.nitlanguage.org ).\r
-\r
-   Licensed under the Apache License, Version 2.0 (the "License");\r
-   you may not use this file except in compliance with the License.\r
-   You may obtain a copy of the License at\r
-\r
-   http://www.apache.org/licenses/LICENSE-2.0\r
-\r
-   Unless required by applicable law or agreed to in writing, software\r
-   distributed under the License is distributed on an "AS IS" BASIS,\r
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-   See the License for the specific language governing permissions and\r
-   limitations under the License.\r
-*/\r
-\r
-/*\r
- * LoginBox allows user to login and logoff from GitHub API\r
- */\r
-define([\r
-       "jquery",\r
-       "jQueryUI"\r
-], function($) {\r
-       $.widget("nitdoc.loginbox", {\r
-               options: {\r
-                       icon: "resources/icons/github-icon.png",\r
-                       iconActive: "resources/icons/github-icon-green.png",\r
-                       iconAlt: "GitHub",\r
-                       signedinTxt: "Signed in Github",\r
-                       signedoutTxt: "Sign in Github",\r
-                       welcomeTxt: "Hello",\r
-                       upstreamTxt: "Upstream branch",\r
-                       baseTxt: "Base",\r
-                       signoffTxt: "Sign Off",\r
-                       usernameTxt: "Username",\r
-                       passwordTxt: "Password",\r
-                       repoTxt: "Repository",\r
-                       branchTxt: "Branch",\r
-                       signinTxt: "Sign In"\r
-               },\r
-\r
-               _create: function() {\r
-                       this.element.append(\r
-                               $("<span/>")\r
-                               .addClass("glyphicon glyphicon-off")\r
-                               //.click($.proxy(this.toggle, this))\r
-                               .attr({\r
-                                       "data-container": "body",\r
-                                       "data-toggle": "popover",\r
-                                       "data-placement": "bottom",\r
-                                       "data-content": "bottom",\r
-                                       "data-html": "true",\r
-                               })\r
-                       );\r
-\r
-                       this.content = $("<div/>");\r
-                       this.loginBox = $("<div/>")\r
-                       .attr("id", "nitdoc-github-loginbox")\r
-                       .css("display", "none")\r
-                       .append(\r
-                               $(document.createElement("div"))\r
-                               .addClass("nitdoc-github-loginbox-arrow")\r
-                               .append("&nbsp;")\r
-                       )\r
-                       .append(this.content);\r
-                       this.element.append(this.loginBox);\r
-               },\r
-\r
-               /* public actions */\r
-\r
-               displayLogout: function(origin, user) {\r
-                       this.content.empty();\r
-                       this.content.append(\r
-                               $("<h3/>").text(this.options.signedinTxt)\r
-                       )\r
-                       this.content.append(\r
-                               $("<div/>")\r
-                               .append(\r
-                                       $("<h4/>")\r
-                                       .append(this.options.welcomeTxt + " ")\r
-                                       .append(\r
-                                               $("<a/>")\r
-                                               .attr("href", "https://github.com/" + user.login)\r
-                                               .append(user.login)\r
-                                       ).append(",")\r
-                               )\r
-                               .append(\r
-                                       $("<label/>")\r
-                                       .text("Upstream Branch")\r
-                               )\r
-                               .append(\r
-                                       $("<a/>")\r
-                                       .text(origin.user + ":" + origin.repo + ":" + origin.branch)\r
-                                       .addClass("nitdoc-github-loginbox-githublink")\r
-                                       .attr({\r
-                                               title: "Open branch in GitHub",\r
-                                               href: "https://github.com/" + origin.user + "/" + origin.repo + "/tree/" + origin.branch\r
-                                       })\r
-                               )\r
-                               .append(\r
-                                       $("<label/>")\r
-                                       .attr("for", "github-base")\r
-                                       .append("Your branch")\r
-                               )\r
-                               .append(\r
-                                       $("<a/>")\r
-                                       .text(user.login + ":" + user.repo + ":" + user.branch)\r
-                                       .addClass("nitdoc-github-loginbox-githublink")\r
-                                       .attr({\r
-                                               title: "Open branch in GitHub",\r
-                                               href: "https://github.com/" + user.login + "/" + user.repo + "/tree/" + user.branch\r
-                                       })\r
-                               )\r
-                               .append(\r
-                                       $("<button/>")\r
-                                       .addClass("nitdoc-github-button")\r
-                                       .addClass("nitdoc-github-cancel")\r
-                                       .append(\r
-                                               $("<img/>")\r
-                                               .attr("src", this.options.icon)\r
-                                       ).text(this.options.signoffTxt)\r
-                                       .click($.proxy(this._doClickLogoff, this))\r
-                               )\r
-                       );\r
-                       $(".nitdoc-github-li-img").attr("src", this.options.iconActive);\r
-               },\r
-\r
-               displayLogin: function() {\r
-                       this.content.empty();\r
-                       this.content.append(\r
-                               $("<h3/>").text(this.options.signedoutTxt)\r
-                       )\r
-                       this.content.append(\r
-                               $("<form/>")\r
-                               .keyup($.proxy(this._doFormChange, this))\r
-                               .append(\r
-                                       $("<div/>")\r
-                                       .addClass("form-group")\r
-                                       .append(\r
-                                               $("<label/>")\r
-                                               .attr("for", "nitdoc-github-login-field")\r
-                                               .append(this.options.usernameTxt)\r
-                                       )\r
-                                       .addClass("form-group")\r
-                                       .append(\r
-                                               $("<input/>")\r
-                                               .attr({\r
-                                                       id: "nitdoc-github-login-field",\r
-                                                       type: "text",\r
-                                                       "class": "form-control"\r
-                                               })\r
-                                       )\r
-                               )\r
-                               .append(\r
-                                       $("<div/>")\r
-                                       .addClass("form-group")\r
-                                       .append(\r
-                                               $("<label/>")\r
-                                               .attr("for", "nitdoc-github-password-field")\r
-                                               .append(this.options.passwordTxt)\r
-                                       )\r
-                                       .append(\r
-                                               $("<input/>")\r
-                                               .attr({\r
-                                                       id: "nitdoc-github-password-field",\r
-                                                       type: "password",\r
-                                                       "class": "form-control"\r
-                                               })\r
-                                       )\r
-                               )\r
-                               .append(\r
-                                       $("<div/>")\r
-                                       .addClass("form-group")\r
-                                       .append(\r
-                                               $("<label/>")\r
-                                               .attr("for", "nitdoc-github-repo-field")\r
-                                               .append(this.options.repoTxt)\r
-                                       )\r
-                                       .append(\r
-                                               $("<input/>")\r
-                                               .attr({\r
-                                                       id: "nitdoc-github-repo-field",\r
-                                                       type: "text",\r
-                                                       "class": "form-control"\r
-                                               })\r
-                                       )\r
-                               )\r
-                               .append(\r
-                                       $("<div/>")\r
-                                       .addClass("form-group")\r
-                                       .append(\r
-                                               $("<label/>")\r
-                                               .attr("for", "nitdoc-github-branch-field")\r
-                                               .append(this.options.branchTxt)\r
-                                       )\r
-                                       .append(\r
-                                               $("<input/>")\r
-                                               .attr({\r
-                                                       id: "nitdoc-github-branch-field",\r
-                                                       type: "text",\r
-                                                       "class": "form-control"\r
-                                               })\r
-                                       )\r
-                               )\r
-                               .append(\r
-                                       $("<button/>")\r
-                                       .addClass("nitdoc-github-button btn btn-primary btn-lg pull-right")\r
-                                       .attr("disabled", "disabled")\r
-                                       .append(\r
-                                               $("<img/>")\r
-                                               .attr("src", this.options.icon)\r
-                                       ).text(this.options.signinTxt)\r
-                                       .click($.proxy(this._doClickLogin, this))\r
-                               )\r
-                       );\r
-                       $(".nitdoc-github-li-img").attr("src", this.options.icon);\r
-               },\r
-\r
-               toggle: function() {\r
-                       if(this.loginBox.is(':hidden')) {\r
-                               this.loginBox.show();\r
-                               if ($('#nitdoc-github-login-field').is(':visible')) { $('#nitdoc-github-login-field').focus(); }\r
-                       } else {\r
-                               this.loginBox.hide();\r
-                       }\r
-               },\r
-\r
-               /* events */\r
-\r
-               _doClickLogoff: function(event) {\r
-                       this._trigger("_logoff", event);\r
-               },\r
-\r
-               _doClickLogin: function(event) {\r
-                       this._trigger("_login", event, {\r
-                               login: $('#nitdoc-github-login-field').val(),\r
-                               password: $('#nitdoc-github-password-field').val(),\r
-                               repo: $('#nitdoc-github-repo-field').val(),\r
-                               branch: $('#nitdoc-github-branch-field').val()\r
-                       });\r
-                       return false;\r
-               },\r
-\r
-               _doFormChange: function(event) {\r
-                       login = $('#nitdoc-github-login-field').val();\r
-                       password = $('#nitdoc-github-password-field').val();\r
-                       repo = $('#nitdoc-github-repo-field').val();\r
-                       branch = $('#nitdoc-github-branch-field').val();\r
-                       if(login && password && repo && branch) {\r
-                               this.loginBox.find("form .nitdoc-github-button").removeAttr("disabled");\r
-                       } else {\r
-                               this.loginBox.find("form .nitdoc-github-button").attr("disabled", "disabled");\r
-                       }\r
-               }\r
-       });\r
-});\r