[backport] hide wiki links when the wiki doesn't have links

stable
Juanfran 2016-01-12 09:50:03 +01:00
parent d53675c9d4
commit ca0e5936ce
2 changed files with 12 additions and 6 deletions

View File

@ -57,6 +57,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
@scope.wikiSlug = @params.slug
@scope.wikiTitle = @scope.wikiSlug
@scope.sectionName = "Wiki"
@scope.linksVisible = false
promise = @.loadInitialData()
@ -72,10 +73,11 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
projectName: @scope.project.name
})
description = @translate.instant("WIKI.PAGE_DESCRIPTION", {
wikiPageContent: angular.element(@scope.wiki.html or "").text()
totalEditions: @scope.wiki.editions or 0
lastModifiedDate: moment(@scope.wiki.modified_date).format(@translate.instant("WIKI.DATETIME"))
wikiPageContent: angular.element(@scope.wiki?.html or "").text()
totalEditions: @scope.wiki?.editions or 0
lastModifiedDate: moment(@scope.wiki?.modified_date).format(@translate.instant("WIKI.DATETIME"))
})
@appMetaService.setAll(title, description)
loadProject: ->
@ -119,8 +121,12 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
promise = @.loadProject()
return promise.then (project) =>
@.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: ->
title = @translate.instant("WIKI.DELETE_LIGHTBOX_TITLE")

View File

@ -3,7 +3,7 @@ doctype html
div.wrapper(ng-controller="WikiDetailController as ctrl",
ng-init="section='wiki'")
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.main.wiki
header