fix roles grid due to new js bean mapping

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1226094 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-12-31 13:56:12 +00:00
parent 3db8100dcd
commit 4214210c88
2 changed files with 31 additions and 8 deletions

View File

@ -54,6 +54,28 @@ $(function() {
}
}
/**
* view model used for roles grid
*/
rolesViewModel=function() {
this.roles = ko.observableArray([]);
this.loadRoles = function() {
$.ajax("restServices/redbackServices/roleManagementService/allRoles", {
type: "GET",
async: false,
dataType: 'json',
success: function(data) {
var mappedRoles = $.map(data.role, function(item) {
return mapRole(item);
});
self.roles(mappedRoles);
}
}
);
};
}
displayRolesGrid = function(){
@ -69,7 +91,8 @@ $(function() {
});
$.log(ko.toJSON(roles));
$("#main-content").html($("#rolesTabs").tmpl());
$("#main-content #roles-view-tabs-content #roles-view").html($("#rolesGrid").tmpl(roles));
var data = {roles: roles};
$("#main-content #roles-view-tabs-content #roles-view").html($("#rolesGrid").tmpl(data));
$("#roles-view-tabs").tabs();
activateRolesGridTab();
}

View File

@ -8,7 +8,7 @@
</tr>
</thead>
<tbody>
{{each role}}
{{each roles}}
<tr>
<td>${$value.name}</td>
<td>${$value.description}</td>
@ -69,18 +69,18 @@
<div class="page-header">
<h3>${$.i18n.prop('role.model.parent.roles')}</h3>
</div>
{{if parentRoleNames}}
{{if parentRoleNames()}}
<ul>
{{if $.isArray(parentRoleNames)}}
{{each parentRoleNames}}
{{if $.isArray(parentRoleNames())}}
{{each parentRoleNames()}}
<li>${$value}</li>
{{/each}}
{{else}}
<li>${parentRoleNames}</li>
<li>${parentRoleNames()}</li>
{{/if}}
</ul>
{{/if}}
<!--
<div class="page-header">
<h3>${$.i18n.prop('role.model.child.roles')}</h3>
</div>
@ -167,5 +167,5 @@
{{else}}
${$.i18n.prop('role.edit.no.user.defined')}
{{/if}}
-->
</script>