Skip to content

Commit

Permalink
- add some padding to the button
Browse files Browse the repository at this point in the history
- use hidden instead of hidden-visually
- add tooltip
- use notifications on copy of the dav url- tooltip is used for the description of the button
  • Loading branch information
DeepDiver1975 committed Sep 20, 2016
1 parent c51c8a6 commit 2948482
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
5 changes: 5 additions & 0 deletions apps/files/css/detailsView.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
display: inline-block;
}

#app-sidebar .mainFileInfoView .hidden {
display: none;
}

#app-sidebar .mainFileInfoView .icon-external {
opacity: .5;
padding-left: 8px;
}

#app-sidebar .mainFileInfoView .permalink {
Expand Down
10 changes: 7 additions & 3 deletions apps/files/js/mainfileinfodetailview.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
'<span class="icon icon-public"></span>' +
'<span class="hidden-visually">{{permalinkTitle}}</span>' +
'</a>' +
'<a class="{{#unless showWebDavCopyButton}}hidden-visually{{/unless}} clipboardButton icon icon-external" data-clipboard-text="{{webDavUrl}}"></a>' +
'<a class="{{#unless showWebDavCopyButton}}hidden{{/unless}} webDavUrlCopyButton icon icon-external" title="{{webDavUrlTitle}}" data-clipboard-text="{{webDavUrl}}"></a>' +
'</div>' +
' <div class="file-details ellipsis">' +
' <a href="#" ' +
Expand Down Expand Up @@ -83,7 +83,10 @@
throw 'Missing required parameter "fileActions"';
}

OC.Util.setupClipboard('.clipboardButton');
OC.Util.setupClipboard('.webDavUrlCopyButton', {
notificationMode: 'notification',
successMessage: t('files', 'WebDAV link copied!')
});
},

_onClickPermalink: function() {
Expand Down Expand Up @@ -166,7 +169,8 @@
permalink: this._makePermalink(this.model.get('id')),
permalinkTitle: t('files', 'Local link'),
showWebDavCopyButton: this.model.isDirectory(),
webDavUrl: this._makeWebDavUrl(this.model.getFullPath())
webDavUrl: this._makeWebDavUrl(this.model.getFullPath()),
webDavUrlTitle: t('files', 'Direct WebDAV link')
}));

// TODO: we really need OC.Previews
Expand Down
43 changes: 27 additions & 16 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -1935,15 +1935,22 @@ OC.Util = {
return false;
},

setupClipboard: function(element) {
setupClipboard: function(element, options) {
options = options || {};
options.notificationMode = options.notificationMode || 'tooltip';
options.successMessage = options.successMessage || t('core', 'Copied!');
var clipboard = new Clipboard(element);
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);
if (options.notificationMode === 'tooltip') {
$input = $(e.trigger);
$input.tooltip({placement: 'bottom', trigger: 'manual', title: options.successMessage});
$input.tooltip('show');
_.delay(function() {
$input.tooltip('hide');
}, 3000);
} else {
OC.Notification.showTemporary(options.successMessage);
}
});
clipboard.on('error', function (e) {
$input = $(e.trigger);
Expand All @@ -1956,15 +1963,19 @@ OC.Util = {
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);
if (options.notificationMode === 'tooltip') {
$input.tooltip({
placement: 'bottom',
trigger: 'manual',
title: actionMsg
});
$input.tooltip('show');
_.delay(function () {
$input.tooltip('hide');
}, 3000);
} else {
OC.Notification.showTemporary(options.successMessage);
}
});
}
};
Expand Down

0 comments on commit 2948482

Please sign in to comment.