Merge branch 'develop' into interface
Conflicts: app/assets/javascripts/app/views/navigation.jst.eco
This commit is contained in:
commit
e4e915fff7
6 changed files with 137 additions and 128 deletions
|
@ -10,7 +10,8 @@ class App.Navigation extends App.Controller
|
|||
|
||||
# rerender view
|
||||
@bind 'ui:rerender', (data) =>
|
||||
@render()
|
||||
@renderMenu()
|
||||
@renderPersonal()
|
||||
|
||||
# update selected item
|
||||
@bind 'navupdate', (data) =>
|
||||
|
@ -26,14 +27,10 @@ class App.Navigation extends App.Controller
|
|||
|
||||
@render()
|
||||
|
||||
# remember ticket overview data
|
||||
@bind 'navupdate_ticket_overview', (data) =>
|
||||
App.Store.write( 'navupdate_ticket_overview', data )
|
||||
|
||||
# rebuild recent viewed data
|
||||
@bind 'update_recent_viewed', (data) =>
|
||||
@recent_viewed_build(data)
|
||||
@render()
|
||||
@renderPersonal()
|
||||
|
||||
# bell on / bell off
|
||||
@bind 'bell', (data) =>
|
||||
|
@ -47,6 +44,51 @@ class App.Navigation extends App.Controller
|
|||
else
|
||||
@el.find('.bell').removeClass('show')
|
||||
|
||||
renderMenu: =>
|
||||
items = @getItems( navbar: @Config.get( 'NavBar' ) )
|
||||
|
||||
# get open tabs to repopen on rerender
|
||||
open_tab = {}
|
||||
@el.find('.open').children('a').each( (i,d) =>
|
||||
href = $(d).attr('href')
|
||||
open_tab[href] = true
|
||||
)
|
||||
|
||||
# get active tabs to reactivate on rerender
|
||||
active_tab = {}
|
||||
@el.find('.active').children('a').each( (i,d) =>
|
||||
href = $(d).attr('href')
|
||||
active_tab[href] = true
|
||||
)
|
||||
@el.find('.navbar-items-menu').html App.view('navigation/menu')(
|
||||
items: items
|
||||
open_tab: open_tab
|
||||
active_tab: active_tab
|
||||
)
|
||||
|
||||
renderPersonal: =>
|
||||
items = @getItems( navbar: @Config.get( 'NavBarRight' ) )
|
||||
|
||||
# get open tabs to repopen on rerender
|
||||
open_tab = {}
|
||||
@el.find('.open').children('a').each( (i,d) =>
|
||||
href = $(d).attr('href')
|
||||
open_tab[href] = true
|
||||
)
|
||||
|
||||
# get active tabs to reactivate on rerender
|
||||
active_tab = {}
|
||||
@el.find('.active').children('a').each( (i,d) =>
|
||||
href = $(d).attr('href')
|
||||
active_tab[href] = true
|
||||
)
|
||||
|
||||
@el.find('.navbar-items-personal').html App.view('navigation/personal')(
|
||||
items: items
|
||||
open_tab: open_tab
|
||||
active_tab: active_tab
|
||||
)
|
||||
|
||||
renderResult: (result = []) =>
|
||||
el = @el.find('#global-search-result')
|
||||
|
||||
|
@ -78,38 +120,25 @@ class App.Navigation extends App.Controller
|
|||
@organizationPopups()
|
||||
|
||||
render: () ->
|
||||
user = App.Session.all()
|
||||
nav_left = @getItems( navbar: @Config.get( 'NavBar' ) )
|
||||
nav_right = @getItems( navbar: @Config.get( 'NavBarRight' ) )
|
||||
|
||||
# remove old popovers
|
||||
$('.popover').remove()
|
||||
|
||||
# get open tabs to repopen on rerender
|
||||
open_tab = {}
|
||||
@el.find('.open').children('a').each( (i,d) =>
|
||||
href = $(d).attr('href')
|
||||
open_tab[href] = true
|
||||
)
|
||||
|
||||
# get active tabs to reactivate on rerender
|
||||
active_tab = {}
|
||||
@el.find('.active').children('a').each( (i,d) =>
|
||||
href = $(d).attr('href')
|
||||
active_tab[href] = true
|
||||
)
|
||||
|
||||
# remember old search query
|
||||
search = @el.find('#global-search').val()
|
||||
|
||||
user = App.Session.all()
|
||||
@html App.view('navigation')(
|
||||
navbar_left: nav_left
|
||||
navbar_right: nav_right
|
||||
open_tab: open_tab
|
||||
active_tab: active_tab
|
||||
user: user
|
||||
result: @result || []
|
||||
search: search
|
||||
)
|
||||
|
||||
# renderMenu
|
||||
@renderMenu()
|
||||
|
||||
# renderPersonal
|
||||
@renderPersonal()
|
||||
|
||||
# set focus to search box
|
||||
if @searchFocus
|
||||
@searchFocusSet = true
|
||||
|
@ -334,7 +363,7 @@ class App.Navigation extends App.Controller
|
|||
delete NavBarRight[key]
|
||||
|
||||
# add new views
|
||||
items = data.recent_viewed
|
||||
items = data.recent_viewed || []
|
||||
items = @prepareForObjectList(items)
|
||||
prio = 8000
|
||||
for item in items
|
||||
|
|
|
@ -6,106 +6,15 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="logo" title="<%- @C( 'product_name' ) %>"></div>
|
||||
<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>
|
||||
<ul class="nav navbar-nav">
|
||||
<% for item in @navbar_left: %>
|
||||
<% if item.child: %>
|
||||
<li class="dropdown <%= item.class %> <% 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">
|
||||
<% 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>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% else: %>
|
||||
<li class="<%= item.class %> <% if @active_tab[item.target] : %>active<% end %>">
|
||||
<a class="horizontal center" href="<%= item.target %>">
|
||||
<span class="nav-item-icon">
|
||||
<span class="<%= item.class %> icon"></span>
|
||||
</span>
|
||||
<span class="nav-item-name flex">
|
||||
<%- @T( item.name ) %>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<li class="customers">
|
||||
<a class="horizontal center" href="#to_somewhere">
|
||||
<span class="nav-item-icon">
|
||||
<span class="customers icon"></span>
|
||||
</span>
|
||||
<span class="nav-item-name flex">
|
||||
Customers
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-items-menu"></ul>
|
||||
|
||||
<div class="tasks flex"></div>
|
||||
|
||||
<% if !_.isEmpty(@user): %>
|
||||
<ul class="user-menu horizontal stretch">
|
||||
|
||||
<!--<a href="#bell" class="glyphicon glyphicon-bell"></a>-->
|
||||
|
||||
<% for item in @navbar_right: %>
|
||||
<% if item.child: %>
|
||||
<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(<%- item.image %>)"></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 %>" 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="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 %>
|
||||
</ul>
|
||||
<% else: %>
|
||||
<!--
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#login"><%- @T( 'Sign in' ) %></a></li>
|
||||
</ul>
|
||||
-->
|
||||
<ul class="user-menu horizontal stretch navbar-items-personal"></ul>
|
||||
<% end %>
|
31
app/assets/javascripts/app/views/navigation/menu.jst.eco
Normal file
31
app/assets/javascripts/app/views/navigation/menu.jst.eco
Normal file
|
@ -0,0 +1,31 @@
|
|||
<% for item in @items: %>
|
||||
<% if item.child: %>
|
||||
<li class="dropdown <%= item.class %> <% 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">
|
||||
<% 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>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
<% else: %>
|
||||
<li class="<%= item.class %> <% if @active_tab[item.target] : %>active<% end %>">
|
||||
<a class="horizontal center" href="<%= item.target %>">
|
||||
<span class="nav-item-icon">
|
||||
<span class="<%= item.class %> icon"></span>
|
||||
</span>
|
||||
<span class="nav-item-name flex">
|
||||
<%- @T( item.name ) %>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
<% end %>
|
39
app/assets/javascripts/app/views/navigation/personal.jst.eco
Normal file
39
app/assets/javascripts/app/views/navigation/personal.jst.eco
Normal file
|
@ -0,0 +1,39 @@
|
|||
<% for item in @items: %>
|
||||
<% if item.child: %>
|
||||
<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(<%- item.image %>)"></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 %>" 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="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 %>
|
|
@ -21,7 +21,7 @@ class ApplicationModel < ActiveRecord::Base
|
|||
|
||||
after_create :activity_stream_create
|
||||
after_update :activity_stream_update
|
||||
after_destroy :activity_stream_destroy
|
||||
before_destroy :activity_stream_destroy
|
||||
|
||||
after_create :history_create
|
||||
after_update :history_update
|
||||
|
@ -31,7 +31,7 @@ class ApplicationModel < ActiveRecord::Base
|
|||
after_update :search_index_update
|
||||
after_destroy :search_index_destroy
|
||||
|
||||
after_destroy :recent_view_destroy
|
||||
before_destroy :recent_view_destroy
|
||||
|
||||
# create instance accessor
|
||||
class << self
|
||||
|
|
|
@ -22,9 +22,10 @@ class RecentView < ApplicationModel
|
|||
end
|
||||
|
||||
def self.log_destroy( requested_object, requested_object_id )
|
||||
return if requested_object == 'RecentView'
|
||||
RecentView.where( :recent_view_object_id => ObjectLookup.by_name( requested_object ) ).
|
||||
where( :o_id => requested_object_id ).
|
||||
destroy_all
|
||||
where( :o_id => requested_object_id ).
|
||||
destroy_all
|
||||
end
|
||||
|
||||
def self.user_log_destroy( user )
|
||||
|
|
Loading…
Reference in a new issue