diff --git a/static/css/my_checks.css b/static/css/my_checks.css index f6d1d736..63f39916 100644 --- a/static/css/my_checks.css +++ b/static/css/my_checks.css @@ -62,10 +62,3 @@ color: #555; } -#show-usage-modal .modal-dialog { - width: 1100px; -} - -#show-usage-modal .tab-content { - margin-top: 15px; -} \ No newline at end of file diff --git a/static/css/my_checks_desktop.css b/static/css/my_checks_desktop.css index 79a3ebcc..5d2543c7 100644 --- a/static/css/my_checks_desktop.css +++ b/static/css/my_checks_desktop.css @@ -62,15 +62,34 @@ table.table tr > th.th-name { visibility: hidden; } -.show-usage { - opacity: 0 +button.copy-link { + opacity: 0; + + display: inline-block; + width: 50px; + + background: none!important; + border: none; + padding: 0!important; + text-align: left; + + font-family: "Open Sans", Arial, sans-serif; + color: #0091ea; + cursor :pointer; + transition: opacity 0.1s linear; } +button.copy-link:hover { + text-decoration: underline; +} + + + tr:hover .check-menu { visibility: visible; } -tr:hover .show-usage { +tr:hover .copy-link { opacity: 1 } diff --git a/static/js/checks.js b/static/js/checks.js index 2a511966..5ed5838f 100644 --- a/static/js/checks.js +++ b/static/js/checks.js @@ -176,18 +176,22 @@ $(function () { }); - $(".show-usage").click(function(e) { - var a = e.target; - var url = a.getAttribute("href"); - var email = a.getAttribute("data-email"); - - $(".ex", "#show-usage-modal").text(url); - $(".em", "#show-usage-modal").text(email); - - $(a).tooltip("hide"); - $("#show-usage-modal").modal("show"); + var clipboard = new Clipboard('button.copy-link'); + $("button.copy-link").mouseout(function(e) { + setTimeout(function() { + e.target.textContent = "copy"; + }, 300); + }) + + clipboard.on('success', function(e) { + e.trigger.textContent = "copied!"; + e.clearSelection(); + }); - return false; + clipboard.on('error', function(e) { + var text = e.trigger.getAttribute("data-clipboard-text"); + prompt("Press Ctrl+C to select:", text) }); + }); diff --git a/static/js/clipboard.min.js b/static/js/clipboard.min.js new file mode 100644 index 00000000..580433f1 --- /dev/null +++ b/static/js/clipboard.min.js @@ -0,0 +1,7 @@ +/*! + * clipboard.js v1.5.12 + * https://zenorocha.github.io/clipboard.js + * + * Licensed MIT © Zeno Rocha + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,o){function i(a,c){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!c&&s)return s(a,!0);if(r)return r(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var u=n[a]={exports:{}};e[a][0].call(u.exports,function(t){var n=e[a][1][t];return i(n?n:t)},u,u.exports,t,e,n,o)}return n[a].exports}for(var r="function"==typeof require&&require,a=0;ao;o++)n[o].fn.apply(n[o].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),o=n[t],i=[];if(o&&e)for(var r=0,a=o.length;a>r;r++)o[r].fn!==e&&o[r].fn._!==e&&i.push(o[r]);return i.length?n[t]=i:delete n[t],this}},e.exports=o},{}],8:[function(e,n,o){!function(i,r){if("function"==typeof t&&t.amd)t(["module","select"],r);else if("undefined"!=typeof o)r(n,e("select"));else{var a={exports:{}};r(a,i.select),i.clipboardAction=a.exports}}(this,function(t,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(e),r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n - - - {% endblock %} {% block scripts %} @@ -282,6 +203,7 @@ + {% endcompress %} {% endblock %} diff --git a/templates/front/my_checks_desktop.html b/templates/front/my_checks_desktop.html index f44d2410..7a319f31 100644 --- a/templates/front/my_checks_desktop.html +++ b/templates/front/my_checks_desktop.html @@ -39,12 +39,11 @@ {{ ping_endpoint }}{{ check.code }} - +