richdocuments/js/admin.js
Andras Timar df0c7cce94 replace trailing slash of wopi url
(cherry picked from commit 6d49e2d003b1c724bbc1e9958b2eb5946b75e2eb)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
2017-04-28 12:28:14 +02:00

44 lines
971 B
JavaScript

/*global OC, $ */
var documentsSettings = {
save : function() {
$('#wopi_apply').attr('disabled', true);
var data = {
wopi_url : $('#wopi_url').val().replace(/\/$/, '')
};
OC.msg.startAction('#documents-admin-msg', t('richdocuments', 'Saving...'));
$.post(
OC.filePath('richdocuments', 'ajax', 'admin.php'),
data,
documentsSettings.afterSave
);
},
saveDocFormat: function(format) {
$.post(
OC.filePath('richdocuments', 'ajax', 'admin.php'),
{ 'doc_format': format }
);
},
afterSave : function(response){
$('#wopi_apply').attr('disabled', false);
OC.msg.finishedAction('#documents-admin-msg', response);
},
initialize: function() {
$('#wopi_apply').on('click', documentsSettings.save);
$(document).on('change', '.doc-format-ooxml', function() {
var ooxml = this.checked;
documentsSettings.saveDocFormat(ooxml ? 'ooxml' : 'odf');
});
}
};
$(document).ready(function(){
documentsSettings.initialize();
});