From 588a0a6cf4b9b87367663d0c65c3ab4491496c12 Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Thu, 28 Aug 2014 09:09:37 +0200 Subject: [PATCH] toggle sidebar when clicking the same again --- .../app/controllers/ticket_zoom.js.coffee | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index eb3e59ede..4b2687d2b 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -294,13 +294,17 @@ class Sidebar extends App.Controller toggleTab: (e) -> name = $(e.target).closest('.sidebar-tab').data('content') + if name - @el.find('.ticket-zoom .sidebar-tab').removeClass('active') - $(e.target).closest('.sidebar-tab').addClass('active') + if name is @currentTab + @toggleSidebar() + else + @el.find('.ticket-zoom .sidebar-tab').removeClass('active') + $(e.target).closest('.sidebar-tab').addClass('active') - @toggleContent(name) + @toggleContent(name) - @showSidebar() + @showSidebar() toggleContent: (name) -> @@ -309,6 +313,7 @@ class Sidebar extends App.Controller @el.find('.sidebar-content[data-content=' + name + ']').removeClass('hide') title = @el.find('.sidebar-content[data-content=' + name + ']').data('title') @el.find('.sidebar h2').html(title) + @currentTab = name class Edit extends App.Controller