in dashboard menu, replace _ with space
Costa Tsaousis (ktsaou) committed
Sep 3, 2016 at 17:35 UTC
90cba44a089786608137b3b0967418c4e746e205
1 file changed
+8
-19
web/index.html
+8
-19
@@ -2062,24 +2062,13 @@ function anyAttribute(obj, attr, key, def) {
2062
return def;
2063
}
2064
2065
-function anyAttributeTitle(obj, attr, key, def) {
2066
- if(typeof obj[key] !== 'undefined') {
2067
- if(typeof obj[key][attr] !== 'undefined')
2068
- return obj[key][attr];
2069
- }
2070
-
2071
- var r = def.replace(/_/g, ' ');
2072
-
2073
- return r;
2074
-}
2075
-
2065
function menuTitle(chart) {
2066
if(typeof chart.menu_pattern !== 'undefined') {
2078
- return anyAttributeTitle(menuData, 'title', chart.menu_pattern, chart.menu_pattern).toString()
2079
- + ' ' + chart.type.slice(-(chart.type.length - chart.menu_pattern.length - 1)).toString();
2067
+ return (anyAttribute(menuData, 'title', chart.menu_pattern, chart.menu_pattern).toString()
2068
+ + ' ' + chart.type.slice(-(chart.type.length - chart.menu_pattern.length - 1)).toString()).replace(/_/g, ' ');
2069
}
2070
2082
- return anyAttributeTitle(menuData, 'title', chart.menu, chart.menu);
2071
+ return (anyAttribute(menuData, 'title', chart.menu, chart.menu)).toString().replace(/_/g, ' ');
2072
}
2073
2074
function menuIcon(chart) {
@@ -2099,11 +2088,11 @@ function menuHeight(menu, relative) {
2088
2089
function submenuTitle(menu, submenu) {
2090
var key = menu + '.' + submenu;
2102
- var title = anyAttributeTitle(submenuData, 'title', key, submenu);
2103
- if(title.length > 30) {
2104
- var a = title.substring(0, 13);
2105
- var b = title.substring(title.length - 13, title.length);
2106
- return a + '...' + b;
2091
+ var title = anyAttribute(submenuData, 'title', key, submenu).toString().replace(/_/g, ' ');;
2092
+ if(title.length > 28) {
2093
+ var a = title.substring(0, 28);
2094
+ // var b = title.substring(title.length - 13, title.length);
2095
+ return a + '...'; // + b;
2096
}
2097
return title;
2098
}