From 9d23364206782bc48b8d14a4d855fd3fda09851b Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 26 Mar 2012 12:15:47 +0000 Subject: [PATCH] take of karma for adding/deleting artifact custom properties git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1305327 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/webapp/js/archiva/search.js | 8 +++++++ .../webapp/js/archiva/templates/search.html | 22 ++++++++++++++----- 2 files changed, 25 insertions(+), 5 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 b3faebc6a..aef73d32d 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 @@ -321,6 +321,14 @@ $(function() { } + hasSavePropertyKarma=function(){ + return hasKarma("archiva-add-metadata"); + } + + hasDeletePropertyKarma=function(){ + return hasKarma("archiva-delete-metadata"); + } + saveProperty=function(entry){ if($.trim(entry.key() ).length<1){ clearUserMessages(); diff --git a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html index 19595d3f6..c0fd778a6 100644 --- a/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html +++ b/archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/templates/search.html @@ -687,7 +687,9 @@
- ${$.i18n.prop('browse.artifact.metadatas.add')} + {{if hasSavePropertyKarma()}} + ${$.i18n.prop('browse.artifact.metadatas.add')} + {{/if}} @@ -755,15 +757,25 @@ {{each(i, row) itemsOnCurrentPage()}} - {{if row.editable}} + {{if row.editable && hasSavePropertyKarma()}} {{else}} ${row.key} {{/if}} - - ${$.i18n.prop('browse.artifact.metadatas.delete')} - {{if row.modified}} + {{if hasSavePropertyKarma()}} + + {{else}} + ${row.value} + {{/if}} + + + {{if hasDeletePropertyKarma()}} + ${$.i18n.prop('browse.artifact.metadatas.delete')} + {{/if}} + + + {{if row.modified && hasSavePropertyKarma()}} ${$.i18n.prop('browse.artifact.metadatas.save')} {{/if}} -- 2.39.5