Fix issue #4070: Can't open wiki links in new window
parent
b95085e47c
commit
0d5976f7c0
|
@ -117,6 +117,13 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
|||
loadWikiLinks: ->
|
||||
return @rs.wiki.listLinks(@scope.projectId).then (wikiLinks) =>
|
||||
@scope.wikiLinks = wikiLinks
|
||||
|
||||
for link in @scope.wikiLinks
|
||||
link.url = @navUrls.resolve("project-wiki-page", {
|
||||
project: @scope.projectSlug
|
||||
slug: link.href
|
||||
})
|
||||
|
||||
selectedWikiLink = _.find(wikiLinks, {href: @scope.wikiSlug})
|
||||
@scope.wikiTitle = selectedWikiLink.title if selectedWikiLink?
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ module = angular.module("taigaWiki")
|
|||
## Wiki Main Directive
|
||||
#############################################################################
|
||||
|
||||
WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $loading, $template, $compile, $translate) ->
|
||||
WikiNavDirective = ($tgrepo, $log, $location, $confirm, $analytics, $loading, $template,
|
||||
$compile, $translate) ->
|
||||
template = $template.get("wiki/wiki-nav.html", true)
|
||||
link = ($scope, $el, $attrs) ->
|
||||
$ctrl = $el.controller()
|
||||
|
@ -59,18 +60,6 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $l
|
|||
$el.off()
|
||||
$el.html(html)
|
||||
|
||||
$el.on "click", ".wiki-link .link-title", (event) ->
|
||||
event.preventDefault()
|
||||
target = angular.element(event.currentTarget)
|
||||
linkId = target.parents('.wiki-link').data('id')
|
||||
linkSlug = $scope.wikiLinks[linkId].href
|
||||
$scope.$apply ->
|
||||
ctx = {
|
||||
project: $scope.projectSlug
|
||||
slug: linkSlug
|
||||
}
|
||||
$location.path($navUrls.resolve("project-wiki-page", ctx))
|
||||
|
||||
$el.on "click", ".add-button", (event) ->
|
||||
event.preventDefault()
|
||||
$el.find(".new").removeClass("hidden")
|
||||
|
@ -146,5 +135,5 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $l
|
|||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgWikiNav", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", "$tgNavUrls",
|
||||
"$tgAnalytics", "$tgLoading", "$tgTemplate", "$compile", "$translate", WikiNavDirective])
|
||||
module.directive("tgWikiNav", ["$tgRepo", "$log", "$tgLocation", "$tgConfirm", "$tgAnalytics",
|
||||
"$tgLoading", "$tgTemplate", "$compile", "$translate", WikiNavDirective])
|
||||
|
|
|
@ -5,22 +5,27 @@ nav
|
|||
ul
|
||||
<% _.each(wikiLinks, function(link, index) { %>
|
||||
li.wiki-link(data-id!="<%- index %>")
|
||||
a.link-title(title!="<%- link.title %>") <%- link.title %>
|
||||
a.link-title(title!="<%- link.title %>", href!="<%- link.url %>")
|
||||
<%- link.title %>
|
||||
|
||||
<% if (deleteWikiLinkPermission) { %>
|
||||
a.js-delete-link.remove-wiki-page(title!="{{'WIKI.DELETE_LINK_TITLE' | translate}}")
|
||||
tg-svg(svg-icon="icon-trash")
|
||||
<% } %>
|
||||
|
||||
input.hidden(
|
||||
type="text"
|
||||
placeholder="{{'COMMON.FIELDS.NAME' | translate}}"
|
||||
value!="<%- link.title %>"
|
||||
)
|
||||
<% }) %>
|
||||
|
||||
li.new.hidden
|
||||
input(
|
||||
type="text"
|
||||
placeholder="{{'COMMON.FIELDS.NAME' | translate}}"
|
||||
)
|
||||
|
||||
<% if (addWikiLinkPermission) { %>
|
||||
a(
|
||||
href=""
|
||||
|
|
Loading…
Reference in New Issue