diff --git a/app/assets/javascripts/app/controllers/layout_ref.coffee b/app/assets/javascripts/app/controllers/layout_ref.coffee index 484a223ca..85c367069 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.coffee @@ -1619,6 +1619,14 @@ App.Config.set( 'layout_ref/calendar_subscriptions', CalendarSubscriptionsRef, ' class ButtonsRef extends App.ControllerContent + elements: + '.js-submitDropdown': 'buttonDropdown' + + events: + 'click .js-openDropdown': 'toggleMenu' + 'mouseenter .js-dropdownAction': 'onActionMouseEnter' + 'mouseleave .js-dropdownAction': 'onActionMouseLeave' + constructor: -> super @render() @@ -1626,6 +1634,24 @@ class ButtonsRef extends App.ControllerContent render: -> @html App.view('layout_ref/buttons') + toggleMenu: => + if @buttonDropdown.hasClass('is-open') + @closeMenu() + return + @openMenu() + + closeMenu: => + @buttonDropdown.removeClass 'is-open' + + openMenu: => + @buttonDropdown.addClass 'is-open' + + onActionMouseEnter: (e) => + @$(e.currentTarget).addClass('is-active') + + onActionMouseLeave: (e) => + @$(e.currentTarget).removeClass('is-active') + App.Config.set( 'layout_ref/buttons', ButtonsRef, 'Routes' ) class MergeCustomerRef extends App.ControllerContent diff --git a/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco b/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco index fb71fbb69..5561ebab8 100644 --- a/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/buttons.jst.eco @@ -55,4 +55,33 @@