mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-06 22:49:24 +01:00
Add support for params in menu items (#1305)
* Support params to state for menu items. * feat(core): Add support for params in menu items Proposed by @scfox Fixes #1304 * Removed trailing space on test. * Changed default params to be empty object instead of empty string.
This commit is contained in:
committed by
Michael Leanos
parent
6911b80446
commit
5817a484fa
@@ -85,6 +85,7 @@
|
||||
service.menus[menuId].items[itemIndex].items.push({
|
||||
title: options.title || '',
|
||||
state: options.state || '',
|
||||
params: options.params || {},
|
||||
roles: ((options.roles === null || typeof options.roles === 'undefined') ? service.menus[menuId].items[itemIndex].roles : options.roles),
|
||||
position: options.position || 0,
|
||||
shouldRender: shouldRender
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<a ng-switch-when="dropdown" class="dropdown-toggle" uib-dropdown-toggle role="button">{{::item.title}} <span class="caret"></span></a>
|
||||
<ul ng-switch-when="dropdown" class="dropdown-menu">
|
||||
<li ng-repeat="subitem in item.items | orderBy: 'position'" ng-if="subitem.shouldRender(vm.authentication.user);">
|
||||
<a ui-sref="{{subitem.state}}" ng-bind="subitem.title"></a>
|
||||
<a ui-sref="{{subitem.state}}({{subitem.params}})" ng-bind="subitem.title"></a>
|
||||
</li>
|
||||
</ul>
|
||||
<a ng-switch-default ui-sref="{{item.state}}" ng-bind="item.title"></a>
|
||||
|
||||
@@ -300,6 +300,7 @@
|
||||
var subItemOptions = {
|
||||
title: 'title',
|
||||
state: 'sub.state',
|
||||
params: { p1: 'val1' },
|
||||
isPublic: false,
|
||||
roles: ['a', 'b'],
|
||||
position: 4
|
||||
@@ -378,6 +379,10 @@
|
||||
it('should set position to options position', function() {
|
||||
expect(subItem1.position).toEqual(subItemOptions.position);
|
||||
});
|
||||
|
||||
it('should set params to options params', function() {
|
||||
expect(subItem1.params).toEqual(subItemOptions.params);
|
||||
});
|
||||
});
|
||||
|
||||
describe('without optoins set', function() {
|
||||
|
||||
Reference in New Issue
Block a user