admin control features and admin dashboard
This commit is contained in:
1 parent
c630f13c57
commit
37910e410b
69 files changed
+4959
-400
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package dashboard
|
||||
|
||||
import "strings"
|
||||
|
||||
// splitList parses a textarea/hidden-input value into a clean list,
|
||||
// accepting entries separated by newlines and/or commas interchangeably
|
||||
// (different forms in this package use one or the other) and dropping
|
||||
// blank entries from stray whitespace.
|
||||
func splitList(raw string) []string {
|
||||
fields := strings.FieldsFunc(raw, func(r rune) bool {
|
||||
return r == '\n' || r == '\r' || r == ','
|
||||
})
|
||||
out := make([]string, 0, len(fields))
|
||||
for _, f := range fields {
|
||||
f = strings.TrimSpace(f)
|
||||
if f != "" {
|
||||
out = append(out, f)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in new issue
Block a user