diff --git a/app/assets/javascripts/app/controllers/ticket_overview.coffee b/app/assets/javascripts/app/controllers/ticket_overview.coffee index 9546cdb88..c928a205e 100644 --- a/app/assets/javascripts/app/controllers/ticket_overview.coffee +++ b/app/assets/javascripts/app/controllers/ticket_overview.coffee @@ -78,6 +78,7 @@ class App.TicketOverview extends App.Controller class Navbar extends App.Controller elements: + '.js-tabsHolder': 'tabsHolder' '.js-tabsClone': 'clone' '.js-tabClone': 'tabClone' '.js-tabs': 'tabs' @@ -122,19 +123,25 @@ class Navbar extends App.Controller if @bindId App.OverviewIndexCollection.unbind(@bindId) + trimName: (name) -> + start = if name.indexOf('All') > -1 then 4 else 0; + shortname = name.substr start, name.indexOf('Tickets') - 1 - start + return shortname.charAt(0).toUpperCase() + shortname.slice(1); + autoFoldTabs: => items = App.OverviewIndexCollection.get() @html App.view("agent_ticket_view/navbar#{ if @vertical then '_vertical' }") items: items + trimName: @trimName - while @clone.width() > @el.width() + while @clone.width() > @tabsHolder.width() @tabClone.not('.hide').last().addClass('hide') @tab.not('.hide').last().addClass('hide') @dropdownItem.filter('.hide').last().removeClass('hide') # if all tabs are visible # remove dropdown and dropdown button - if @dropdownItem.filter('.hide').size() is 0 + if @dropdownItem.not('.hide').size() is 0 @dropdown.remove() @dropdownToggle.remove() @@ -172,6 +179,7 @@ class Navbar extends App.Controller @html App.view("agent_ticket_view/navbar#{ if @vertical then '_vertical' else '' }") items: data + trimName: @trimName if @vertical @autoFoldTabs() diff --git a/app/assets/javascripts/app/views/agent_ticket_view/navbar.jst.eco b/app/assets/javascripts/app/views/agent_ticket_view/navbar.jst.eco index b49617456..1f3ee8ab1 100644 --- a/app/assets/javascripts/app/views/agent_ticket_view/navbar.jst.eco +++ b/app/assets/javascripts/app/views/agent_ticket_view/navbar.jst.eco @@ -3,7 +3,7 @@ <% for item in @items: %>