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