diff --git a/web/app/widgets/widgets.module.js b/web/app/widgets/widgets.module.js index 3ea00990..8f74b4da 100755 --- a/web/app/widgets/widgets.module.js +++ b/web/app/widgets/widgets.module.js @@ -16,6 +16,7 @@ .factory('Widgets', WidgetsService) .directive('genericWidget', GenericWidgetDirective) .directive('widgetIcon', WidgetIcon) + .directive('itemTypeIcon', ItemTypeIcon) .directive('itemPicker', ItemPicker) .filter('themeValue', ThemeValueFilter) @@ -99,6 +100,42 @@ } } + function ItemTypeIcon() { + var directive = { + link: link, + restrict: 'AE', + template: + '#' + + '', + scope: { + type: '=' + } + }; + return directive; + + function link(scope, element, attrs) { + scope.getGlyph = function () { + switch (scope.type) { + case 'Group': return 'th-large'; + case 'Switch': return 'off'; + case 'String': return 'font'; + case 'Number': return 'usd'; + case 'Color': return 'tint'; + case 'DateTime': return 'calendar'; + case 'Dimmer': return 'sort-by-attributes'; + case 'Rollershutter': return 'oil'; + case 'Contact': return 'resize-small'; + case 'Player': return 'fast-forward'; + case 'Image': return 'picture'; + case 'Location': return 'map-marker'; + case 'Call': return 'earphone'; + default: return 'asterisk'; + } + }; + } + } + + ItemPicker.$inject = ['$filter', 'OHService']; function ItemPicker($filter, OHService) { @@ -110,9 +147,9 @@ restrict: 'AE', template: '' + - ' {{$select.selected.name}}' + + '  {{$select.selected.name}}' + ' ' + - '
' + + '
 
' + ' ' + '
' + '
', @@ -135,9 +172,9 @@ if (this.filterType) { vm.itemlist = $filter('filter')(vm.itemlist, function (item) { if (vm.includeGroups) { - return item.type.startsWith(vm.filterType) || item.type.startsWith('Group'); + return !item.type.indexOf(vm.filterType) || !item.type.indexOf('Group'); } else { - return item.type.startsWith(vm.filterType); + return !item.type.indexOf(vm.filterType); } }); }