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
This commit is contained in:
Olivier Lamy 2012-03-26 12:15:47 +00:00
parent 81f3e02bfb
commit 9d23364206
2 changed files with 25 additions and 5 deletions

View File

@ -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();

View File

@ -687,7 +687,9 @@
</table>
<div id="artifactMetadata_Pagination"></div>
{{if hasSavePropertyKarma()}}
<a href="#" class="btn btn-primary" data-bind="click: addProperty">${$.i18n.prop('browse.artifact.metadatas.add')}</a>
{{/if}}
</div>
</div>
@ -755,15 +757,25 @@
<tbody>
{{each(i, row) itemsOnCurrentPage()}}
<tr>
{{if row.editable}}
{{if row.editable && hasSavePropertyKarma()}}
<td><input type="text" data-bind="value: row.key"/></td>
{{else}}
<td>${row.key}</td>
{{/if}}
<td><input type="text" data-bind="value: row.value"/></td>
<td><a href="#" class="btn btn-danger" data-bind="click: function(){deleteProperty(row)}">${$.i18n.prop('browse.artifact.metadatas.delete')}</a></td>
<td>
{{if row.modified}}
{{if hasSavePropertyKarma()}}
<input type="text" data-bind="value: row.value"/>
{{else}}
${row.value}
{{/if}}
</td>
<td>
{{if hasDeletePropertyKarma()}}
<a href="#" class="btn btn-danger" data-bind="click: function(){deleteProperty(row)}">${$.i18n.prop('browse.artifact.metadatas.delete')}</a>
{{/if}}
</td>
<td>
{{if row.modified && hasSavePropertyKarma()}}
<a href="#" class="btn btn-warning" data-bind="click: function(){saveProperty(row)}">${$.i18n.prop('browse.artifact.metadatas.save')}</a>
{{/if}}
</td>