mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Using temporarily npm-shrinkwrap since `template-html-loader` uses an old `consolidate.js` version which doesn't support `pug`. Follow here: https://github.com/jtangelder/template-html-loader/issues/8
34 lines
807 B
JavaScript
34 lines
807 B
JavaScript
module.exports = function niceTabsDirective() {
|
|
return {
|
|
restrict: 'EA',
|
|
replace: true,
|
|
template: require('./nice-tabs.pug'),
|
|
link: function(scope, element, attrs) {
|
|
// TODO: add support for 'key' for saving in Settings
|
|
// TODO: add support for 'direction=below' for below tabs
|
|
|
|
scope.$watch(attrs.tabs, function(newValue) {
|
|
scope.tabs = newValue
|
|
})
|
|
|
|
scope.$watch(attrs.filter, function(newValue) {
|
|
scope.filter = newValue
|
|
})
|
|
|
|
scope.tabFound = function(tab) {
|
|
if (!tab.filters) {
|
|
return true
|
|
}
|
|
var found = false
|
|
|
|
angular.forEach(tab.filters, function(value) {
|
|
if (value === scope.filter) {
|
|
found = true
|
|
}
|
|
})
|
|
return found
|
|
}
|
|
}
|
|
}
|
|
}
|