}
}
+ /**
+ * 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(){
});
$.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();
}
</tr>
</thead>
<tbody>
- {{each role}}
+ {{each roles}}
<tr>
<td>${$value.name}</td>
<td>${$value.description}</td>
<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>
{{else}}
${$.i18n.prop('role.edit.no.user.defined')}
{{/if}}
- -->
+
</script>