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
This commit is contained in:
Olivier Lamy 2012-09-10 14:39:00 +00:00
parent fc2b1e3cc0
commit e7381a56b1
3 changed files with 23 additions and 6 deletions

View File

@ -86,13 +86,25 @@ define("archiva.search",["jquery","i18n","jquery.tmpl","choosen","knockout","kno
} }
deleteGroupId=function(groupId){ deleteGroupId=function(groupId){
var previousHash=getUrlHash();
$.log("previousHash:"+previousHash);
var repoId=getSelectedBrowsingRepository(); var repoId=getSelectedBrowsingRepository();
if(!repoId){ 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; return;
} }
var previousHash=getUrlHash();
$.log("previousHash:"+previousHash);
openDialogConfirm(function(){ openDialogConfirm(function(){
$.ajax({ $.ajax({
url:"restServices/archivaServices/repositoriesService/deleteGroupId?groupId="+groupId+"&repositoryId="+repoId, 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+="~"+self.repositoryId;
} }
location+="/"+groupId; location+="/"+groupId;
window.sammyArchivaApplication.setLocation(location); } window.sammyArchivaApplication.setLocation(location);
}
displayParent=function(){ displayParent=function(){
var selectedRepo=getSelectedBrowsingRepository(); var selectedRepo=getSelectedBrowsingRepository();

View File

@ -436,6 +436,10 @@ require(["jquery","jquery.tmpl","i18n"], function(jquery,jqueryTmpl,i18n) {
return this.substring(idx); return this.substring(idx);
} }
escapeDot=function(str){
return str.replace(/\./g,"\\\.");
}
//----------------------------------------- //-----------------------------------------
// extends jquery tmpl to support var def // extends jquery tmpl to support var def
//----------------------------------------- //-----------------------------------------

View File

@ -52,7 +52,7 @@
{{if browseResultEntry.project}} {{if browseResultEntry.project}}
{{if deleteKarma}} {{if deleteKarma}}
<li class="browse-list-project"> <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> <a href="#" data-bind="click:function(){displayProjectEntry(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
</li> </li>
{{else}} {{else}}
@ -63,7 +63,7 @@
{{else}} {{else}}
{{if deleteKarma}} {{if deleteKarma}}
<li class="browse-list"> <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> <a data-bind="click:function(){displayGroupId(browseResultEntry.name)}" href="#" title="folder ${displayEntry(browseResultEntry.name)}">${displayEntry(browseResultEntry.name)}</a>
</li> </li>
{{else}} {{else}}