From f3db99d62cc623238fcb019e5f09f84b78dee969 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Tue, 2 Jun 2015 18:21:14 +0200 Subject: [PATCH] update highlight layoutref --- .../app/controllers/layout_ref.js.coffee | 15 +++++++---- .../app/views/layout_ref/highlight.jst.eco | 10 ++++---- app/assets/stylesheets/zammad.css.scss | 25 +++++++------------ 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index a68382da5..b4830ea9f 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -793,6 +793,7 @@ App.Config.set( 'layout_ref/error', errorRef, 'Routes' ) class highlightRef extends App.ControllerContent elements: '.article-text': 'articles' + '.js-highlight-icon': 'highlightIcon' events: 'click .js-highlight': 'toggleHighlight' @@ -871,7 +872,7 @@ class highlightRef extends App.ControllerContent toggleHighlight: (e) => if @isActive - $(e.currentTarget).removeClass('active') + @highlightIcon.css('fill', '') @isActive = false @articles.off('mouseup', @onMouseUp) @articles.removeAttr('data-highlightcolor') @@ -883,8 +884,8 @@ class highlightRef extends App.ControllerContent if !selection.isCollapsed @toggleHighlightAtSelection $(selection.anchorNode).closest @articles.selector else - # toggle ui - $(e.currentTarget).addClass('active') + # show color + @highlightIcon.css('fill', @colors[@activeColorIndex].color) # activate selection background @articles.attr('data-highlightcolor', @colors[@activeColorIndex].name) @@ -893,9 +894,13 @@ class highlightRef extends App.ControllerContent @articles.on('mouseup', @onMouseUp) #future: touchend pickColor: (e) => - @$('.js-highlightColor .visibility-change.active').removeClass('active') - $(e.currentTarget).find('.visibility-change').addClass('active') + @$('.js-highlightColor .visibility-change.is-active').removeClass('is-active') + $(e.currentTarget).find('.visibility-change').addClass('is-active') @activeColorIndex = $(e.currentTarget).attr('data-key') + + if @isActive + @highlightIcon.css('fill', @colors[@activeColorIndex].color) + @setColor() onMouseUp: (e) => diff --git a/app/assets/javascripts/app/views/layout_ref/highlight.jst.eco b/app/assets/javascripts/app/views/layout_ref/highlight.jst.eco index 98cf2c9ce..11a40c86b 100644 --- a/app/assets/javascripts/app/views/layout_ref/highlight.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/highlight.jst.eco @@ -2,11 +2,11 @@
-
- +
+