refactor main-navigation to menu

This commit is contained in:
Felix Niklas 2015-10-07 13:33:57 +02:00
parent 9c66abb195
commit 9873b1ed94
5 changed files with 27 additions and 30 deletions

View file

@ -30,7 +30,7 @@ class App.FirstStepsClues extends App.Controller
] ]
} }
{ {
container: '.main-navigation .overviews' container: '.js-overviewsMenuItem'
headline: 'Overviews' headline: 'Overviews'
text: 'Here you find your ticket overviews for open, my assigned or escalated tickets.' text: 'Here you find your ticket overviews for open, my assigned or escalated tickets.'
#headline: 'Übersichten' #headline: 'Übersichten'
@ -40,7 +40,7 @@ class App.FirstStepsClues extends App.Controller
] ]
} }
{ {
container: '.main-navigation .dashboard' container: '.js-dashboardMenuItem'
headline: 'Dashboard' headline: 'Dashboard'
text: 'Here you see a quick overview about your and other agents performance.' text: 'Here you see a quick overview about your and other agents performance.'
#headline: 'Dashboard' #headline: 'Dashboard'

View file

@ -1020,7 +1020,7 @@ class CluesRef extends App.ControllerContent
] ]
} }
{ {
container: '.main-navigation .overviews' container: '.js-overviewsMenuItem'
headline: 'Übersichten' headline: 'Übersichten'
text: 'Hier findest du eine Liste aller Tickets.' text: 'Hier findest du eine Liste aller Tickets.'
actions: [ actions: [
@ -1028,7 +1028,7 @@ class CluesRef extends App.ControllerContent
] ]
} }
{ {
container: '.main-navigation .dashboard' container: '.js-dashboardMenuItem'
headline: 'Dashboard' headline: 'Dashboard'
text: 'Hier siehst du auf einem Blick ob sich alle Agenten an die Spielregeln halten.' text: 'Hier siehst du auf einem Blick ob sich alle Agenten an die Spielregeln halten.'
actions: [ actions: [

View file

@ -52,11 +52,11 @@ class App.Navigation extends App.ControllerWidgetPermanent
# get active tabs to reactivate on rerender # get active tabs to reactivate on rerender
active_tab = {} active_tab = {}
@$('.active').children('a').each( (i,d) -> @$('.is-active').each( (i,d) ->
href = $(d).attr('href') href = $(d).attr('href')
active_tab[href] = true active_tab[href] = true
) )
@$('.main-navigation').html App.view('navigation/menu')( @$('.js-menu').html App.view('navigation/menu')(
items: items items: items
open_tab: open_tab open_tab: open_tab
active_tab: active_tab active_tab: active_tab
@ -353,8 +353,8 @@ class App.Navigation extends App.ControllerWidgetPermanent
@addPrioCount newlist, item @addPrioCount newlist, item
update: (url) => update: (url) =>
@$('li').removeClass('active') @$('.is-active').removeClass('is-active')
@$("[href=\"#{url}\"]").parents('li').addClass('active') @$("[href=\"#{url}\"]").addClass('is-active')
recentViewNavbarItemsRebuild: => recentViewNavbarItemsRebuild: =>

View file

@ -13,7 +13,7 @@
<ul id="global-search-result" class="custom-dropdown-menu" role="menu"></ul> <ul id="global-search-result" class="custom-dropdown-menu" role="menu"></ul>
</form> </form>
<ul class="main-navigation"></ul> <div class="menu js-menu"></div>
<div class="tasks tasks-navigation"></div> <div class="tasks tasks-navigation"></div>

View file

@ -1,9 +1,8 @@
<% for item in @items: %> <% for item in @items: %>
<% if item.child: %> <% if item.child: %>
<li class="dropdown <% if @open_tab[item.target] : %>open<% end %>"> <a href="<%= item.target %>" class="dropdown-toggle dropdown<%- ' open' if @open_tab[item.target] %>" data-toggle="dropdown">
<a href="<%= item.target %>" class="dropdown-toggle" data-toggle="dropdown"> <%- @Icon(item.class, 'menu-item-icon') %>
<%- @Icon(item.class, 'nav-icon') %> <span class="menu-item-name flex">
<span class="nav-item-name flex">
<%- @T(item.name) %> <%- @T(item.name) %>
</span> </span>
<%- @Icon('arrow-down', 'dropdown-icon') %> <%- @Icon('arrow-down', 'dropdown-icon') %>
@ -21,22 +20,20 @@
</ul> </ul>
</li> </li>
<% else: %> <% else: %>
<li<% ' class="active"' if @active_tab[item.target] %>> <a class="menu-item js-<%- item.class %>MenuItem<%- ' is-active' if @active_tab[item.target] %>" href="<%= item.target %>">
<a class="horizontal center" href="<%= item.target %>"> <%- @Icon(item.class, 'menu-item-icon') %>
<%- @Icon(item.class, 'nav-icon') %> <span class="menu-item-name">
<span class="nav-item-name">
<%- @T(item.name) %> <%- @T(item.name) %>
</span> </span>
<% if item.counter: %> <% if item.counter: %>
<span class="counter badge badge--big"></span> <span class="counter badge badge--big"></span>
<% end %> <% end %>
<% if item.switch: %> <% if item.switch: %>
<div class="zammad-switch zammad-switch--dark zammad-switch--small"> <span class="zammad-switch zammad-switch--dark zammad-switch--small">
<input type="checkbox" id="<%- item.class %>-switch"> <input type="checkbox" id="<%- item.class %>-switch">
<label for="<%- item.class %>-switch"></label> <label for="<%- item.class %>-switch"></label>
</div> </span>
<% end %> <% end %>
</a> </a>
</li>
<% end %> <% end %>
<% end %> <% end %>