[IMP] runbot: bring back copy bundle name button

This commit is contained in:
Christophe Monniez 2020-11-13 10:21:19 +01:00
parent 9c7cee657d
commit 9637976fef
3 changed files with 15 additions and 0 deletions

View File

@ -42,3 +42,11 @@
// new Clipboard('.clipbtn'); // new Clipboard('.clipbtn');
//}); //});
})(jQuery); })(jQuery);
function copyToClipboard(text) {
if (!navigator.clipboard) {
console.error('Clipboard not supported');
return;
}
navigator.clipboard.writeText(text);
}

View File

@ -32,6 +32,7 @@
<div class="col-md-3 col-lg-2 cell"> <div class="col-md-3 col-lg-2 cell">
<div class="one_line"> <div class="one_line">
<i t-if="bundle.sticky" class="fa fa-star" style="color: #f0ad4e" /> <i t-if="bundle.sticky" class="fa fa-star" style="color: #f0ad4e" />
<t t-if="not bundle.sticky" t-call="runbot.branch_copy_button"/>
<a t-attf-href="/runbot/bundle/#{bundle.id}" title="View Bundle"> <a t-attf-href="/runbot/bundle/#{bundle.id}" title="View Bundle">
<b t-esc="bundle.name"/> <b t-esc="bundle.name"/>
</a> </a>

View File

@ -302,5 +302,11 @@
</t> </t>
</div> </div>
</template> </template>
<template id="runbot.branch_copy_button">
<button t-attf-class="btn btn-link btn-ssm" title="Copy Bundle name" aria-label="Copy Bundle name" t-attf-onclick="copyToClipboard('{{ bundle.name.split(':')[-1] }}')">
<i t-attf-class="fa fa-clipboard"/>
</button>
</template>
</data> </data>
</odoo> </odoo>