From c2f8b39816201e67eabc2e6f78849d34f75eac58 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 2 Aug 2013 14:44:14 -0400 Subject: [PATCH] ni_nitdoc: github login box is now generated by JS Also corrected: * cropped btn display * login box display out of screen on splited windows Signed-off-by: Alexandre Terrasa --- share/nitdoc/scripts/github.js | 74 ++++++++++++++++++++++++++++++++-------- share/nitdoc/styles/main.css | 6 ++-- src/ni_nitdoc.nit | 39 +-------------------- 3 files changed, 64 insertions(+), 55 deletions(-) diff --git a/share/nitdoc/scripts/github.js b/share/nitdoc/scripts/github.js index 35b51de..54ed212 100644 --- a/share/nitdoc/scripts/github.js +++ b/share/nitdoc/scripts/github.js @@ -56,13 +56,13 @@ window.onbeforeunload = function() { }; $(document).ready(function() { - + createLoginBox(); // Hide edit tags $('textarea').hide(); $('a[id=commitBtn]').hide(); $('a[id=cancelBtn]').hide(); // Display Login modal - $("#logGitHub").click(function(){ displayLogginModal(); }); + $("#logGitHub").click(function(){ toggleLoginBox(); }); // Update display updateDisplaying(); // If cookie existing the session is opened @@ -102,7 +102,7 @@ $(document).ready(function() { del_cookie("logginNitdoc"); closeAllCommentInEdtiting(); } - displayLogginModal(); + toggleLoginBox(); }); // Activate edit mode @@ -159,7 +159,7 @@ $(document).ready(function() { else{ if(!sessionStarted){ displayMessage("You need to be loggued before commit something", 45, 40); - displayLogginModal(); + toggleLoginBox(); return; } @@ -260,7 +260,7 @@ $(document).ready(function() { $('#loginGit').val(""); $('#passwordGit').val(""); loginProcess = false; - displayLogginModal(); + toggleLoginBox(); } else{ if ($.trim(updateComment) == ''){ this.value = (this.defaultValue ? this.defaultValue : ''); } @@ -353,15 +353,6 @@ function startCommitProcess() } } -function displayLogginModal(){ - if ($('.popover').is(':hidden')) { - if(sessionStarted){ getListBranches(); } - $('.popover').show(); - } - else { $('.popover').hide(); } - updateDisplaying(); -} - function updateDisplaying(){ if (checkCookie()) { @@ -993,3 +984,58 @@ function showComment(element){ textarea.height(textarea.prop("scrollHeight")); resizeTextarea(textarea); } + +/* GitHub login box management */ + +function createLoginBox() { + $("nav.main ul").append( + "
  • " + + " " + + " GitHub" + + " " + + " " + + " " + + "
  • " + ); +} + +function toggleLoginBox(){ + if ($('.popover').is(':hidden')) { + if(sessionStarted){ getListBranches(); } + $('.popover').show(); + } else { + $('.popover').hide(); + } + updateDisplaying(); +} diff --git a/share/nitdoc/styles/main.css b/share/nitdoc/styles/main.css index 746ad35..1de2f0d 100644 --- a/share/nitdoc/styles/main.css +++ b/share/nitdoc/styles/main.css @@ -677,7 +677,7 @@ fieldset { position: absolute; width : 220px; height:280px; - margin-left: -102px; + margin-left: -185px; z-index: 1010; display: block; max-width: 276px; @@ -745,7 +745,7 @@ fieldset { .popover.bottom .arrow { top: -11px; left: 50%; - margin-left: -11px; + margin-left: 72px; border-bottom-color: #999; border-bottom-color: rgba(0, 0, 0, 0.25); border-top-width: 0; @@ -798,7 +798,7 @@ fieldset { #signIn{ display: block; cursor: pointer; - margin: 10px 10px 5px 10px; + margin: 2px 10px 5px 10px; background-color: #92C929; background-image: -webkit-gradient(linear, left top, left bottom, from(#92C929), to(#1d7900)); /* Saf4+, Chrome */ background-image: -webkit-linear-gradient(top, #92C929, #1d7900); /* Chrome 10+, Saf5.1+ */ diff --git a/src/ni_nitdoc.nit b/src/ni_nitdoc.nit index e4826af..ea7575d 100644 --- a/src/ni_nitdoc.nit +++ b/src/ni_nitdoc.nit @@ -204,9 +204,9 @@ abstract class NitdocPage append("") append("") append("") - append("") append("") append("") + append("") append("") var title = "" if ctx.opt_custom_title.value != null then @@ -228,43 +228,6 @@ abstract class NitdocPage append("") append("") -- 1.7.9.5