mirror of https://github.com/apache/archiva.git
move display users roles to a knockout bind to prepare update mode
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1228215 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f752ebe059
commit
cfd88272a0
|
@ -61,10 +61,11 @@
|
|||
<button class="btn" id="user-create-form-cancel-button">${i18n('cancel')}</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="span6 columns" id="user-edit-roles-view" style="display:none">
|
||||
<div class="span6 columns" id="user-edit-roles" style="display:none">
|
||||
<div class="page-header">
|
||||
<h3>${$.i18n.prop('effective.roles')}</h3>
|
||||
</div>
|
||||
<div id="user-edit-roles-view"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -99,6 +99,8 @@
|
|||
|
||||
<script id="user_edit_roles_tmpl" type="text/x-jquery-tmpl">
|
||||
<ul>
|
||||
${name}
|
||||
{{each $data.roles}}
|
||||
<li>${$value.name}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</script>
|
||||
|
|
|
@ -61,7 +61,7 @@ $(function() {
|
|||
window.redbackModel.createUser=true;
|
||||
$("#main-content #user-edit").remove();
|
||||
$('#main-content #user-create').show();
|
||||
ko.renderTemplate("redback/user-edit-tmpl", new user(), null, $("#createUserForm").get(0),"replaceChildren");
|
||||
ko.renderTemplate("redback/user-edit-tmpl", new User(), null, $("#createUserForm").get(0),"replaceChildren");
|
||||
$("#main-content #createUserForm #user-create").delegate("#user-create-form-cancel-button", "click keydown", function(e) {
|
||||
e.preventDefault();
|
||||
activateUsersGridTab();
|
||||
|
@ -146,13 +146,22 @@ $(function() {
|
|||
user.update();
|
||||
});
|
||||
|
||||
$.ajax("restServices/redbackServices/roleManagementService/getEffectivelyAssignedRoles/"+user.username(), {
|
||||
$("#user-edit-roles").show();
|
||||
$( "#user-edit-roles-view" ).append(smallSpinnerImg());
|
||||
$.ajax("restServices/redbackServices/roleManagementService/getEffectivelyAssignedRoles/"+encodeURIComponent(user.username()), {
|
||||
type: "GET",
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
$( "#user-edit-roles-view" ).append( jQuery("#user_edit_roles_tmpl" ).tmpl( data.role ) );
|
||||
$("#user-edit-roles-view").show();
|
||||
var mappedRoles = $.map(data.role, function(item) {
|
||||
return mapRole(item);
|
||||
});
|
||||
//$( "#user-edit-roles-view" ).append( jQuery("#user_edit_roles_tmpl" ).tmpl( data.role ) );
|
||||
viewModel.roles=mappedRoles;
|
||||
$( "#user-edit-roles-view").attr("data-bind",'template: {name:"user_edit_roles_tmpl"}');
|
||||
ko.applyBindings(viewModel,$("#user-edit-roles-view").get(0));
|
||||
removeSmallSpinnerImg();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -160,6 +169,11 @@ $(function() {
|
|||
}
|
||||
}
|
||||
|
||||
userViewModel=function(user) {
|
||||
this.user=user;
|
||||
this.roles = ko.observableArray(new Array());
|
||||
}
|
||||
|
||||
/**
|
||||
* called from the menu to display tabs with users grid
|
||||
*/
|
||||
|
@ -185,12 +199,6 @@ $(function() {
|
|||
$("#users-view-tabs-content #users-view").addClass("active");
|
||||
}
|
||||
|
||||
|
||||
|
||||
userViewModel=function(user) {
|
||||
this.user=user;
|
||||
}
|
||||
|
||||
activateUsersGridTab=function(){
|
||||
$("#main-content #users-view-tabs li").removeClass("active");
|
||||
$("#main-content #users-view-tabs-content div").removeClass("active");
|
||||
|
|
Loading…
Reference in New Issue