From a504d4535c9db97c59c38002fe48219768f831aa Mon Sep 17 00:00:00 2001 From: Felix Niklas Date: Mon, 15 Sep 2014 18:08:23 +0200 Subject: [PATCH] create component tabsSidebar using tabsSidebarSpace as spacer for the body --- .../_application_controller_generic.js.coffee | 24 +- .../controllers/agent_ticket_create.js.coffee | 2 +- .../app/controllers/layout_ref.js.coffee | 22 ++ .../app/controllers/ticket_zoom.js.coffee | 2 +- .../app/views/agent_ticket_create.jst.eco | 318 +++++++++--------- .../app/views/generic/sidebar_tabs.jst.eco | 8 +- .../content_sidebar_tabs_right.jst.eco | 14 +- .../javascripts/app/views/ticket_zoom.jst.eco | 9 +- app/assets/stylesheets/application.css | 4 +- app/assets/stylesheets/layout.css | 4 +- app/assets/stylesheets/zzz.css.erb | 72 ++-- 11 files changed, 240 insertions(+), 239 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 6b7aca1a2..a7b4b4dbd 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_generic.js.coffee @@ -417,15 +417,15 @@ class App.GenericHistory extends App.ControllerModal class App.Sidebar extends App.Controller events: - 'click .sidebar-tabs': 'toggleTab' - 'click .close-sidebar': 'toggleSidebar' + 'click .tabsSidebar-tab': 'toggleTab' + 'click .tabsSidebar-close': 'toggleSidebar' constructor: -> super @render() # get first tab - name = @el.find('.sidebar-tab').first().data('content') + name = @el.find('.tabsSidebar-tab').first().data('content') # activate first tab @toggleTabAction(name) @@ -439,17 +439,17 @@ class App.Sidebar extends App.Controller item.callback( @el.find( '.sidebar-content[data-content=' + item.name + ']' ) ) toggleSidebar: -> - $('.content.active > div').toggleClass('state--sidebar-hidden') + $('.content.active .tabsSidebarSpace').toggleClass('is-closed') + $('.content.active .tabsSidebar').toggleClass('is-closed') showSidebar: -> - # show sidebar if not shown - if $('.content.active > div').hasClass('state--sidebar-hidden') - $('.content.active > div').removeClass('state--sidebar-hidden') + $('.content.active .tabsSidebarSpace').removeClass('is-closed') + $('.content.active .tabsSidebar').removeClass('is-closed') toggleTab: (e) -> # get selected tab - name = $(e.target).closest('.sidebar-tab').data('content') + name = $(e.target).closest('.tabsSidebar-tab').data('content') if name @@ -466,10 +466,10 @@ class App.Sidebar extends App.Controller return if !name # remove active state - @el.find('.sidebar-tab').removeClass('active') + @el.find('.tabsSidebar-tab').removeClass('active') # add active state - @el.find('.sidebar-tab[data-content=' + name + ']').addClass('active') + @el.find('.tabsSidebar-tab[data-content=' + name + ']').addClass('active') # hide all content tabs @el.find('.sidebar-content').addClass('hide') @@ -483,7 +483,7 @@ class App.Sidebar extends App.Controller @el.find('.sidebar h2').html(title) # set tab actions - @el.find('.sidebar-tab-actions').html('') + @el.find('.tabsSidebar-tabActions').html('') # add item acctions for item in @items @@ -491,7 +491,7 @@ class App.Sidebar extends App.Controller if item.actions for action in item.actions do (action) => - @el.find('.sidebar-tab-actions').append("").find(".sidebar-tab-action").last().bind( + @el.find('.tabsSidebar-tabActions').append("
").find(".tabsSidebar-tabAction").last().bind( 'click' (e) => e.stopPropagation() diff --git a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee index cea22c336..102a1b283 100644 --- a/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee +++ b/app/assets/javascripts/app/controllers/agent_ticket_create.js.coffee @@ -469,7 +469,7 @@ class Sidebar extends App.Controller } new App.Sidebar( - el: @el.find('.sidebar-holder') + el: @el.find('.tabsSidebar') items: items ) diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index 983bd4dc2..a614574f5 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -43,10 +43,32 @@ App.Config.set( 'layout_ref/content_sidebar_right_sidebar_optional', ContentSide class ContentSidebarTabsRight extends App.ControllerContent + elements: + '.tabsSidebar' : 'sidebar' + constructor: -> super @render() + items = [ + head: 'Ticket Settings' + name: 'ticket' + icon: 'message' + , + head: 'Customer' + name: 'customer' + icon: 'person' + , + head: 'Organization' + name: 'organization' + icon: 'group' + ] + + new App.Sidebar( + el: sidebar + items: items + ) + render: -> @html App.view('layout_ref/content_sidebar_tabs_right')() diff --git a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee index 2ec41b0cb..3c8328b64 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom.js.coffee @@ -235,7 +235,7 @@ class App.TicketZoom extends App.Controller } new App.Sidebar( - el: @el.find('.sidebar-holder') + el: @el.find('.tabsSidebar') items: items ) diff --git a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco index fbc75db25..b0fd72455 100644 --- a/app/assets/javascripts/app/views/agent_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_create.jst.eco @@ -1,174 +1,168 @@ -
-
-
-