mirror of
https://github.com/openstf/stf
synced 2025-10-05 19:42:01 +02:00
Fixed all nav-menu's current active highlighting.
This commit is contained in:
parent
b709887e22
commit
d0cd86b263
2 changed files with 16 additions and 15 deletions
|
@ -11,21 +11,19 @@ module.exports = function ($location) {
|
|||
var routePattern
|
||||
var link
|
||||
var url
|
||||
var currentLink
|
||||
var urlMap = []
|
||||
var i
|
||||
|
||||
// TODO: links doesnt find 'a'
|
||||
//console.log(links)
|
||||
|
||||
if (!$location.$$html5) {
|
||||
routePattern = /\/#[^/]*/
|
||||
}
|
||||
|
||||
for (i = 0; i < links.length; i++) {
|
||||
for (var i = 0; i < links.length; i++) {
|
||||
link = angular.element(links[i])
|
||||
url = link.attr('ng-href')
|
||||
|
||||
// Remove angular route expressions
|
||||
url = url.replace(/\/{{.*}}/g, '')
|
||||
|
||||
if ($location.$$html5) {
|
||||
urlMap.push({url: url, link: link})
|
||||
} else {
|
||||
|
@ -34,21 +32,24 @@ module.exports = function ($location) {
|
|||
}
|
||||
|
||||
function activateLink() {
|
||||
|
||||
var location = $location.path()
|
||||
var pathLink = ''
|
||||
|
||||
for (i = 0; i < urlMap.length; ++i) {
|
||||
for (var i = 0; i < urlMap.length; ++i) {
|
||||
if (location.search(urlMap[i].url) !== -1) {
|
||||
pathLink = urlMap[i].link
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all active links
|
||||
for (var j = 0; j < links.length; j++) {
|
||||
link = angular.element(links[j])
|
||||
link.removeClass(onClass)
|
||||
}
|
||||
|
||||
if (pathLink) {
|
||||
if (currentLink) {
|
||||
currentLink.removeClass(onClass);
|
||||
}
|
||||
currentLink = pathLink;
|
||||
currentLink.addClass(onClass);
|
||||
pathLink.addClass(onClass)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
a.stf-logo(href="/") STF 2
|
||||
ul.nav.stf-nav(nav-menu='current').unselectable
|
||||
li(ng-cloak)
|
||||
a(ng-href='/#!/control', ng-show='lastUsedDevice')
|
||||
a(ng-href='/#!/control/{{lastUsedDevice}}', ng-show='lastUsedDevice')
|
||||
span.fa.fa-mobile
|
||||
| {{ !$root.basicMode ? "Control" : '' | translate }}
|
||||
a(ng-href='/#!/devices', accesskey='1')
|
||||
|
@ -12,7 +12,7 @@
|
|||
a(ng-href='/#!/settings')
|
||||
span.fa.fa-gears
|
||||
| {{ !$root.basicMode ? "Settings" : '' | translate }}
|
||||
ul.nav.stf-nav.stf-feedback.pull-right(ng-cloak).unselectable
|
||||
ul.nav.stf-nav.stf-feedback.pull-right(ng-cloak, nav-menu='current').unselectable
|
||||
li.stf-nav-web-native-button(ng-if='!$root.basicMode && isControlRoute')
|
||||
.btn-group
|
||||
button(type='button', ng-model='$root.platform', btn-radio="'web'", translate).btn.btn-sm.btn-default-outline Web
|
||||
|
@ -26,7 +26,7 @@
|
|||
a
|
||||
badge-icon(type='warning', message='There was an error')
|
||||
|
||||
li(ng-if='!$root.basicMode')
|
||||
li(ng-show='!$root.basicMode')
|
||||
a(ng-href='/#!/help', accesskey='6')
|
||||
i.fa.fa-question-circle.fa-fw
|
||||
| {{ "Help" | translate }}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue