summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js/settings-admin.js
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-06-03 16:50:05 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-06-03 16:53:03 +0200
commitb5a145b297ee933dc4c9d7e016a57feba91bf8ac (patch)
tree4999e4053582a73b2a07c030afd3877f4937717b /apps/files_sharing/js/settings-admin.js
parent37afab87b56fa7b2a1b0e751df72e9624663f94f (diff)
downloadnextcloud-server-b5a145b297ee933dc4c9d7e016a57feba91bf8ac.tar.gz
nextcloud-server-b5a145b297ee933dc4c9d7e016a57feba91bf8ac.zip
convert mail template editor to app framework for a restful api
Diffstat (limited to 'apps/files_sharing/js/settings-admin.js')
-rw-r--r--apps/files_sharing/js/settings-admin.js42
1 files changed, 23 insertions, 19 deletions
diff --git a/apps/files_sharing/js/settings-admin.js b/apps/files_sharing/js/settings-admin.js
index 25950b9f4f3..0362af0232b 100644
--- a/apps/files_sharing/js/settings-admin.js
+++ b/apps/files_sharing/js/settings-admin.js
@@ -1,17 +1,16 @@
$(document).ready(function() {
-
+
var loadTemplate = function (theme, template) {
- $.get(
- OC.filePath( 'files_sharing', 'ajax', 'getmailtemplate.php' )
- , { theme: theme, template: template }
- ).done(function( result ) {
- $( '#mailTemplateSettings textarea' ).val(result);
- }).fail(function( result ) {
- alert(result);
- });
-
+ $.get(
+ OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
+ { theme: theme, template: template }
+ ).done(function( result ) {
+ $( '#mailTemplateSettings textarea' ).val(result);
+ }).fail(function( result ) {
+ alert(result);
+ });
}
-
+
// load default template
var theme = $( '#mts-theme' ).val();
var template = $( '#mts-template' ).val();
@@ -24,6 +23,7 @@ $(document).ready(function() {
loadTemplate(theme, template);
}
);
+
$( '#mts-theme' ).change(
function() {
var theme = $( this ).val();
@@ -31,6 +31,7 @@ $(document).ready(function() {
loadTemplate(theme, template);
}
);
+
$( '#mailTemplateSettings .actions' ).on('click', '.save',
function() {
var theme = $( '#mts-theme' ).val();
@@ -38,27 +39,29 @@ $(document).ready(function() {
var content = $( '#mailTemplateSettings textarea' ).val();
OC.msg.startSaving('#mts-msg');
$.post(
- OC.filePath( 'files_sharing', 'ajax', 'setmailtemplate.php' )
- , { theme: theme, template: template, content: content }
+ OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
+ { theme: theme, template: template, content: content }
).done(function( result ) {
var data = { status:'success', data:{message:t('files_sharing', 'Saved')} };
OC.msg.finishedSaving('#mts-msg', data);
}).fail(function( result ) {
var data = { status:'error', data:{message:t('files_sharing', 'Error')} };
OC.msg.finishedSaving('#mts-msg', data);
- });
+ });
}
);
+
$( '#mailTemplateSettings .actions' ).on('click', '.reset',
function() {
var theme = $( '#mts-theme' ).val();
var template = $( '#mts-template' ).val();
var content = $( '#mailTemplateSettings textarea' ).val();
OC.msg.startSaving('#mts-msg');
- $.post(
- OC.filePath( 'files_sharing', 'ajax', 'resetmailtemplate.php' )
- , { theme: theme, template: template }
- ).done(function( result ) {
+ $.ajax({
+ type: "DELETE",
+ url: OC.generateUrl('apps/files_sharing/settings/mailtemplate'),
+ data: { theme: theme, template: template }
+ }).done(function( result ) {
var data = { status:'success', data:{message:t('files_sharing', 'Reset')} };
OC.msg.finishedSaving('#mts-msg', data);
@@ -69,7 +72,8 @@ $(document).ready(function() {
}).fail(function( result ) {
var data = { status:'error', data:{message:t('files_sharing', 'Error')} };
OC.msg.finishedSaving('#mts-msg', data);
- });
+ });
}
);
+
});