[FIX] website_links: do not require flash to copy text to clipboard

The "copy link" to clipboard button ancestrally used a flash (.swf) dependency
(ZeroClipboard) to work.
Since Odoo honours its history, it was still there.
However on Firefox you are asked to activate flash to make it work,
and on Chrome nothing happens.
We get rid of this shibboleth, using instead clipboard.js that is already used
elswhere for the same purpose.

closes #27958
opw 1896509
This commit is contained in:
len-odoo
2018-10-29 13:56:41 +01:00
committed by len-odoo
parent 1916fdc1d0
commit b4e310e7f6
2 changed files with 3 additions and 6 deletions
@@ -10,7 +10,6 @@ var Model = require('web.Model');
var qweb = core.qweb;
var _t = core._t;
var ZeroClipboard = window.ZeroClipboard;
var exports = {};
@@ -99,7 +98,8 @@ if(!$('.o_website_links_create_tracked_url').length) {
this.animating_copy = false;
},
start: function() {
new ZeroClipboard(this.$('.btn_shorten_url_clipboard'));
// DO NOT FORWARD PORT ABOVE V11
new Clipboard(this.$('.btn_shorten_url_clipboard')[0]);
},
toggle_copy_button: function() {
var self = this;
@@ -249,8 +249,6 @@ if(!$('.o_website_links_create_tracked_url').length) {
base.ready().done(function() {
ZeroClipboard.config({swfPath: location.origin + "/website_links/static/lib/zeroclipboard/ZeroClipboard.swf" });
// UTMS selects widgets
var campaign_select = new SelectBox('utm.campaign');
campaign_select.start($("#campaign-select"), _t('e.g. Promotion of June, Winter Newsletter, ..'));
@@ -282,7 +280,7 @@ if(!$('.o_website_links_create_tracked_url').length) {
});
// Clipboard Library
var client = new ZeroClipboard($("#btn_shorten_url"));
new Clipboard($("#btn_shorten_url")[0]);
$("#generated_tracked_link a").click(function() {
$("#generated_tracked_link a").text("Copied").removeClass("btn-primary").addClass("btn-success");
@@ -3,7 +3,6 @@
<template id="assets_website_links" inherit_id="website.assets_frontend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_links/static/lib/zeroclipboard/ZeroClipboard.js"/>
<script type="text/javascript" src="/website_links/static/src/js/website_links.js"/>
<script type="text/javascript" src="/website_links/static/src/js/website_links_code_editor.js"/>
<script type="text/javascript" src="/website_links/static/src/js/website_links_charts.js"/>