From e7381a56b1683385702a517dda31d9247ee995c3 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 10 Sep 2012 14:39:00 +0000 Subject: [PATCH] use a popover to explain why delete is not possible git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1382889 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/js/archiva/search.js | 21 +++++++++++++++---- .../src/main/webapp/js/archiva/utils.js | 4 ++++ .../webapp/js/templates/archiva/search.html | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js index eddc9867c..ed4b5dfe4 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js @@ -86,13 +86,25 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno } deleteGroupId=function(groupId){ - var previousHash=getUrlHash(); - $.log("previousHash:"+previousHash); + var repoId=getSelectedBrowsingRepository(); if(!repoId){ - displayErrorMessage($.i18n.prop('groupId.delete.missing.repoId')); + var escapedGroupId=escapeDot(groupId ); + var selected = $("#main-content" ).find("#delete-"+escapedGroupId ); + selected.attr("data-content",$.i18n.prop('groupId.delete.missing.repoId')) + selected.popover({ + html:true, + template: '

', + placement:'top', + trigger:'manual'}); + selected.popover('show'); + selected.mouseover(function(){ + selected.popover("destroy"); + }); return; } + var previousHash=getUrlHash(); + $.log("previousHash:"+previousHash); openDialogConfirm(function(){ $.ajax({ url:"restServices/archivaServices/repositoriesService/deleteGroupId?groupId="+groupId+"&repositoryId="+repoId, @@ -232,7 +244,8 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno location+="~"+self.repositoryId; } location+="/"+groupId; - window.sammyArchivaApplication.setLocation(location); } + window.sammyArchivaApplication.setLocation(location); + } displayParent=function(){ var selectedRepo=getSelectedBrowsingRepository(); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js index cfb60c885..3eab02a92 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js @@ -436,6 +436,10 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) { return this.substring(idx); } + escapeDot=function(str){ + return str.replace(/\./g,"\\\."); + } + //----------------------------------------- // extends jquery tmpl to support var def //----------------------------------------- diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html index 7dd83709e..00658588e 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html @@ -52,7 +52,7 @@ {{if browseResultEntry.project}} {{if deleteKarma}}
  • - + ${displayEntry(browseResultEntry.name)}
  • {{else}} @@ -63,7 +63,7 @@ {{else}} {{if deleteKarma}}
  • - + ${displayEntry(browseResultEntry.name)}
  • {{else}} -- 2.39.5