fix new tab link

stable
Juanfran 2014-08-11 10:26:06 +02:00
parent ae9f4608dc
commit 451125de35
2 changed files with 19 additions and 8 deletions

View File

@ -70,18 +70,29 @@ NavigationUrlsDirective = ($navurls, $auth, $q, $location) ->
return [name, options] return [name, options]
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
$el.on "click", (event) ->
event.preventDefault()
parseNav($attrs.tgNav, $scope).then (result) -> parseNav($attrs.tgNav, $scope).then (result) ->
[name, options] = result [name, options] = result
user = $auth.getUser() user = $auth.getUser()
options.user = user.username if user options.user = user.username if user
url = $navurls.resolve(name) url = $navurls.resolve(name)
fullUrl = $navurls.formatUrl(url, options) fullUrl = $navurls.formatUrl(url, options)
$el.data("fullUrl", fullUrl)
if $el.is("a")
$el.attr("href", fullUrl)
$el.on "click", (event) ->
event.preventDefault()
fullUrl = $(event.currentTarget).data('fullUrl')
if event.which != 2
$location.url(fullUrl) $location.url(fullUrl)
$scope.$apply()
else
window.open fullUrl
$scope.$on "$destroy", -> $scope.$on "$destroy", ->
$el.off() $el.off()

View File

@ -105,7 +105,7 @@ ProjectMenuDirective = ($log, $compile, $auth, $rootscope, $tgAuth, $location) -
</a> </a>
</li> </li>
<% if (project.is_backlog_activated && project.my_permissions.indexOf("view_us") != -1) { %> <% if (project.is_backlog_activated && project.my_permissions.indexOf("view_us") != -1) { %>
<li id="nav-backlog" tg-nav="project-backlog:project=project.slug"> <li id="nav-backlog">
<a href="" title="Backlog" tg-nav="project-backlog:project=project.slug"> <a href="" title="Backlog" tg-nav="project-backlog:project=project.slug">
<span class="icon icon-backlog"></span> <span class="icon icon-backlog"></span>
<span class="item">Backlog</span> <span class="item">Backlog</span>