Support for unicode / international characters in dashboard title (improved slugify), Fixes #1734, Fixes #827

This commit is contained in:
Torkel Ödegaard
2015-04-15 12:36:02 +02:00
parent 6ba8854854
commit 942e8fdba8
28 changed files with 48228 additions and 5 deletions
+3 -4
View File
@@ -2,9 +2,10 @@ package models
import (
"errors"
"regexp"
"strings"
"time"
"github.com/gosimple/slug"
)
// Typed errors
@@ -82,9 +83,7 @@ func (dash *Dashboard) GetString(prop string) string {
// UpdateSlug updates the slug
func (dash *Dashboard) UpdateSlug() {
title := strings.ToLower(dash.Data["title"].(string))
re := regexp.MustCompile("[^\\w ]+")
re2 := regexp.MustCompile("\\s")
dash.Slug = re2.ReplaceAllString(re.ReplaceAllString(title, ""), "-")
dash.Slug = slug.Make(title)
}
//