From daaa3ded8d73fe3e9eb483cbf1174ed245e6250b Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 8 Jul 2016 14:30:32 +0200 Subject: Add clipboard button to public share link --- core/js/core.json | 3 ++- core/js/sharedialoglinkshareview.js | 35 +++++++++++++++++++++++++++++++++++ core/js/sharedialogview.js | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) (limited to 'core/js') diff --git a/core/js/core.json b/core/js/core.json index 03c72e9b3ff..5254e7b3d03 100644 --- a/core/js/core.json +++ b/core/js/core.json @@ -10,7 +10,8 @@ "bootstrap/js/tooltip.js", "backbone/backbone.js", "es6-promise/dist/es6-promise.js", - "davclient.js/lib/client.js" + "davclient.js/lib/client.js", + "clipboard/dist/clipboard.js" ], "libraries": [ "jquery-showpassword.js", diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 457a788d589..8ad2e270099 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -22,8 +22,11 @@ '' + '' + '
' + + '
' + '' + '' + + '' + + '
' + ' {{#if publicUpload}}' + '
' + ' ' + @@ -125,6 +128,38 @@ 'onHideFileListChange', 'onAllowPublicUploadChange' ); + + var clipboard = new Clipboard('.clipboardButton'); + clipboard.on('success', function(e) { + $input = $(e.trigger); + $input.tooltip({placement: 'bottom', trigger: 'manual', title: t('core', 'Copied!')}); + $input.tooltip('show'); + _.delay(function() { + $input.tooltip('hide'); + }, 3000); + }); + clipboard.on('error', function (e) { + $input = $(e.trigger); + var actionMsg = ''; + if (/iPhone|iPad/i.test(navigator.userAgent)) { + actionMsg = t('core', 'Not supported!'); + } else if (/Mac/i.test(navigator.userAgent)) { + actionMsg = t('core', 'Press ⌘-C to copy.'); + } else { + actionMsg = t('core', 'Press Ctrl-C to copy.'); + } + + $input.tooltip({ + placement: 'bottom', + trigger: 'manual', + title: actionMsg + }); + $input.tooltip('show'); + _.delay(function () { + $input.tooltip('hide'); + }, 3000); + }); + }, onLinkCheckBoxChange: function() { diff --git a/core/js/sharedialogview.js b/core/js/sharedialogview.js index c17da94bab3..5637ffc3a0a 100644 --- a/core/js/sharedialogview.js +++ b/core/js/sharedialogview.js @@ -30,7 +30,7 @@ ''; var TEMPLATE_REMOTE_SHARE_INFO = - ''; /** -- cgit v1.2.3 From 4d67429cf034ef4912bd78fb9dac91155ff0fec1 Mon Sep 17 00:00:00 2001 From: Thomas Müller Date: Fri, 8 Jul 2016 15:23:38 +0200 Subject: Use an icon to set the email instead of a button with string --- apps/files_sharing/css/sharetabview.css | 1 + core/css/icons.css | 4 ++++ core/js/sharedialogmailview.js | 8 ++++---- core/js/tests/specs/sharedialogviewSpec.js | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'core/js') diff --git a/apps/files_sharing/css/sharetabview.css b/apps/files_sharing/css/sharetabview.css index 66c8b4691eb..e048b7564ac 100644 --- a/apps/files_sharing/css/sharetabview.css +++ b/apps/files_sharing/css/sharetabview.css @@ -30,6 +30,7 @@ margin-left: 0; } .shareTabView input[type="text"].shareWithField, +.shareTabView input[type="text"].emailField, .shareTabView input[type="text"].linkText { width: 80%; } diff --git a/core/css/icons.css b/core/css/icons.css index 6d78363d3d5..1a632fdd58b 100644 --- a/core/css/icons.css +++ b/core/css/icons.css @@ -204,6 +204,10 @@ img.icon-loading-small-dark, object.icon-loading-small-dark, video.icon-loading- background-image: url('../img/actions/mail.svg'); } +.icon-mail-grey { + background-image: url('../img/actions/mail-grey.svg'); +} + .icon-menu { background-image: url('../img/actions/menu.svg'); } diff --git a/core/js/sharedialogmailview.js b/core/js/sharedialogmailview.js index 84e3f3242ad..79741e92ac5 100644 --- a/core/js/sharedialogmailview.js +++ b/core/js/sharedialogmailview.js @@ -16,9 +16,9 @@ var TEMPLATE = '{{#if shareAllowed}}' + ' {{#if mailPublicNotificationEnabled}}' + - '