mirror of https://github.com/apache/archiva.git
move user edition to tab too
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1220290 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
413430a449
commit
5c94157a44
|
@ -94,7 +94,7 @@
|
||||||
<li class="active" id="users-view-tabs-li-users-grid">
|
<li class="active" id="users-view-tabs-li-users-grid">
|
||||||
<a href="#users-view">Users</a>
|
<a href="#users-view">Users</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li id="users-view-tabs-li-user-edit">
|
||||||
<a href="#createUserForm">Add User</a>
|
<a href="#createUserForm">Add User</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -65,12 +65,7 @@ $(function() {
|
||||||
window.redbackModel.usersViewModel.users.push(currentUser);
|
window.redbackModel.usersViewModel.users.push(currentUser);
|
||||||
clearForm("#main-content #user-create");
|
clearForm("#main-content #user-create");
|
||||||
$("#main-content #user-create").hide();
|
$("#main-content #user-create").hide();
|
||||||
|
activateUsersGridTab();
|
||||||
$("#main-content #users-view-tabs li").removeClass("active");
|
|
||||||
$("#main-content #users-view-tabs-content div").removeClass("active");
|
|
||||||
// activate users grid tab
|
|
||||||
$("#main-content #users-view-tabs-content #users-view").addClass("active");
|
|
||||||
$("#users-view-tabs-li-users-grid").addClass("active");
|
|
||||||
return this;
|
return this;
|
||||||
} else {
|
} else {
|
||||||
displayErrorMessage("user cannot created");
|
displayErrorMessage("user cannot created");
|
||||||
|
@ -152,7 +147,7 @@ $(function() {
|
||||||
if (created == true) {
|
if (created == true) {
|
||||||
displaySuccessMessage("user updated:"+currentUser.username());
|
displaySuccessMessage("user updated:"+currentUser.username());
|
||||||
clearForm("#main-content #user-create");
|
clearForm("#main-content #user-create");
|
||||||
$("#main-content #user-create").hide();
|
activateUsersGridTab();
|
||||||
return this;
|
return this;
|
||||||
} else {
|
} else {
|
||||||
displayErrorMessage("user cannot be updated");
|
displayErrorMessage("user cannot be updated");
|
||||||
|
@ -168,7 +163,7 @@ $(function() {
|
||||||
this.save=function(){
|
this.save=function(){
|
||||||
$.log("user.save create:"+window.redbackModel.createUser);
|
$.log("user.save create:"+window.redbackModel.createUser);
|
||||||
if (window.redbackModel.createUser==true){
|
if (window.redbackModel.createUser==true){
|
||||||
var valid = $("#main-content #createUserForm #user-create").valid();
|
var valid = $("#main-content #user-create").valid();
|
||||||
|
|
||||||
if (valid==false) {
|
if (valid==false) {
|
||||||
$.log("user#save valid:false");
|
$.log("user#save valid:false");
|
||||||
|
|
|
@ -62,7 +62,7 @@ $(function() {
|
||||||
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) {
|
$("#main-content #createUserForm #user-create").delegate("#user-create-form-cancel-button", "click keydown", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('#user-create').hide();
|
activateUsersGridTab();
|
||||||
});
|
});
|
||||||
$("#user-create").validate({
|
$("#user-create").validate({
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -110,20 +110,23 @@ $(function() {
|
||||||
this.editUserBox=function(user) {
|
this.editUserBox=function(user) {
|
||||||
window.redbackModel.createUser=false;
|
window.redbackModel.createUser=false;
|
||||||
clearUserMessages();
|
clearUserMessages();
|
||||||
$("#main-content #user-edit").remove();
|
//$("#main-content #user-edit").remove();
|
||||||
$("#main-content").append("<div id='user-edit'></div>");
|
$("#main-content").append("<div id='user-edit'></div>");
|
||||||
$("#main-content #user-edit").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
|
//$("#main-content #user-edit").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
|
||||||
$("#main-content #user-create").remove();
|
$("#main-content #createUserForm").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
|
||||||
$("#main-content #user-edit").show();
|
|
||||||
|
//$("#main-content #user-create").remove();
|
||||||
|
//$("#main-content #user-edit").show();
|
||||||
|
|
||||||
var viewModel = new userViewModel(user);
|
var viewModel = new userViewModel(user);
|
||||||
|
|
||||||
ko.applyBindings(viewModel,$("#main-content #user-edit").get(0));
|
ko.applyBindings(viewModel,$("#main-content #createUserForm").get(0));
|
||||||
|
|
||||||
|
activateUsersEditTab();
|
||||||
|
|
||||||
$("#main-content #user-create").delegate("#user-create-form-cancel-button", "click keydown", function(e) {
|
$("#main-content #user-create").delegate("#user-create-form-cancel-button", "click keydown", function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$('#main-content #user-create').remove();
|
activateUsersGridTab();
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#main-content #user-create").validate({
|
$("#main-content #user-create").validate({
|
||||||
|
@ -173,6 +176,21 @@ $(function() {
|
||||||
this.user=user;
|
this.user=user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activateUsersGridTab=function(){
|
||||||
|
$("#main-content #users-view-tabs li").removeClass("active");
|
||||||
|
$("#main-content #users-view-tabs-content div").removeClass("active");
|
||||||
|
// activate users grid tab
|
||||||
|
$("#main-content #users-view-tabs-content #users-view").addClass("active");
|
||||||
|
$("#users-view-tabs-li-users-grid").addClass("active");
|
||||||
|
}
|
||||||
|
|
||||||
|
activateUsersEditTab=function(){
|
||||||
|
$("#main-content #users-view-tabs li").removeClass("active");
|
||||||
|
$("#main-content #users-view-tabs-content div").removeClass("active");
|
||||||
|
// activate users edit tab
|
||||||
|
$("#main-content #users-view-tabs-content #createUserForm").addClass("active");
|
||||||
|
$("#users-view-tabs-li-user-edit").addClass("active");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
Loading…
Reference in New Issue