From: Radek Czajka Date: Tue, 13 Sep 2022 13:59:39 +0000 (+0200) Subject: edit buttons X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/7e9be4e3962e1cccc43798d0507b2c82cd1d275c?ds=inline;hp=a4cf06ec9135a9375fbc9ed2c697bc60ad6052b5 edit buttons --- diff --git a/src/chunks/static/chunks/edit.js b/src/chunks/static/chunks/edit.js new file mode 100644 index 000000000..e5f9ce81e --- /dev/null +++ b/src/chunks/static/chunks/edit.js @@ -0,0 +1,21 @@ +(function() { + + // is we admin? + function showEditLinks() { + $("a.admin-link").remove(); + + $('span[data-edit]').each(function() { + e = $(this).offset(); + a = $('\u270e'); + a.attr('href', '/admin/' + $(this).attr('data-edit') + '/change/'); + a.offset(e); + a.appendTo(document.body) + }); + } + + $('.edit-links-toggle').on('click', function() { + showEditLinks(); + return false; + }) + +})() diff --git a/src/chunks/static/chunks/edit.scss b/src/chunks/static/chunks/edit.scss new file mode 100644 index 000000000..0c18caf9a --- /dev/null +++ b/src/chunks/static/chunks/edit.scss @@ -0,0 +1,19 @@ +.admin-link { + position: absolute; + background: #083F4D; + color: white; + border-radius: 100%; + font-size: 26px; + line-height: 32px; + width: 32px; + text-align: center; + box-shadow: 0 0 10px #083F4D; + + transition: color, background 150ms; + z-index: 9999; + + &:hover { + color: black; + background: #FBC40F; + } +}