hide wiki links when the wiki doesn't have links
parent
5df43360d3
commit
6915a99346
|
@ -60,6 +60,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
@scope.wikiSlug = @params.slug
|
@scope.wikiSlug = @params.slug
|
||||||
@scope.wikiTitle = @scope.wikiSlug
|
@scope.wikiTitle = @scope.wikiSlug
|
||||||
@scope.sectionName = "Wiki"
|
@scope.sectionName = "Wiki"
|
||||||
|
@scope.linksVisible = false
|
||||||
|
|
||||||
promise = @.loadInitialData()
|
promise = @.loadInitialData()
|
||||||
|
|
||||||
|
@ -75,10 +76,11 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
projectName: @scope.project.name
|
projectName: @scope.project.name
|
||||||
})
|
})
|
||||||
description = @translate.instant("WIKI.PAGE_DESCRIPTION", {
|
description = @translate.instant("WIKI.PAGE_DESCRIPTION", {
|
||||||
wikiPageContent: angular.element(@scope.wiki.html or "").text()
|
wikiPageContent: angular.element(@scope.wiki?.html or "").text()
|
||||||
totalEditions: @scope.wiki.editions or 0
|
totalEditions: @scope.wiki?.editions or 0
|
||||||
lastModifiedDate: moment(@scope.wiki.modified_date).format(@translate.instant("WIKI.DATETIME"))
|
lastModifiedDate: moment(@scope.wiki?.modified_date).format(@translate.instant("WIKI.DATETIME"))
|
||||||
})
|
})
|
||||||
|
|
||||||
@appMetaService.setAll(title, description)
|
@appMetaService.setAll(title, description)
|
||||||
|
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
|
@ -122,8 +124,12 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
|
||||||
promise = @.loadProject()
|
promise = @.loadProject()
|
||||||
return promise.then (project) =>
|
return promise.then (project) =>
|
||||||
@.fillUsersAndRoles(project.members, project.roles)
|
@.fillUsersAndRoles(project.members, project.roles)
|
||||||
@q.all([@.loadWikiLinks(), @.loadWiki()]).then () =>
|
@q.all([@.loadWikiLinks(), @.loadWiki()]).then @.checkLinksPerms.bind(this)
|
||||||
|
|
||||||
|
checkLinksPerms: ->
|
||||||
|
if @scope.project.my_permissions.indexOf("modify_wiki_link") != -1 ||
|
||||||
|
(@scope.project.my_permissions.indexOf("view_wiki_links") != -1 && @scope.wikiLinks.length)
|
||||||
|
@scope.linksVisible = true
|
||||||
|
|
||||||
delete: ->
|
delete: ->
|
||||||
title = @translate.instant("WIKI.DELETE_LIGHTBOX_TITLE")
|
title = @translate.instant("WIKI.DELETE_LIGHTBOX_TITLE")
|
||||||
|
|
|
@ -3,14 +3,14 @@ doctype html
|
||||||
div.wrapper(ng-controller="WikiDetailController as ctrl",
|
div.wrapper(ng-controller="WikiDetailController as ctrl",
|
||||||
ng-init="section='wiki'")
|
ng-init="section='wiki'")
|
||||||
tg-project-menu
|
tg-project-menu
|
||||||
sidebar.menu-secondary.extrabar(tg-check-permission="view_wiki_links")
|
sidebar.menu-secondary.extrabar(ng-if="linksVisible")
|
||||||
section.wiki-nav(tg-wiki-nav, ng-model="wikiLinks")
|
section.wiki-nav(tg-wiki-nav, ng-model="wikiLinks")
|
||||||
section.main.wiki
|
section.main.wiki
|
||||||
header
|
header
|
||||||
h1
|
h1
|
||||||
span(tg-bo-bind="project.name")
|
span(tg-bo-bind="project.name")
|
||||||
span.green(translate="PROJECT.SECTION.WIKI")
|
span.green(translate="PROJECT.SECTION.WIKI")
|
||||||
|
|
||||||
|
|
||||||
div.summary.wiki-summary(tg-wiki-summary, ng-model="wiki", ng-if="wiki.id")
|
div.summary.wiki-summary(tg-wiki-summary, ng-model="wiki", ng-if="wiki.id")
|
||||||
h2.wiki-title(ng-bind='wikiTitle')
|
h2.wiki-title(ng-bind='wikiTitle')
|
||||||
|
|
Loading…
Reference in New Issue