Skip to content

Commit 5384838

Browse files
authored
Merge pull request #110 from winadam/master
Fixes Config Tab Boolean Settings
2 parents d412eaa + 4fc2363 commit 5384838

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

ui/App/components/ConfigContent.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ import React from 'react';
22
import {IndexLink} from 'react-router';
33
import Settings from './Config/Settings.jsx';
44

5+
//https://stackoverflow.com/a/1414175
6+
function stringToBoolean(string){
7+
switch(string.toLowerCase().trim()){
8+
case "true": case "yes": case "1": return true;
9+
case "false": case "no": case "0": case null: return false;
10+
default: return Boolean(string);
11+
}
12+
}
13+
514
class ConfigContent extends React.Component {
615
constructor(props) {
716
super(props);
@@ -42,7 +51,7 @@ class ConfigContent extends React.Component {
4251
this.setState({serverSettings: change});
4352
return;
4453
}
45-
fieldValue = Boolean(e.target.value)
54+
fieldValue = stringToBoolean(e.target.value)
4655
} else if (e.target.id === "admins" || e.target.id === "tags") {
4756
// Split settings values that are stored as arrays
4857
fieldValue = e.target.value.split(",")

0 commit comments

Comments
 (0)