From 798ad42d5200e67b503e5971445f979d0ef40806 Mon Sep 17 00:00:00 2001 From: Vova Yatsyuk Date: Wed, 8 Feb 2017 13:46:24 +0200 Subject: [PATCH] Improved action javscript logic, andd rotation effect --- js/tm/adminhtml/core/actions.css | 8 +++++++- js/tm/adminhtml/core/actions.js | 8 ++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/js/tm/adminhtml/core/actions.css b/js/tm/adminhtml/core/actions.css index c5d7384..f209080 100644 --- a/js/tm/adminhtml/core/actions.css +++ b/js/tm/adminhtml/core/actions.css @@ -26,7 +26,11 @@ border-top-color: #ea7601; border-bottom: none; } +.active .tm-action-select::after { + transform: rotate(180deg); +} .tm-action-menu { + display: none; z-index: 10; position: absolute; top: 18px; @@ -35,10 +39,12 @@ border: 1px solid #aaa; box-shadow: 0 0 5px rgba(0,0,0,0.2); } +.active .tm-action-menu { + display: block; +} .tm-action-menu li { margin: 5px 0; } .tm-action-menu a { display: block; - text-decoration: none; } diff --git a/js/tm/adminhtml/core/actions.js b/js/tm/adminhtml/core/actions.js index c2419c3..79b09e0 100644 --- a/js/tm/adminhtml/core/actions.js +++ b/js/tm/adminhtml/core/actions.js @@ -4,13 +4,13 @@ TmcoreActions.prototype = { document.on('click', '.tm-action-select', function(e, el) { e.stop(); - var menu = el.next(), - isVisible = menu.visible(); + var wrapper = el.up(), + isVisible = wrapper.hasClassName('active'); - $$('.tm-action-menu').invoke('hide'); + $$('.tm-action-select-wrap').invoke('removeClassName', 'active'); if (!isVisible) { - el.next().show(); + wrapper.addClassName('active'); } }); }