Copy link outside menu

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-10-31 10:28:18 +01:00 committed by Daniel Calviño Sánchez
parent 1bd6d39b39
commit 106ed07d6a
5 changed files with 43 additions and 42 deletions

View File

@ -51,7 +51,6 @@
top: 0px;
}
.shareWithConfirm,
.clipboardButton,
.linkPass .icon-loading-small {
position: absolute;
right: 2px;
@ -74,12 +73,6 @@
.datepicker {
margin-left: 35px;
}
.clipboardButton {
position: relative;
top: initial;
right: initial;
padding: 0;
}
.share-add {
input.share-note-delete {
display: none;

View File

@ -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}}

View File

@ -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">

View File

@ -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'),
}
},

View File

@ -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 : "")