From 5c88907e563de82637a6075b1dc07af2f20c84d1 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Mon, 17 Nov 2014 11:13:44 +0100 Subject: [PATCH] ticket zoom: make title into dropdown-toggle --- .../_application_controller_generic.js.coffee | 19 ++++++++---- .../app/views/generic/sidebar_tabs.jst.eco | 2 +- app/assets/stylesheets/zammad.css.scss | 30 ++++++++++++------- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee index 2245d5604..2a05ee2d8 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -477,16 +477,21 @@ class App.ActionRow extends App.Controller ) class App.Sidebar extends App.Controller + elements: + '.tabsSidebar-tab': 'tabs' + '.sidebar': 'sidebars' + events: 'click .tabsSidebar-tab': 'toggleTab' 'click .tabsSidebar-close': 'toggleSidebar' + 'click .sidebar-header h2': 'toggleDropdown' constructor: -> super @render() # get first tab - name = @el.find('.tabsSidebar-tab').first().data('tab') + name = @tabs.first().data('tab') # activate first tab @toggleTabAction(name) @@ -508,7 +513,11 @@ class App.Sidebar extends App.Controller type: 'small' ) - toggleSidebar: -> + toggleDropdown: (e) => + e.stopPropagation() + $(e.currentTarget).next('.js-actions').find('.dropdown-toggle').dropdown('toggle') + + toggleSidebar: => @el.parent().find('.tabsSidebar-sidebarSpacer').toggleClass('is-closed') @el.parent().find('.tabsSidebar').toggleClass('is-closed') @el.parent().next('.attributeBar').toggleClass('is-closed') @@ -518,7 +527,7 @@ class App.Sidebar extends App.Controller @el.parent().find('.tabsSidebar').removeClass('is-closed') @el.parent().next('.attributeBar').addClass('is-closed') - toggleTab: (e) -> + toggleTab: (e) => # get selected tab name = $(e.target).closest('.tabsSidebar-tab').data('tab') @@ -537,13 +546,13 @@ class App.Sidebar extends App.Controller return if !name # remove active state - @el.find('.tabsSidebar-tab').removeClass('active') + @tabs.removeClass('active') # add active state @el.find('.tabsSidebar-tab[data-tab=' + name + ']').addClass('active') # hide all content tabs - @el.find('.sidebar').addClass('hide') + @sidebars.addClass('hide') # show active tab content tabContent = @el.find('.sidebar[data-tab=' + name + ']') diff --git a/app/assets/javascripts/app/views/generic/sidebar_tabs.jst.eco b/app/assets/javascripts/app/views/generic/sidebar_tabs.jst.eco index 8f7777e48..ba1be18e0 100644 --- a/app/assets/javascripts/app/views/generic/sidebar_tabs.jst.eco +++ b/app/assets/javascripts/app/views/generic/sidebar_tabs.jst.eco @@ -2,7 +2,7 @@