This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository scmwebeditor. See http://git.nuiton.org/scmwebeditor.git commit 19e9f46a109f5f12d13161a91339f5249ec60732 Author: Hugo PIGEON <hpigeon@codelutin.com> Date: Wed May 27 14:08:42 2015 +0200 Add a confirmation message when the user makes a commit without a commit message --- .../i18n/scmwebeditor-ui-web_en_GB.properties | 1 + .../i18n/scmwebeditor-ui-web_fr_FR.properties | 1 + .../main/webapp/WEB-INF/content/loginBrowse.jsp | 24 +------------- .../webapp/WEB-INF/content/modificationViewer.jsp | 38 ++++++++++++++++++---- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties index 9720a75..d2acfda 100644 --- a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties +++ b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_en_GB.properties @@ -10,6 +10,7 @@ scm.clickHere=click here scm.close=Close scm.commitMessage=Message describing the changes\: scm.commitMessageTitle=Let a message to describe the changes +scm.commitWithoutMessage=It is recommended to associate the changes to a message describing them. You have not given a message, are you sure that you want to save? scm.connection=Connection scm.createBranch=Create a new branch scm.createBranch.branchName=Name of the new branch\: diff --git a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties index 81b972f..f5ada72 100644 --- a/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties +++ b/swe-ui-web/src/main/resources/i18n/scmwebeditor-ui-web_fr_FR.properties @@ -10,6 +10,7 @@ scm.clickHere=cliquez ici scm.close=Fermer scm.commitMessage=Message associé aux modifications \: scm.commitMessageTitle=Laisser un message pour décrire les modifications +scm.commitWithoutMessage=Il est recommandé d'associer les modifications à un message les décrivant. Vous n'avez pas renseigné de message, êtes-vous sûr de vouloir enregistrer ? scm.connection=Connexion scm.createBranch=Créer une nouvelle branche scm.createBranch.branchName=Nom de la nouvelle branche \: diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp index 4fb5097..c621ed7 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/loginBrowse.jsp @@ -27,28 +27,6 @@ <%@ taglib prefix="sj" uri="/struts-jquery-tags" %> <sj:head jquerytheme="default"/> -<script type="test/javascript"> - - $("#load-icon").hide(); - - $("#ajaxSearchButtonLogin").on("click", function() { - $("#load-icon").show(); - }); - - $("#username").on("keypress", function(e) { - if (e.keyCode == 13) { - $("#load-icon").show(); - } - }); - - $("#pw").on("keypress", function(e) { - if (e.keyCode == 13) { - $("#load-icon").show(); - } - }); - -</script> - <div id="search"> <p><s:text name="scm.mustBeLog"/></p> @@ -75,6 +53,6 @@ > </sj:submit> - <img src="struts/js/jstree/themes/classic/throbber.gif" alt="loading" id="load-icon"/> + <img src="struts/js/jstree/themes/classic/throbber.gif" alt="loading" id="indicator"/> </p> </div> diff --git a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp index 2e03c04..82c23fa 100644 --- a/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp +++ b/swe-ui-web/src/main/webapp/WEB-INF/content/modificationViewer.jsp @@ -63,10 +63,12 @@ var exitAfterCommit = false; + /* Changes the value of the new text */ function loadChange() { document.getElementById('newTextId').value = editor.getValue(); } + /* Asks the user if he really wants to exit when changes are made */ function confirmExit() { var text = '<s:text name="scm.exitJavascript"/>'; @@ -77,29 +79,51 @@ return cancelRedirect(text, document.getElementById('projectUrl')); } + /* Asks the user if he really wants to close the page when changes are made */ function confirmExitOnUnload() { if (document.getElementById('newTextId').value != editor.getValue()) { return '<s:text name="scm.exitJavascript"/>'; } } + /* Opens the popin for the commit */ function openCommitPopin() { document.getElementById("commitPopin").style.display = "block"; document.getElementById("popinBackground").style.display = "block"; } + /* Closes the popin for the commit */ function closeCommitPopin() { document.getElementById("commitPopin").style.display = "none"; document.getElementById("popinBackground").style.display = "none"; } + /* Exits the edit page if asked */ function checkExit() { if (exitAfterCommit) { document.location.href = "checkout.action"; } } + /* Commit form validation */ + $.subscribe("beforeCommit", function(event, data) { + var commitMessage = document.getElementById("commitMessage").value; + var continueProcess = true; + + if (commitMessage == "") { + continueProcess = confirm("<s:text name="scm.commitWithoutMessage"/>"); + } + + event.originalEvent.options.submit = continueProcess; + + if (continueProcess) { + loadChange(); + checkExit(); + } + }); + window.onbeforeunload = confirmExitOnUnload; + </script> <s:if test="format == 'rst'"> @@ -430,13 +454,13 @@ </s:set> <sj:a - onclick="loadChange(); checkExit();" - id="ajaxSaveButton" - formIds="editForm,commitForm" - targets="htmlcontentCommit" - href="%{ajaxCommit}" - title="%{scm.saveAndContinueTitle}" - > + onBeforeTopics="beforeCommit" + id="ajaxSaveButton" + formIds="editForm,commitForm" + targets="htmlcontentCommit" + href="%{ajaxCommit}" + title="%{scm.saveAndContinueTitle}" + > <s:submit id="Save" value="%{scm.submit}"/> </sj:a> -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.