Added generation of second nav bar area.

This commit is contained in:
Martin Edenhofer 2014-07-13 01:27:41 +02:00
parent a9727300bb
commit e7a1ad7f30
6 changed files with 43 additions and 74 deletions

View file

@ -1,13 +1,16 @@
App.Config.set( 'User', {
prio: 10000,
prio: 1000,
parent: '',
callback: ->
item = {}
item['name'] = App.Session.get( 'login' )
return item
target: '#current_user',
class: 'user'
role: [ 'Agent', 'Customer' ]
}, 'NavBarRight' )
App.Config.set( 'Admin', { prio: 10000, parent: '', name: 'Admin', target: '#manage', role: ['Admin'] }, 'NavBar' )
App.Config.set( 'Admin', { prio: 9000, parent: '', name: 'Admin', target: '#manage', role: ['Admin'] }, 'NavBarRight' )
App.Config.set( 'New', { prio: 20000, parent: '', name: 'New', target: '#new', class: 'add' }, 'NavBarRight' )
App.Config.set( 'Misc', { prio: 90000, parent: '', name: 'Tools', target: '#tools', child: true }, 'NavBar' )

View file

@ -410,7 +410,7 @@ App.Config.set( 'ticket/create/:type/:ticket_id/:article_id', Router, 'Routes' )
App.Config.set( 'ticket/create/:type/id/:id/:ticket_id/:article_id', Router, 'Routes' )
# set new task actions
App.Config.set( 'TicketNewCallOutbound', { prio: 8001, name: 'Call Outbound', target: '#ticket/create/call_outbound', role: ['Agent'] }, 'TaskActions' )
App.Config.set( 'TicketNewCallInbound', { prio: 8002, name: 'Call Inbound', target: '#ticket/create/call_inbound', role: ['Agent'] }, 'TaskActions' )
App.Config.set( 'TicketNewEmail', { prio: 8003, name: 'Email', target: '#ticket/create/email', role: ['Agent'] }, 'TaskActions' )
App.Config.set( 'TicketNewCallOutbound', { prio: 8001, parent: '#new', name: 'Call Outbound', target: '#ticket/create/call_outbound', role: ['Agent'] }, 'NavBarRight' )
App.Config.set( 'TicketNewCallInbound', { prio: 8002, parent: '#new', name: 'Call Inbound', target: '#ticket/create/call_inbound', role: ['Agent'] }, 'NavBarRight' )
App.Config.set( 'TicketNewEmail', { prio: 8003, parent: '#new', name: 'Email', target: '#ticket/create/email', role: ['Agent'] }, 'NavBarRight' )

View file

@ -12,10 +12,10 @@ class Index extends App.ControllerContent
@Session.init()
App.Event.trigger( 'ui:rerender' )
# redirect to login
# redirect to login
redirect = =>
@navigate 'login'
@delay redirect, 150
App.Config.set( 'logout', Index, 'Routes' )
App.Config.set( 'Logout', { prio: 1800, parent: '#current_user', name: 'Sign out', target: '#logout', divider: true, role: [ 'Agent', 'Customer' ] }, 'NavBarRight' )
App.Config.set( 'Logout', { prio: 1800, parent: '#current_user', name: 'Sign out', target: '#logout', divider: true, iconClass: 'signout', role: [ 'Agent', 'Customer' ] }, 'NavBarRight' )

View file

@ -204,16 +204,13 @@ class App.Navigation extends App.Controller
# start search
@el.find('#global-search').bind( 'keyup', (e) =>
@term = @el.find('#global-search').val()
return if !@term
return if @term is search
@delay( searchFunction, 220, 'search' )
)
if !@taskBar
@taskBar = true
new App.TaskbarWidget( el: @el.find('.tasks') )
@taskbar = new App.TaskbarWidget( el: @el.find('.tasks') )
getItems: (data) ->
navbar = _.values(data.navbar)

View file

@ -30,7 +30,9 @@
<li class="<%= item.class %> <% if @active_tab[item.target] : %>active<% end %>"><a href="<%= item.target %>"><%- @T( item.name ) %></a></li>
<% end %>
<% end %>
<li class="customers"><a href="#to_somewhere">Customers</a></li>
</ul>
<div class="tasks flex"></div>
@ -40,73 +42,40 @@
<!--<a href="#bell" class="glyphicon glyphicon-bell"></a>-->
<li class="user dropup">
<div class="list-button horizontal centered dropdown-toggle" data-toggle="dropdown">
<span class="dropdown-nose"></span>
<span class="user avatar" style="background-image: url(https://pbs.twimg.com/profile_images/3510491848/156dbaec406561cb3e680dc3795b0f86.jpeg)"></span>
</div>
<ul class="dropdown-menu" role="menu">
<li><a href="#profile"><%- @Ti( 'Edit profile' ) %></a></li>
<li class="divider"></li>
<li><a href="#shortcuts"><%- @Ti( 'My Shortcuts' ) %></a></li>
<li class="divider"></li>
<li>
<a href="#logout" class="horizontal">
<span class="flex"><%- @Ti( 'Sign out' ) %></span>
<span class="signout icon"></span>
</a>
</li>
</ul>
</li>
<li class="settings active">
<a class="list-button fit horizontal centered" href="#manage">
<span class="light cog icon"></span>
<span class="dark cog icon"></span>
</a>
</li>
<li class="settings">
<a class="list-button fit horizontal centered" href="#manage">
<span class="light cog icon"></span>
<span class="dark cog icon"></span>
</a>
</li>
<li class="add dropup">
<div class="list-button horizontal centered dropdown-toggle" data-toggle="dropdown">
<span class="dropdown-nose"></span>
<span class="green plus icon"></span>
<span class="white plus icon"></span>
</div>
<ul class="dropdown-menu" role="menu">
<li><a><%- @Ti( 'New Ticket' ) %></a></li>
<li class="divider"></li>
<li><a><%- @Ti( 'New Organisation' ) %></a></li>
<li class="divider"></li>
<li><a><%- @Ti( 'New Customer' ) %></a></li>
</ul>
</li>
<!--<% for item in @navbar_right: %>
<% for item in @navbar_right: %>
<% if item.child: %>
<li class="dropdown <% if @open_tab[item.target] : %>open<% end %>">
<a href="<%= item.target %>" class="dropdown-toggle" data-toggle="dropdown"><%- @T( item.name ) %> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li class="<% if item.class: %><%- item.class %><% end %> dropup <% if @open_tab[item.target] : %>open<% end %>">
<a class="list-button horizontal centered dropdown-toggle" data-toggle="dropdown" href="<%= item.target %>" title="<%- @T( item.name ) %>">
<span class="dropdown-nose"></span>
<% if item.class is 'user': %>
<span class="user avatar" style="background-image: url(https://pbs.twimg.com/profile_images/3510491848/156dbaec406561cb3e680dc3795b0f86.jpeg)"></span>
<% else: %>
<span class="green plus icon"></span>
<span class="white plus icon"></span>
<% end %>
</a>
<ul class="dropdown-menu" role="menu">
<% for item in item.child: %>
<% if item.divider: %>
<li class="divider"></li>
<% end %>
<% if item.navheader: %>
<li class="dropdown-header"><%- @T( item.navheader ) %></li>
<% end %>
<li class="<% if @active_tab[item.target] : %>active<% end %>"><a href="<%= item.target %>"><%- @T( item.name ) %><% if item['count'] isnt undefined: %><span class="badge count"><%= item['count'] %>)</span><% end %></a></li>
<li class="divider"></li>
<li class="<% if @active_tab[item.target] : %>active<% end %>">
<a href="<%= item.target %>" class="horizontal">
<span class="flex"><%- @T( item.name ) %></span>
<% if item['count'] isnt undefined: %><span class="badge count"><%= item['count'] %></span><% end %>
<% if item.iconClass: %><span class="<%= item.iconClass %> icon"></span><% end %>
</a>
</li>
<% end %>
</ul>
</li>
<% else: %>
<li class="<% if @active_tab[item.target] : %>active<% end %>"><a href="<%= item.target %>"><%- @T( item.name ) %></a></li>
<li class="settings <% if @active_tab[item.target] : %>active<% end %>">
<a class="list-button fit horizontal centered" href="<%= item.target %>" title="<%- @T( item.name ) %>">
<span class="light cog icon"></span>
<span class="dark cog icon"></span>
</a>
</li>
<% end %>
<% end %>-->
<% end %>
</ul>
<% else: %>
<!--

View file

@ -3,13 +3,13 @@ module Sessions::Backend::RecentViewed
def self.worker( user, worker )
cache_key = 'user_' + user.id.to_s + '_recent_viewed'
if Sessions::CacheIn.expired(cache_key)
recent_viewed = RecentView.list_fulldata( user, 10 )
recent_viewed = RecentView.list_fulldata( user, 6 )
recent_viewed_cache = Sessions::CacheIn.get( cache_key, { :re_expire => true } )
worker.log 'notice', 'fetch recent_viewed - ' + cache_key
if recent_viewed != recent_viewed_cache
worker.log 'notify', 'fetch recent_viewed changed - ' + cache_key
recent_viewed_full = RecentView.list_fulldata( user, 10 )
recent_viewed_full = RecentView.list_fulldata( user, 6 )
Sessions::CacheIn.set( cache_key, recent_viewed, { :expires_in => 5.seconds } )
Sessions::CacheIn.set( cache_key + '_push', recent_viewed_full )
end