diff --git a/app/assets/javascripts/app/controllers/layout_ref.coffee b/app/assets/javascripts/app/controllers/layout_ref.coffee index 72e4d6724..ef913af53 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.coffee @@ -795,7 +795,7 @@ class TicketZoomRef extends App.ControllerContent '.article-text': 'articles' '.js-highlight-icon': 'highlightIcon' - '.buttonDropdown': 'buttonDropdown' + '.js-submitDropdown': 'buttonDropdown' events: 'click .js-highlight': 'toggleHighlight' @@ -806,6 +806,7 @@ class TicketZoomRef extends App.ControllerContent 'mouseup .js-dropdownAction': 'performTicketMacro' 'mouseenter .js-dropdownAction': 'onActionMouseEnter' 'mouseleave .js-dropdownAction': 'onActionMouseLeave' + 'click .js-secondaryAction': 'chooseSecondaryAction' stopPropagation: (event) -> event.stopPropagation() @@ -988,6 +989,12 @@ class TicketZoomRef extends App.ControllerContent onActionMouseLeave: (event) => @$(event.currentTarget).removeClass('is-active') + chooseSecondaryAction: (event) => + target = $(event.currentTarget) + target.siblings().find('.is-selected').removeClass('is-selected') + @$('.js-secondaryActionButtonLabel').text target.find('.js-secondaryActionLabel').text() + target.find('.js-selectedIcon').addClass('is-selected') + App.Config.set( 'layout_ref/ticket_zoom', TicketZoomRef, 'Routes' ) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/higlighter.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/higlighter.coffee index 5800eddb5..3edacb434 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/higlighter.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/higlighter.coffee @@ -165,8 +165,8 @@ class App.TicketZoomHighlighter extends App.Controller #@articles.attr('data-highlightcolor', @colors[@activeColorIndex].name) pickColor: (e) => - @$('.js-highlightColor .visibility-change.is-active').removeClass('is-active') - $(e.currentTarget).find('.visibility-change').addClass('is-active') + @$('.js-highlightColor .is-selected').removeClass('is-selected') + $(e.currentTarget).find('.js-selectedIcon').addClass('is-selected') @activeColorIndex = $(e.currentTarget).attr('data-key') @setColor() diff --git a/app/assets/javascripts/app/controllers/widget/avatar.coffee b/app/assets/javascripts/app/controllers/widget/avatar.coffee index 331ba8bc7..73991604f 100644 --- a/app/assets/javascripts/app/controllers/widget/avatar.coffee +++ b/app/assets/javascripts/app/controllers/widget/avatar.coffee @@ -9,12 +9,7 @@ class App.WidgetAvatar extends App.Controller App.User.unsubscribe(@subscribeId) render: (user) => - @html App.view('avatar')( - user: user - size: @size - position: @position - type: @type - ) + @html user.avatar @size, @position, undefined, false, false, @type # start user popups @userPopups(@position) diff --git a/app/assets/javascripts/app/models/user.coffee b/app/assets/javascripts/app/models/user.coffee index 61d90a8e1..6edb71b68 100644 --- a/app/assets/javascripts/app/models/user.coffee +++ b/app/assets/javascripts/app/models/user.coffee @@ -46,55 +46,57 @@ class App.User extends App.Model return '??' avatar: (size = 40, placement = '', cssClass = '', unique = false, avatar, type = undefined) -> - cssClass += " size-#{size}" + size = parseInt(size, 10) + + cssClass += " " if cssClass + cssClass += "size-#{ size }" if placement - placement = "data-placement=\"#{placement}\"" + placement = " data-placement='#{ placement }'" - # use system avatar for system actions - if @id is 1 - return "#{App.Utils.icon('logo')}" + if !avatar + if type is 'personal' + vip = false + data = " data-id=\"#{@id}\"" + else + cssClass += ' user-popover' + data = " data-id=\"#{@id}\"" + else + vip = false + data = " data-avatar-id=\"#{avatar.id}\"" - # use generated avatar - if !@image || @image is 'none' || unique - return @uniqueAvatar(size, placement, cssClass, avatar, type) - - # use image as avatar - image = @imageUrl() vip = @vip if type is 'personal' vip = false else cssClass += ' user-popover' - if vip - return "" - "" + # use system avatar for system actions + if @id is 1 + return App.view('avatar_system')() + else if !@image || @image is 'none' || unique + width = 300 + height = 226 - uniqueAvatar: (size, placement = '', cssClass = '', avatar, type) -> - width = 300 - height = 226 - size = parseInt(size, 10) - vip = @vip + rng = new Math.seedrandom(@id) + x = rng() * (width - size) + y = rng() * (height - size) - rng = new Math.seedrandom(@id) - x = rng() * (width - size) - y = rng() * (height - size) - - if !avatar - if type is 'personal' - vip = false - data = "data-id=\"#{@id}\"" - else - cssClass += ' user-popover' - data = "data-id=\"#{@id}\"" + return App.view('avatar_unique') + data: data + cssClass: cssClass + placement: placement + vip: vip + x: x + y: y + initials: @initials() else - vip = false - data = "data-avatar-id=\"#{avatar.id}\"" - - if vip - return "#{ @initials() }" - "#{ @initials() }" + return App.view('avatar') + data: data + cssClass: cssClass + placement: placement + vip: vip + url: @imageUrl() imageUrl: -> return if !@image diff --git a/app/assets/javascripts/app/views/avatar.jst.eco b/app/assets/javascripts/app/views/avatar.jst.eco index 3beb48952..423634fb4 100644 --- a/app/assets/javascripts/app/views/avatar.jst.eco +++ b/app/assets/javascripts/app/views/avatar.jst.eco @@ -1 +1,3 @@ -<%- @user.avatar(@size, @position, @class, false, false, @type) %> \ No newline at end of file +<%- @data %>> + <%- @Icon('crown') if @vip %> + \ No newline at end of file diff --git a/app/assets/javascripts/app/views/avatar_system.jst.eco b/app/assets/javascripts/app/views/avatar_system.jst.eco new file mode 100644 index 000000000..726316e5b --- /dev/null +++ b/app/assets/javascripts/app/views/avatar_system.jst.eco @@ -0,0 +1,3 @@ + + <%- @Icon('logo') %> + \ No newline at end of file diff --git a/app/assets/javascripts/app/views/avatar_unique.jst.eco b/app/assets/javascripts/app/views/avatar_unique.jst.eco new file mode 100644 index 000000000..c384ef7f9 --- /dev/null +++ b/app/assets/javascripts/app/views/avatar_unique.jst.eco @@ -0,0 +1,4 @@ +<%- @data %>> + <%- @Icon('crown') if @vip %> + <%= @initials %> + \ No newline at end of file diff --git a/app/assets/javascripts/app/views/layout_ref/merge_customer_view.jst.eco b/app/assets/javascripts/app/views/layout_ref/merge_customer_view.jst.eco index a9c3c080d..d17ff9628 100644 --- a/app/assets/javascripts/app/views/layout_ref/merge_customer_view.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/merge_customer_view.jst.eco @@ -13,28 +13,6 @@