Skip to content

Node.js based forum software built for the modern web

motd tweaks in admin panel

Julian Lam1aa4a440a099
diff --git a/public/templates/admin/footer.tpl b/public/templates/admin/footer.tpl
index 30f1451590..6add320169 100644
--- a/public/templates/admin/footer.tpl
+++ b/public/templates/admin/footer.tpl
@@ -36,7 +36,7 @@
break;
case 'checkbox':
- fields[x].checked = nodebb_admin.config[key] ? true : false;
+ fields[x].checked = nodebb_admin.config[key] === '1' ? true : false;
break;
}
}
diff --git a/public/templates/admin/motd.tpl b/public/templates/admin/motd.tpl
index cae432a050..04b5a0f9b6 100644
--- a/public/templates/admin/motd.tpl
+++ b/public/templates/admin/motd.tpl
@@ -10,9 +10,12 @@
You can enter either full HTML or Markdown text.
</p>
<textarea placeholder="Welcome to NodeBB!" data-field="motd" rows="10"></textarea>
+ <form class="form-inline">
+ <label class="checkbox" for="show_motd"><input type="checkbox" id="show_motd" data-field="show_motd" /> Show the Message of the Day</label>
+ </form>
</div>
-<button class="btn btn-large btn-primary" id="save">Save</button>
+<button class="btn btn-large btn-primary" id="save" checked>Save</button>
<script>
nodebb_admin.prepare();
diff --git a/src/webserver.js b/src/webserver.js
index 1c230e9c97..fcf40a8b43 100644
--- a/src/webserver.js
+++ b/src/webserver.js
@@ -138,7 +138,7 @@ var express = require('express'),
break;
case 'home' :
categories.getAllCategories(function(data) {
- data.motd_class = (config.show_motd || config.show_motd === undefined) ? '' : 'none';
+ data.motd_class = (config.show_motd === '1' || config.show_motd === undefined) ? '' : 'none';
data.motd = marked(config.motd || "# NodeBB v0.1\nWelcome to NodeBB, the discussion platform of the future.\n\n<a target=\"_blank\" href=\"http://www.nodebb.org\" class=\"btn btn-large\"><i class=\"icon-comment\"></i> Get NodeBB</a> <a target=\"_blank\" href=\"https://github.com/designcreateplay/NodeBB\" class=\"btn btn-large\"><i class=\"icon-github-alt\"></i> Fork us on Github</a> <a target=\"_blank\" href=\"https://twitter.com/dcplabs\" class=\"btn btn-large\"><i class=\"icon-twitter\"></i> @dcplabs</a>");
res.send(JSON.stringify(data));
}, uid);