fix urls
parent
5da883eca7
commit
e32e3ab2c3
|
@ -70,6 +70,13 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
|
||||||
return [name, options]
|
return [name, options]
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
|
if $el.is("a")
|
||||||
|
$el.attr("href", "#")
|
||||||
|
|
||||||
|
$el.on "mouseenter", (event) ->
|
||||||
|
target = $(event.currentTarget)
|
||||||
|
|
||||||
|
if !target.data("fullUrl")
|
||||||
parseNav($attrs.tgNav, $scope).then (result) ->
|
parseNav($attrs.tgNav, $scope).then (result) ->
|
||||||
[name, options] = result
|
[name, options] = result
|
||||||
user = $auth.getUser()
|
user = $auth.getUser()
|
||||||
|
@ -78,20 +85,22 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
|
||||||
url = $navurls.resolve(name)
|
url = $navurls.resolve(name)
|
||||||
fullUrl = $navurls.formatUrl(url, options)
|
fullUrl = $navurls.formatUrl(url, options)
|
||||||
|
|
||||||
$el.data("fullUrl", fullUrl)
|
target.data("fullUrl", fullUrl)
|
||||||
|
|
||||||
if $el.is("a")
|
if target.is("a")
|
||||||
$el.attr("href", fullUrl)
|
target.attr("href", fullUrl)
|
||||||
|
|
||||||
$el.on "click", (event) ->
|
$el.on "click", (event) ->
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
target = $(event.currentTarget)
|
||||||
|
|
||||||
fullUrl = $(event.currentTarget).data('fullUrl')
|
fullUrl = target.data("fullUrl")
|
||||||
|
|
||||||
if event.which != 2
|
switch event.which
|
||||||
|
when 1
|
||||||
$location.url(fullUrl)
|
$location.url(fullUrl)
|
||||||
$scope.$apply()
|
$scope.$apply()
|
||||||
else
|
when 2
|
||||||
window.open fullUrl
|
window.open fullUrl
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
|
|
Loading…
Reference in New Issue