Skip to content

Commit

Permalink
fixed configuration editing bug on Admin page which prevented changes…
Browse files Browse the repository at this point in the history
… to boolean config properties
  • Loading branch information
albogdano committed Jan 7, 2025
1 parent 40f7056 commit fb5e690
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ public String saveConfig(@RequestParam String key, @RequestParam(defaultValue =
if (utils.isAdmin(authUser) && CONF.configEditingEnabled()) {
if ("on".equals(value)) {
value = "true";
} else if ("true".equals(req.getParameter("isbool")) && StringUtils.isBlank(value)) {
value = "false";
}
if (value != null && !StringUtils.isBlank(value)) {
System.setProperty(key, value);
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/templates/admin.vm
Original file line number Diff line number Diff line change
Expand Up @@ -367,16 +367,18 @@
<div class="col s12 m10">
#set($pk = $pkey.substring(7))
#set($propval = $configMap.getConfigValue($pk, ""))
#if(!$propval || $propval.isEmpty())
#set($isbool = $configMetadata.get($key).get($pkey).type == "Boolean")
#if(!$isbool && (!$propval || $propval.isEmpty()))
#set($propval = $configMetadata.get($key).get($pkey).defaultValue)
#end
<input name="key" type="hidden" value="$pkey">

#if($configMetadata.get($key).get($pkey).type == "Boolean")
#if($isbool)
<label>
<input name="value" type="checkbox" #if($propval == "true")checked="checked"#end class="filled-in">
<span data-on="$!lang.get('on')" data-off="$!lang.get('off')">#if($propval == "true")$!lang.get('on')#else$!lang.get('off')#end</span>
</label>
<input name="isbool" type="hidden" value="true">
#else
<div class="input-field mbn">
#if(($pk.contains("secret") || $pk.contains("password") || $pk.contains("privatekey") || $pk.contains("pass")) &&
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/macro.vm
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<div class="col s12 m6 l3 spacebox">
<div class="card-panel z-depth-0 lightborder">
<div class="row mbn viewbox valign-wrapper">
<div class="col s12 m8 columns ">
<div class="col s12 m11 columns ">
#if($isDefaultSpacePublic && $scooldUtils.isDefaultSpace($space.name))
<i class="fa fa-unlock green-text tooltipped" data-tooltip="This space is public"></i>
#else
Expand All @@ -112,7 +112,7 @@
#end
<a href="$questionslink/space/$!space.id" class="space-name-box" title="$!{spaceName}">$!{spaceName}</a>
</div>
<div class="col s12 m4 columns right-align">
<div class="col s12 m1 columns right-align">
#if(!$scooldUtils.isDefaultSpace($space.name))
<a href="#" title="$!lang.get('edit')" class="editlink"><i class="fa fa-pencil-square orange-text"></i></a>
#end
Expand Down

0 comments on commit fb5e690

Please sign in to comment.