hide wiki links when the wiki doesn't have links

stable
Juanfran 2016-01-12 09:50:03 +01:00
parent 5df43360d3
commit 6915a99346
2 changed files with 12 additions and 6 deletions

View File

@ -60,6 +60,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()
@ -75,10 +76,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: ->
@ -122,8 +124,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,14 +3,14 @@ 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
h1
span(tg-bo-bind="project.name")
span.green(translate="PROJECT.SECTION.WIKI")
div.summary.wiki-summary(tg-wiki-summary, ng-model="wiki", ng-if="wiki.id")
h2.wiki-title(ng-bind='wikiTitle')