use bootstrap toggle button feature

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1391470 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-28 14:00:56 +00:00
parent 08d17fd8dd
commit 08a7645623
2 changed files with 9 additions and 2 deletions

View File

@ -521,10 +521,12 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
this.networkConfiguration=ko.observable(networkConfiguration);
save=function(){
$("#user-messages" ).html(mediumSpinnerImg());
var mainContent=$("#main-content");
if (!$("#main-content" ).find("#network-configuration-edit-form").valid()){
return;
}
clearUserMessages();
mainContent.find("#network-configuration-btn-save" ).button('loading');
$.ajax("restServices/archivaServices/archivaAdministrationService/setNetworkConfiguration", {
type: "POST",
contentType: 'application/json',
@ -532,6 +534,10 @@ define("archiva.general-admin",["jquery","i18n","utils","jquery.tmpl","knockout"
dataType: 'json',
success: function(data){
displaySuccessMessage( $.i18n.prop("network-configuration.updated"));
},
complete: function(){
removeMediumSpinnerImg("#user-messages");
mainContent.find("#network-configuration-btn-save" ).button('reset');
}
});
}

View File

@ -311,7 +311,8 @@
</div>
</div>
</fieldset>
<button id="network-configuration-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
<button id="network-configuration-btn-save" data-loading-text="${$.i18n.prop('common.loading')}"
data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
</form>
</script>