diff --git a/scheduler/main/static/style.css b/scheduler/main/static/style.css index e54e306bc50a146e39bad6797452894306f01844..8dbf9a9680c337b07426f9a682e213513036c2d7 100644 --- a/scheduler/main/static/style.css +++ b/scheduler/main/static/style.css @@ -21,3 +21,31 @@ margin: 0 auto; } } + +[data-animation="success"] { + position: relative; +} + +[data-animation="success"]::after { + content: "\f00c"; /* fa-check */ + font-family: FontAwesome; + display: block; + position: absolute; + right: 0; + top: 0; + width: 1.2em; + line-height: 1.2em; + box-sizing: content-box; + margin-right: -0.6em; + margin-top: -0.6em; + border-radius: 50%; + text-align: center; + color: var(--white); + background-color: var(--success); + opacity: 0; + transition: opacity 300ms ease; +} + +[data-animation="success"].animation-active::after { + opacity: 1; +} diff --git a/scheduler/main/static/utils.js b/scheduler/main/static/utils.js new file mode 100644 index 0000000000000000000000000000000000000000..27f500c91c643563e4b1206a602d1e8e119c49b4 --- /dev/null +++ b/scheduler/main/static/utils.js @@ -0,0 +1,30 @@ +(function() { + window.$$ = { + on: function(el, eventName, selector, fn) { + el.addEventListener(eventName, function(event) { + var target = event.target.closest(selector); + if (target) { + fn.call(target, event); + } + }); + }, + }; + + $$.on(document, 'click', '[data-clipboard]', function() { + var targetSelector = this.dataset.clipboard; + var target = document.querySelector(targetSelector); + if (navigator.clipboard) { + navigator.clipboard.writeText(target.value || target.href); + } else { + target.focus(); + target.setSelectionRange(0, 1000); + document.execCommand('copy'); + } + }); + $$.on(document, 'click', '[data-animation="success"]', function() { + this.classList.add('animation-active'); + setTimeout(() => { + this.classList.remove('animation-active'); + }, 800); + }); +})(); diff --git a/scheduler/main/templates/base.html b/scheduler/main/templates/base.html index d5b56449f0b8ae6b10c5b1b79e1c5ffb3dab0e6c..64d5323a2a04ac672b38cb589749a20327b8082d 100644 --- a/scheduler/main/templates/base.html +++ b/scheduler/main/templates/base.html @@ -43,6 +43,7 @@ + {% block extra_scripts %}{% endblock %} diff --git a/scheduler/main/templates/main/schedule_form.html b/scheduler/main/templates/main/schedule_form.html index c69020d69db3313f03a0811b4c10d5ee34807f6d..789536f0489ea52b348fbcc9d340d6bee4733f5b 100644 --- a/scheduler/main/templates/main/schedule_form.html +++ b/scheduler/main/templates/main/schedule_form.html @@ -65,6 +65,18 @@ + {% if object %} +
+ +
+ +
+ +
+
+
+ {% endif %} +
{% if object %}