Support for unicode / international characters in dashboard title (improved slugify), Fixes #1734, Fixes #827
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user