Use direct click in personal navigation area if only one entry exists.
This commit is contained in:
parent
b91fceff08
commit
7e1b25468f
11 changed files with 27 additions and 18 deletions
|
@ -11,7 +11,7 @@ App.Config.set('User', {
|
|||
}, 'NavBarRight' )
|
||||
|
||||
App.Config.set('Admin', { prio: 9000, parent: '', name: 'Admin', translate: true, target: '#manage', icon: 'cog', permission: ['admin.*'] }, 'NavBarRight')
|
||||
App.Config.set('New', { prio: 20000, parent: '', name: 'New', translate: true, target: '#new', class: 'add' }, 'NavBarRight')
|
||||
App.Config.set('New', { prio: 20000, parent: '', name: 'New', translate: true, target: '#new', class: 'add', icon: 'plus' }, 'NavBarRight')
|
||||
App.Config.set('Misc', { prio: 90000, parent: '', name: 'Tools', translate: true, target: '#tools', child: true, class: 'tools' }, 'NavBar')
|
||||
# only for testing
|
||||
#App.Config.set('Misc1', { prio: 1600, parent: '#tools', name: 'Test 1', target: '#test1', permission: ['admin'] }, 'NavBar')
|
||||
|
|
|
@ -130,6 +130,12 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
|||
@recentViewNavbarItemsRebuild()
|
||||
items = @getItems(navbar: @Config.get('NavBarRight'))
|
||||
|
||||
# if only one child exists, use direct access
|
||||
for item in items
|
||||
if item && item.child && item.child.length is 1
|
||||
item.target = item.child[0].target
|
||||
delete item.child
|
||||
|
||||
# get open tabs to repopen on rerender
|
||||
openTab = {}
|
||||
@$('.open').children('a').each( (i,d) ->
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<% for item in @items: %>
|
||||
<% if item.child: %>
|
||||
<% if !_.isEmpty(item.child): %>
|
||||
<li class="<% if item.class: %><%- item.class %><% end %> dropup <% if @openTab[item.target] : %>open<% end %>">
|
||||
<a class="list-button dropdown-toggle js-action" data-toggle="dropdown" href="<%= item.target %>" title="<% if item.translate: %><%- @Ti( item.name ) %><% else: %><%= item.name %><% end %>">
|
||||
<a class="list-button dropdown-toggle js-action" data-toggle="dropdown" href="<%= item.target %>" title="<% if item.translate: %><%- @Ti(item.name) %><% else: %><%= item.name %><% end %>">
|
||||
<span class="dropdown-nose"></span>
|
||||
<% if item.class is 'user': %>
|
||||
<span class="js-avatar"></span>
|
||||
<% else: %>
|
||||
<%- @Icon('plus', 'user-menu-icon') %>
|
||||
<%- @Icon(item.icon, 'user-menu-icon') %>
|
||||
<% end %>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu--light" role="menu">
|
||||
|
@ -19,7 +19,7 @@
|
|||
<% end %>
|
||||
<li>
|
||||
<a href="<%= item.target %>" class="horizontal center">
|
||||
<span class="flex u-textTruncate"><% if item.translate: %><%- @T( item.name ) %><% else: %><%= item.name %><% end %></span>
|
||||
<span class="flex u-textTruncate"><% if item.translate: %><%- @T(item.name) %><% else: %><%= item.name %><% end %></span>
|
||||
<% if item['count'] isnt undefined: %><span class="badge badge--text count"><%= item['count'] %></span><% end %>
|
||||
<% if item.iconClass: %><%- @Icon(item.iconClass) %><% end %>
|
||||
</a>
|
||||
|
@ -29,7 +29,7 @@
|
|||
</li>
|
||||
<% else: %>
|
||||
<li class="settings">
|
||||
<a class="list-button fit horizontal centered" href="<%= item.target %>" title="<%- @Ti( item.name ) %>">
|
||||
<a class="list-button fit horizontal centered" href="<%= item.target %>" title="<%- @Ti(item.name) %>">
|
||||
<%- @Icon(item.icon, 'user-menu-icon') %>
|
||||
</a>
|
||||
</li>
|
||||
|
|
|
@ -151,7 +151,7 @@ class AgentTicketActionLevel0Test < TestCase
|
|||
)
|
||||
|
||||
# customer ticket create
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#customer_ticket_new"]')
|
||||
|
||||
watch_for(
|
||||
|
|
|
@ -11,7 +11,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase
|
|||
)
|
||||
tasks_close_all()
|
||||
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]')
|
||||
sleep 2
|
||||
|
||||
|
@ -92,7 +92,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase
|
|||
)
|
||||
tasks_close_all()
|
||||
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]')
|
||||
sleep 2
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class AgentTicketTextModuleTest < TestCase
|
|||
)
|
||||
|
||||
# try to use them
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]')
|
||||
sleep 2
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ class AgentUserManageTest < TestCase
|
|||
sleep 1
|
||||
|
||||
# create customer
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]')
|
||||
click(css: '.active .newTicket [name="customer_id_completion"]')
|
||||
|
||||
|
@ -75,7 +75,7 @@ class AgentUserManageTest < TestCase
|
|||
# call new ticket screen again
|
||||
tasks_close_all()
|
||||
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]')
|
||||
sleep 2
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ class CustomerTicketCreateTest < TestCase
|
|||
)
|
||||
|
||||
# customer ticket create
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#customer_ticket_new"]')
|
||||
sleep 2
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ class TaskbarTaskTest < TestCase
|
|||
tasks_close_all()
|
||||
|
||||
# persistant task
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]', wait: 0.8)
|
||||
set(
|
||||
css: '.active .newTicket input[name="title"]',
|
||||
|
@ -52,7 +52,7 @@ class TaskbarTaskTest < TestCase
|
|||
)
|
||||
tasks_close_all()
|
||||
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]', wait: 0.8)
|
||||
set(
|
||||
css: '.active .newTicket input[name="title"]',
|
||||
|
@ -64,7 +64,7 @@ class TaskbarTaskTest < TestCase
|
|||
)
|
||||
sleep 2
|
||||
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#ticket/create"]', wait: 0.8)
|
||||
set(
|
||||
css: '.active .newTicket input[name="title"]',
|
||||
|
|
|
@ -29,7 +29,7 @@ class UserSwitchCache < TestCase
|
|||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#customer_ticket_new"]')
|
||||
sleep 4
|
||||
|
||||
|
@ -58,7 +58,7 @@ class UserSwitchCache < TestCase
|
|||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
click(css: 'a[href="#new"]')
|
||||
click(css: 'a[href="#new"]', only_if_exists: true)
|
||||
click(css: 'a[href="#customer_ticket_new"]')
|
||||
sleep 4
|
||||
|
||||
|
|
|
@ -420,6 +420,7 @@ class TestCase < Test::Unit::TestCase
|
|||
|
||||
begin
|
||||
element = instance.find_elements(css: params[:css])[0]
|
||||
return if !element && params[:only_if_exists] == true
|
||||
#if element
|
||||
# instance.mouse.move_to(element)
|
||||
#end
|
||||
|
@ -430,6 +431,7 @@ class TestCase < Test::Unit::TestCase
|
|||
# just try again
|
||||
log('click', { rescure: true })
|
||||
element = instance.find_elements(css: params[:css])[0]
|
||||
return if !element && params[:only_if_exists] == true
|
||||
#if element
|
||||
# instance.mouse.move_to(element)
|
||||
#end
|
||||
|
@ -1829,6 +1831,7 @@ wait untill text in selector disabppears
|
|||
browser: instance,
|
||||
css: 'a[href="#new"]',
|
||||
mute_log: true,
|
||||
only_if_exists: true,
|
||||
)
|
||||
click(
|
||||
browser: instance,
|
||||
|
|
Loading…
Reference in a new issue