summaryrefslogtreecommitdiffstats
path: root/apps/files_external/js/dropbox.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_external/js/dropbox.js')
-rw-r--r--apps/files_external/js/dropbox.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js
new file mode 100644
index 00000000000..9e1427e4603
--- /dev/null
+++ b/apps/files_external/js/dropbox.js
@@ -0,0 +1,28 @@
+$(document).ready(function() {
+
+ function generateUrl($tr) {
+ var app_key = $tr.find('[data-parameter="app_key"]').val();
+ if (app_key) {
+ return 'https://www.dropbox.com/developers/apps/info/' + app_key;
+ } else {
+ return 'https://www.dropbox.com/developers/apps';
+ }
+ }
+
+ OCA.External.Settings.mountConfig.whenSelectBackend(function($tr, backend, onCompletion) {
+ if (backend === 'dropbox') {
+ var config = $tr.find('.configuration');
+ var el = $(document.createElement('a'))
+ .attr('href', generateUrl($tr))
+ .attr('target', '_blank')
+ .text(t('files_external', 'Dropbox Configuration') + ' ↗')
+ ;
+ el.on('click', function(event) {
+ var a = $(event.target);
+ a.attr('href', generateUrl($(this).parent()));
+ });
+ config.append(el);
+ }
+ });
+
+});