Skip to content

Commit

Permalink
#518 - Fixed config page, selects now correctly show current stored v…
Browse files Browse the repository at this point in the history
…alues
  • Loading branch information
MFlyer committed Jul 9, 2016
1 parent 3e3c075 commit 226b44e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
Expand Up @@ -31,8 +31,7 @@
<label class="col-sm-4 control-label" for="shelltype">Shell connection service<span class="required"> *</span></label>
<div class="col-sm-4">
<select class="form-control" id="shelltype" name="shelltype">
<option value="LOGIN">LOGIN</option>
<option value="SSH">SSH</option>
{{display_shelltype_options}}
</select>
</div>
</div>
Expand All @@ -41,8 +40,7 @@
<label class="col-sm-4 control-label" for="css">Shell color scheme<span class="required"> *</span></label>
<div class="col-sm-4">
<select class="form-control" id="css" name="css">
<option value="white-on-black">White on Black</option>
<option value="black-on-white">Black on White</option>
{{display_shellstyle_options}}
</select>
</div>
</div>
Expand Down
Expand Up @@ -380,6 +380,38 @@ To alert on temparature changes: <br> <strong>DEVICESCAN -W 4,35,40</strong> <br
},

initHandlebarHelpers: function(){

//ShellInABox
Handlebars.registerHelper('display_shelltype_options', function(){
var html = '',
_this = this;
var avail_shells = ['LOGIN', 'SSH'];
_.each(avail_shells, function(shell, index) {
if (shell == _this.config.shelltype) {
html += '<option value="' + shell + '" selected="selected">';
html += shell + '</option>';
} else {
html += '<option value="' + shell + '">' + shell + '</option>';
}
});
return new Handlebars.SafeString(html);
});

Handlebars.registerHelper('display_shellstyle_options', function(){
var html = '',
_this = this;
var avail_styles = {'white-on-black': 'White on Black', 'black-on-white': 'Black on White'};
_.each(avail_styles, function(key, val) {
if (val == _this.config.css) {
html += '<option value="' + val + '" selected="selected">';
html += key + '</option>';
} else {
html += '<option value="' + val + '">' + key + '</option>';
}
});
return new Handlebars.SafeString(html);
});

//NUT-UPS
Handlebars.registerHelper('display_nutMode_options', function(){
var html = '',
Expand Down

0 comments on commit 226b44e

Please sign in to comment.