mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Prettier display names for permissions
This commit is contained in:
parent
72f080e74d
commit
4fba6b0551
1 changed files with 22 additions and 3 deletions
|
@ -5,6 +5,18 @@
|
||||||
|
|
||||||
var PASSWORD_MIN_LENGTH = 4;
|
var PASSWORD_MIN_LENGTH = 4;
|
||||||
|
|
||||||
|
// A small utility to convert a string to title case
|
||||||
|
// e.g. "hAvE a NicE dAy" --> "Have A Nice Day"
|
||||||
|
// Savagely stolen from https://stackoverflow.com/a/196991
|
||||||
|
function toTitleCase(str) {
|
||||||
|
return str.replace(
|
||||||
|
/\w\S*/g,
|
||||||
|
function(txt) {
|
||||||
|
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Groups and permissions
|
* Groups and permissions
|
||||||
*
|
*
|
||||||
|
@ -116,8 +128,8 @@
|
||||||
data_groups.groups['all_users'].special = true;
|
data_groups.groups['all_users'].special = true;
|
||||||
data_groups.groups['visitors'].special = true;
|
data_groups.groups['visitors'].special = true;
|
||||||
|
|
||||||
// Data given to the view with 2 functions to display permission in
|
// Data given to the view with 2 functions to convert technical
|
||||||
// a better way
|
// permission id to display names
|
||||||
data = {
|
data = {
|
||||||
'groups':data_groups.groups,
|
'groups':data_groups.groups,
|
||||||
'displayPermission': function (text) {
|
'displayPermission': function (text) {
|
||||||
|
@ -126,6 +138,13 @@
|
||||||
if (text.indexOf('.') > -1)
|
if (text.indexOf('.') > -1)
|
||||||
text = text.replace('.', ' (') + ')';
|
text = text.replace('.', ' (') + ')';
|
||||||
|
|
||||||
|
if (text == "mail")
|
||||||
|
text = "E-mail";
|
||||||
|
else if (text == "xmpp")
|
||||||
|
text = "XMPP";
|
||||||
|
else
|
||||||
|
text = toTitleCase(text);
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
},
|
},
|
||||||
'displayUser': function (text) {
|
'displayUser': function (text) {
|
||||||
|
|
Loading…
Reference in a new issue