]> source.dussan.org Git - archiva.git/commitdiff
use a popover to explain why delete is not possible
authorOlivier Lamy <olamy@apache.org>
Mon, 10 Sep 2012 14:39:00 +0000 (14:39 +0000)
committerOlivier Lamy <olamy@apache.org>
Mon, 10 Sep 2012 14:39:00 +0000 (14:39 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1382889 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/search.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/utils.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/search.html

index eddc9867c27452cd8262ecf54660c06f151dd13f..ed4b5dfe425c805aeebb841385e519be363d7d1b 100644 (file)
@@ -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: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><div class="popover-content"><p></p></div></div></div>',
+          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();
index cfb60c885fc2daffe4e2bf88fc3f0c66e4f55d4d..3eab02a921c90db12298b76052d63388db9f246c 100644 (file)
@@ -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
   //-----------------------------------------
index 7dd83709ed3a044a81b5ad1df6993647b9a1b558..00658588e93e441a6f6f0ef04378912f1b1f0d88 100644 (file)
@@ -52,7 +52,7 @@
         {{if browseResultEntry.project}}
           {{if deleteKarma}}
             <li class="browse-list-project">
-              <img src="images/trash.png" data-bind="click:function(){deleteGroupId(browseResultEntry.name)}"/>
+              <img id="delete-${browseResultEntry.name}" src="images/trash.png" data-bind="click:function(){deleteGroupId(browseResultEntry.name)}"/>
               <a href="#" data-bind="click:function(){displayProjectEntry(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
             </li>
           {{else}}
@@ -63,7 +63,7 @@
         {{else}}
           {{if deleteKarma}}
             <li class="browse-list">
-              <img src="images/trash.png" data-bind="click:function(){deleteGroupId(browseResultEntry.name)}"/>
+              <img id="delete-${browseResultEntry.name}" src="images/trash.png" data-bind="click:function(){deleteGroupId(browseResultEntry.name)}"/>
               <a data-bind="click:function(){displayGroupId(browseResultEntry.name)}" href="#" title="folder ${displayEntry(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
             </li>
           {{else}}