clipboard: added dummy placeholders for copying commits/paths via clipboard.js

This commit is contained in:
Marcin Kuzminski 2017-07-19 11:38:34 +02:00
parent 87b9dede56
commit a98d55f137
6 changed files with 21 additions and 1 deletions

View file

@ -60,6 +60,7 @@
.icon-hg:before { content: '\e82d'; } /* '' */
.icon-svn:before { content: '\e82e'; } /* '' */
.icon-plus:before { content: '\e813'; } /* '' */
.icon-clipboard:before { content: '\e813'; } /* '' */
.icon-minus:before { content: '\e814'; } /* '' */
.icon-remove:before { content: '\e815'; } /* '' */
.icon-bookmark:before { content: '\e803'; } /* '' */

View file

@ -210,6 +210,20 @@ var timeagoActivate = function() {
$("time.timeago").timeago();
};
var clipboardActivate = function() {
/*
*
* <i class="tooltip icon-plus clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i>
* */
var clipboard = new Clipboard('.clipboard-action');
clipboard.on('success', function(e) {
e.clearSelection();
});
};
// Formatting values in a Select2 dropdown of commit references
var formatSelect2SelectionRefs = function(commit_ref){
var tmpl = '';

View file

@ -133,6 +133,7 @@ c.template_context['default_user'] = {
$(document).ready(function(){
show_more_event();
timeagoActivate();
clipboardActivate();
})
</script>

View file

@ -45,6 +45,8 @@
</td>
<td class="td-hash">
<code>
<i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i>
<a href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">
<span class="${'commit_hash obsolete' if getattr(commit, 'obsolete', None) else 'commit_hash'}">${h.show_id(commit)}</span>
</a>

View file

@ -35,6 +35,7 @@
<span class="breadcrumbs files_location">
<h4>${_('Commit')}
<code>
<i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i>
${h.show_id(c.commit)}
% if hasattr(c.commit, 'phase'):
<span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>

View file

@ -10,7 +10,8 @@
<span> | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
<span> | ${h.format_byte_size_binary(c.file.size)}</span>
<span> | ${c.file.mimetype} </span>
<span class="item last"> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
<span> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
<span class="item last"> | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.file.path}" title="${_('Copy the full path')}"></i></span>
</div>
<div class="buttons">
<a id="file_history_overview" href="#">