From 657a63f746e85165d3a97d99013ea339d354daa3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Thu, 15 Oct 2015 07:47:22 +0200 Subject: [PATCH] [Backport] Issue 2731: Using utf-8 chars in wiki titles --- app/coffee/modules/wiki/main.coffee | 8 +++++--- app/coffee/modules/wiki/nav.coffee | 4 +--- app/partials/wiki/wiki.jade | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/coffee/modules/wiki/main.coffee b/app/coffee/modules/wiki/main.coffee index 9c1e7649..847b342d 100644 --- a/app/coffee/modules/wiki/main.coffee +++ b/app/coffee/modules/wiki/main.coffee @@ -24,7 +24,6 @@ taiga = @.taiga mixOf = @.taiga.mixOf groupBy = @.taiga.groupBy bindOnce = @.taiga.bindOnce -unslugify = @.taiga.unslugify debounce = @.taiga.debounce module = angular.module("taigaWiki") @@ -56,6 +55,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin) @filter, @log, @appMetaService, @navUrls, @analytics, @translate) -> @scope.projectSlug = @params.pslug @scope.wikiSlug = @params.slug + @scope.wikiTitle = @scope.wikiSlug @scope.sectionName = "Wiki" promise = @.loadInitialData() @@ -68,7 +68,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin) _setMeta: -> title = @translate.instant("WIKI.PAGE_TITLE", { - wikiPageName: unslugify(@scope.wiki.slug) + wikiPageName: @scope.wikiTitle projectName: @scope.project.name }) description = @translate.instant("WIKI.PAGE_DESCRIPTION", { @@ -113,6 +113,8 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin) loadWikiLinks: -> return @rs.wiki.listLinks(@scope.projectId).then (wikiLinks) => @scope.wikiLinks = wikiLinks + selectedWikiLink = _.find(wikiLinks, {href: @scope.wikiSlug}) + @scope.wikiTitle = selectedWikiLink.title if selectedWikiLink? loadInitialData: -> promise = @.loadProject() @@ -123,7 +125,7 @@ class WikiDetailController extends mixOf(taiga.Controller, taiga.PageMixin) delete: -> title = @translate.instant("WIKI.DELETE_LIGHTBOX_TITLE") - message = unslugify(@scope.wiki.slug) + message = @scope.wikiTitle @confirm.askOnDelete(title, message).then (finish) => onSuccess = => diff --git a/app/coffee/modules/wiki/nav.coffee b/app/coffee/modules/wiki/nav.coffee index e0aa2c1b..15d46dd0 100644 --- a/app/coffee/modules/wiki/nav.coffee +++ b/app/coffee/modules/wiki/nav.coffee @@ -24,8 +24,6 @@ taiga = @.taiga mixOf = @.taiga.mixOf groupBy = @.taiga.groupBy bindOnce = @.taiga.bindOnce -slugify = @.taiga.slugify -unslugify = @.taiga.slugify module = angular.module("taigaWiki") @@ -108,7 +106,7 @@ WikiNavDirective = ($tgrepo, $log, $location, $confirm, $navUrls, $analytics, $l .target($el.find(".new")) .start() - promise = $tgrepo.create("wiki-links", {project: $scope.projectId, title: newLink, href: slugify(newLink)}) + promise = $tgrepo.create("wiki-links", {project: $scope.projectId, title: newLink}) promise.then -> $analytics.trackEvent("wikilink", "create", "create wiki link", 1) loadPromise = $ctrl.loadWikiLinks() diff --git a/app/partials/wiki/wiki.jade b/app/partials/wiki/wiki.jade index 08dbe928..def34e10 100644 --- a/app/partials/wiki/wiki.jade +++ b/app/partials/wiki/wiki.jade @@ -10,7 +10,7 @@ div.wrapper(ng-controller="WikiDetailController as ctrl", h1 span(tg-bo-bind="project.name") span.green(translate="PROJECT.SECTION.WIKI") - span.wiki-title(tg-bo-bind='wikiSlug|unslugify') + span.wiki-title(ng-bind='wikiTitle') div.summary.wiki-summary(tg-wiki-summary, ng-model="wiki", ng-if="wiki.id") section.wiki-content(tg-editable-wiki-content, ng-model="wiki")