diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-10-31 10:28:18 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2018-11-01 21:30:45 +0100 |
commit | 106ed07d6ac306420d091b44ddc4427bd5cf228f (patch) | |
tree | 1fd9b6edafcbebc666de0b76440199ae32aa795d /core/js | |
parent | 1bd6d39b39dd527ad095510173e9012afaafd3b0 (diff) | |
download | nextcloud-server-106ed07d6ac306420d091b44ddc4427bd5cf228f.tar.gz nextcloud-server-106ed07d6ac306420d091b44ddc4427bd5cf228f.zip |
Copy link outside menu
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/share/sharedialoglinkshareview.handlebars | 6 | ||||
-rw-r--r-- | core/js/share/sharedialoglinkshareview_popover_menu.handlebars | 16 | ||||
-rw-r--r-- | core/js/sharedialoglinkshareview.js | 34 | ||||
-rw-r--r-- | core/js/sharetemplates.js | 22 |
4 files changed, 43 insertions, 35 deletions
diff --git a/core/js/share/sharedialoglinkshareview.handlebars b/core/js/share/sharedialoglinkshareview.handlebars index a8a6e795839..9b44596f7a3 100644 --- a/core/js/share/sharedialoglinkshareview.handlebars +++ b/core/js/share/sharedialoglinkshareview.handlebars @@ -5,7 +5,7 @@ <div class="avatar icon-public-white"></div> <span class="username">{{newShareLabel}}</span> <span class="sharingOptionsGroup"> - <span class="icon icon-add new-share" title="{{newShareTitle}}"></span> + <span class="icon icon-add new-share has-tooltip" title="{{newShareTitle}}"></span> <span class="icon icon-loading-small hidden"></span> </span> </li> @@ -13,7 +13,9 @@ {{#each linkShares}} <li data-share-id="{{cid}}"> <div class="avatar icon-public-white"></div><span class="username" title="{{linkShareLabel}}">{{linkShareLabel}}</span> + <span class="sharingOptionsGroup"> + <a href="#" class="clipboard-button icon icon-clippy has-tooltip" data-clipboard-text="{{shareLinkURL}}" title="{{copyLabel}}"></a> <div class="share-menu" tabindex="0"><span class="icon icon-more"></span> {{#if showPending}} {{{pendingPopoverMenu}}} @@ -26,5 +28,5 @@ {{/each}} </ul> {{else}} -{{#if noSharingPlaceholder}}<input id="shareWith-{{cid}}" class="shareWithField" type="text" placeholder="{{noSharingPlaceholder}}" disabled="disabled"/>{{/if}} +{{#if noSharingPlaceholder}}<input id="shareWith-{{cid}}" class="shareWithField" type="text" placeholder="{{noSharingPlaceholder}}" disabled="disabled" />{{/if}} {{/if}} diff --git a/core/js/share/sharedialoglinkshareview_popover_menu.handlebars b/core/js/share/sharedialoglinkshareview_popover_menu.handlebars index 6f504811be4..3a370224437 100644 --- a/core/js/share/sharedialoglinkshareview_popover_menu.handlebars +++ b/core/js/share/sharedialoglinkshareview_popover_menu.handlebars @@ -1,23 +1,17 @@ <div class="popovermenu menu"> <ul> - <li> - <a href="#" class="menuitem clipboardButton" data-clipboard-text="{{shareLinkURL}}"> - <span class="icon icon-clippy" ></span> - <span>{{copyLabel}}</span> - </a> + <li class="hidden linkTextMenu"> + <span class="menuitem icon-link-text"> + <input id="linkText-{{cid}}" class="linkText" type="text" readonly="readonly" value="{{shareLinkURL}}" /> + </span> </li> <li> <a href="#" class="new-share"> <span class="icon-loading-small hidden"></span> <span class="icon icon-add"></span> - <span>{{newShareTitle}}</span> + <span>{{newShareLabel}}</span> </a> </li> - <li class="hidden linkTextMenu"> - <span class="menuitem icon-link-text"> - <input id="linkText-{{cid}}" class="linkText" type="text" readonly="readonly" value="{{shareLinkURL}}" /> - </span> - </li> {{#if showHideDownloadCheckbox}} <li> <span class="shareOption menuitem"> diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js index 6e3fce04dfe..fc2292b4f46 100644 --- a/core/js/sharedialoglinkshareview.js +++ b/core/js/sharedialoglinkshareview.js @@ -97,25 +97,34 @@ throw 'missing OC.Share.ShareConfigModel'; } - var clipboard = new Clipboard('.clipboardButton'); + var clipboard = new Clipboard('.clipboard-button'); clipboard.on('success', function(e) { - var $menu = $(e.trigger); + var $trigger = $(e.trigger); - $menu.tooltip('hide') + $trigger.tooltip('hide') .attr('data-original-title', t('core', 'Copied!')) .tooltip('fixTitle') .tooltip({placement: 'bottom', trigger: 'manual'}) .tooltip('show'); _.delay(function() { - $menu.tooltip('hide'); - $menu.tooltip('destroy'); + $trigger.tooltip('hide') + .attr('data-original-title', t('core', 'Copy link')) + .tooltip('fixTitle') }, 3000); }); clipboard.on('error', function (e) { - var $menu = $(e.trigger); - var $linkTextMenu = $menu.parent().next('li.linkTextMenu'); + var $trigger = $(e.trigger); + var $menu = $trigger.next('.share-menu').find('.popovermenu'); + var $linkTextMenu = $menu.find('li.linkTextMenu'); var $input = $linkTextMenu.find('.linkText'); + var $li = $trigger.closest('li[data-share-id]'); + var shareId = $li.data('share-id'); + + // show menu + OC.showMenu(null, $menu); + this._menuOpen = shareId; + var actionMsg = ''; if (/iPhone|iPad/i.test(navigator.userAgent)) { actionMsg = t('core', 'Not supported!'); @@ -393,6 +402,8 @@ }, render: function() { + this.$el.find('.has-tooltip').tooltip(); + var linkShareTemplate = this.template(); var resharingAllowed = this.model.sharePermissionPossible(); @@ -456,7 +467,6 @@ this.$el.find('.datepicker').datepicker({dateFormat : 'dd-mm-yy'}); var popoverBase = { - copyLabel: t('core', 'Copy link'), social: social, urlLabel: t('core', 'Link'), hideDownloadLabel: t('core', 'Hide download'), @@ -508,7 +518,7 @@ shareAllowed: true, nolinkShares: linkShares.length === 0, newShareLabel: t('core', 'Share link'), - newShareTitle: t('core', 'New share link'), + newShareTitle: t('core', 'New share link') })); this.delegateEvents(); @@ -663,7 +673,10 @@ linkShareLabel: share.label !== '' ? share.label : t('core', 'Share link'), popoverMenu: {}, pendingPopoverMenu: {}, - showPending: this.showPending + showPending: this.showPending, + shareLinkURL: share.url, + newShareTitle: t('core', 'New share link'), + copyLabel: t('core', 'Copy link'), }) }, @@ -734,7 +747,6 @@ maxDate: maxDate, showHideDownloadCheckbox: showHideDownloadCheckbox, hideDownload: hideDownload, - newShareTitle: t('core', 'New share link'), } }, diff --git a/core/js/sharetemplates.js b/core/js/sharetemplates.js index dfda54a853e..9a7ff0caf3e 100644 --- a/core/js/sharetemplates.js +++ b/core/js/sharetemplates.js @@ -12,7 +12,7 @@ templates['sharedialoglinkshareview'] = template({"1":function(container,depth0, return " <li>\n <div class=\"avatar icon-public-white\"></div>\n <span class=\"username\">" + alias4(((helper = (helper = helpers.newShareLabel || (depth0 != null ? depth0.newShareLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareLabel","hash":{},"data":data}) : helper))) - + "</span>\n <span class=\"sharingOptionsGroup\">\n <span class=\"icon icon-add new-share\" title=\"" + + "</span>\n <span class=\"sharingOptionsGroup\">\n <span class=\"icon icon-add new-share has-tooltip\" title=\"" + alias4(((helper = (helper = helpers.newShareTitle || (depth0 != null ? depth0.newShareTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareTitle","hash":{},"data":data}) : helper))) + "\"></span>\n <span class=\"icon icon-loading-small hidden\"></span>\n </span>\n </li>\n"; },"4":function(container,depth0,helpers,partials,data) { @@ -24,7 +24,11 @@ templates['sharedialoglinkshareview'] = template({"1":function(container,depth0, + alias4(((helper = (helper = helpers.linkShareLabel || (depth0 != null ? depth0.linkShareLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"linkShareLabel","hash":{},"data":data}) : helper))) + "\">" + alias4(((helper = (helper = helpers.linkShareLabel || (depth0 != null ? depth0.linkShareLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"linkShareLabel","hash":{},"data":data}) : helper))) - + "</span>\n <span class=\"sharingOptionsGroup\">\n <div class=\"share-menu\" tabindex=\"0\"><span class=\"icon icon-more\"></span>\n" + + "</span>\n \n <span class=\"sharingOptionsGroup\">\n <a href=\"#\" class=\"clipboard-button icon icon-clippy has-tooltip\" data-clipboard-text=\"" + + alias4(((helper = (helper = helpers.shareLinkURL || (depth0 != null ? depth0.shareLinkURL : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareLinkURL","hash":{},"data":data}) : helper))) + + "\" title=\"" + + alias4(((helper = (helper = helpers.copyLabel || (depth0 != null ? depth0.copyLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"copyLabel","hash":{},"data":data}) : helper))) + + "\"></a>\n <div class=\"share-menu\" tabindex=\"0\"><span class=\"icon icon-more\"></span>\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showPending : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0),"inverse":container.program(7, data, 0),"data":data})) != null ? stack1 : "") + " </div>\n </span>\n </li>\n"; },"5":function(container,depth0,helpers,partials,data) { @@ -51,7 +55,7 @@ templates['sharedialoglinkshareview'] = template({"1":function(container,depth0, + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" class=\"shareWithField\" type=\"text\" placeholder=\"" + alias4(((helper = (helper = helpers.noSharingPlaceholder || (depth0 != null ? depth0.noSharingPlaceholder : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"noSharingPlaceholder","hash":{},"data":data}) : helper))) - + "\" disabled=\"disabled\"/>"; + + "\" disabled=\"disabled\" />"; },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1; @@ -164,17 +168,13 @@ templates['sharedialoglinkshareview_popover_menu'] = template({"1":function(cont },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data) { var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; - return "<div class=\"popovermenu menu\">\n <ul>\n <li>\n <a href=\"#\" class=\"menuitem clipboardButton\" data-clipboard-text=\"" - + alias4(((helper = (helper = helpers.shareLinkURL || (depth0 != null ? depth0.shareLinkURL : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareLinkURL","hash":{},"data":data}) : helper))) - + "\">\n <span class=\"icon icon-clippy\" ></span>\n <span>" - + alias4(((helper = (helper = helpers.copyLabel || (depth0 != null ? depth0.copyLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"copyLabel","hash":{},"data":data}) : helper))) - + "</span>\n </a>\n </li>\n <li>\n <a href=\"#\" class=\"new-share\">\n <span class=\"icon-loading-small hidden\"></span>\n <span class=\"icon icon-add\"></span>\n <span>" - + alias4(((helper = (helper = helpers.newShareTitle || (depth0 != null ? depth0.newShareTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareTitle","hash":{},"data":data}) : helper))) - + "</span>\n </a>\n </li>\n <li class=\"hidden linkTextMenu\">\n <span class=\"menuitem icon-link-text\">\n <input id=\"linkText-" + return "<div class=\"popovermenu menu\">\n <ul>\n <li class=\"hidden linkTextMenu\">\n <span class=\"menuitem icon-link-text\">\n <input id=\"linkText-" + alias4(((helper = (helper = helpers.cid || (depth0 != null ? depth0.cid : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"cid","hash":{},"data":data}) : helper))) + "\" class=\"linkText\" type=\"text\" readonly=\"readonly\" value=\"" + alias4(((helper = (helper = helpers.shareLinkURL || (depth0 != null ? depth0.shareLinkURL : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareLinkURL","hash":{},"data":data}) : helper))) - + "\" />\n </span>\n </li>\n" + + "\" />\n </span>\n </li>\n <li>\n <a href=\"#\" class=\"new-share\">\n <span class=\"icon-loading-small hidden\"></span>\n <span class=\"icon icon-add\"></span>\n <span>" + + alias4(((helper = (helper = helpers.newShareLabel || (depth0 != null ? depth0.newShareLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"newShareLabel","hash":{},"data":data}) : helper))) + + "</span>\n </a>\n </li>\n" + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.showHideDownloadCheckbox : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.publicUpload : depth0),{"name":"if","hash":{},"fn":container.program(4, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.publicEditing : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") |