Node.js based forum software built for the modern web
added motd to admin panel and added colour and transitions to alt-login icons
Julian Lam1760cf1e893b
diff --git a/public/css/admin.less b/public/css/admin.lessindex a46acef14c..946a2233af 100644--- a/public/css/admin.less+++ b/public/css/admin.less@@ -73,4 +73,8 @@background-color: rgba(128, 128, 128, 0.2);}}+}++.motd textarea {+ width: 100%;}\ No newline at end of filediff --git a/public/css/style.less b/public/css/style.lessindex 83f1461dea..ed91e3ba98 100644--- a/public/css/style.less+++ b/public/css/style.less@@ -546,6 +546,26 @@ footer.footer {&.active {.inline-block;}++ i {+ -webkit-transition: color 100ms linear;+ -moz-transition: color 100ms linear;+ -ms-transition: color 100ms linear;+ -o-transition: color 100ms linear;+ transition: color 100ms linear;++ &.icon-twitter-sign:hover {+ color: #4099FF;+ }++ &.icon-facebook-sign:hover {+ color: #3b5999;+ }++ &.icon-google-plus-sign:hover {+ color: #d34836;+ }+ }}}diff --git a/public/templates/admin/footer.tpl b/public/templates/admin/footer.tplindex 30c93dfa27..30f1451590 100644--- a/public/templates/admin/footer.tpl+++ b/public/templates/admin/footer.tpl@@ -26,46 +26,23 @@for(x=0;x<numFields;x++) {key = fields[x].getAttribute('data-field');inputType = fields[x].getAttribute('type');- if (nodebb_admin.config[key]) {- switch(inputType) {- case 'text':- case 'textarea':- case 'number':- fields[x].value = nodebb_admin.config[key];- break;-- case 'checkbox':- fields[x].checked = nodebb_admin.config[key] ? true : false;- break;- }- } /*else {- // Save defaults, if they're not found in the config- var defaultFields = [- 'use_port', 'port', 'upload_url', 'mailer:host',- 'mailer:port', 'privileges:manage_content',- 'privileges:manage_topic'- ],- defaultVal;- if (defaultFields.indexOf(key) !== -1) {- console.log('saving default value: ', key);+ if (fields[x].nodeName === 'INPUT') {+ if (nodebb_admin.config[key]) {switch(inputType) {case 'text':case 'textarea':case 'number':- defaultVal = fields[x].value;+ fields[x].value = nodebb_admin.config[key];break;case 'checkbox':- defaultVal = fields[x].checked ? '1' : '0';+ fields[x].checked = nodebb_admin.config[key] ? true : false;break;}- socket.emit('api:config.set', {- key: key,- value: defaultVal- });- nodebb_admin.config[key] = defaultVal;}- }*/+ } else if (fields[x].nodeName === 'TEXTAREA') {+ if (nodebb_admin.config[key]) fields[x].value = nodebb_admin.config[key];+ }}saveBtn.addEventListener('click', function(e) {@@ -74,18 +51,22 @@for(x=0;x<numFields;x++) {key = fields[x].getAttribute('data-field');- inputType = fields[x].getAttribute('type');- switch(inputType) {- case 'text':- case 'textarea':- case 'number':- value = fields[x].value;- break;+ if (fields[x].nodeName === 'INPUT') {+ inputType = fields[x].getAttribute('type');+ switch(inputType) {+ case 'text':+ case 'number':+ value = fields[x].value;+ break;- case 'checkbox':- value = fields[x].checked ? '1' : '0';- break;+ case 'checkbox':+ value = fields[x].checked ? '1' : '0';+ break;+ }+ } else if (fields[x].nodeName === 'TEXTAREA') {+ value = fields[x].value;}+socket.emit('api:config.set', { key: key, value: value });}});diff --git a/public/templates/admin/header.tpl b/public/templates/admin/header.tplindex 495ff654c5..f73d6a2c5c 100644--- a/public/templates/admin/header.tpl+++ b/public/templates/admin/header.tpl@@ -60,6 +60,7 @@<li class=''><a href='/admin/themes'><i class='icon-th'></i> Themes</a></li><li class=''><a href='/admin/settings'><i class='icon-cogs'></i> Settings</a></li><li class=''><a href='/admin/redis'><i class='icon-hdd'></i> Redis</a></li>+ <li class=''><a href="/admin/motd"><i class="icon-comment"></i> MOTD</a></li><li class="nav-header">Social Authentication</li><li class=''><a href='/admin/twitter'><i class='icon-twitter'></i>Twitter</a></li>diff --git a/public/templates/admin/motd.tpl b/public/templates/admin/motd.tplnew file mode 100644index 0000000000..cae432a050--- /dev/null+++ b/public/templates/admin/motd.tpl@@ -0,0 +1,19 @@++<h1>MOTD</h1>++<div class="alert motd">+ <p>+ The <strong>Message of the Day</strong> (MOTD) is typically a message shown to users when they first log into a forum or chat room.+ In NodeBB, the MOTD is present at the top of the forum homepage, and can be customized much like a header.+ </p>+ <p>+ You can enter either full HTML or Markdown text.+ </p>+ <textarea placeholder="Welcome to NodeBB!" data-field="motd" rows="10"></textarea>+</div>++<button class="btn btn-large btn-primary" id="save">Save</button>++<script>+ nodebb_admin.prepare();+</script>\ No newline at end of filediff --git a/public/templates/admin/settings.tpl b/public/templates/admin/settings.tplindex e128f80de1..c2ecb195eb 100644--- a/public/templates/admin/settings.tpl+++ b/public/templates/admin/settings.tpl@@ -15,10 +15,31 @@<form><h3>Email Settings</h3><div class="alert alert-notify">- <strong>Email Address</strong><br /> <input type="text" class="" value="info@localhost"><br />+ <div>+ <p>+ <strong>Email Address</strong><br />+ The following email address refers to the email that the recipient will see in the "From" and "Reply To" fields.+ </p>+ <input type="text" class="input-large" data-field="email:from" placeholder="[email protected]" />+ </div>+ <div>+ <p>+ <strong>SMTP Server Host</strong><br />+ (Default: <em>127.0.0.1</em>)+ </p>+ <input type="text" class="input-medium" data-field="email:smtp:host" placeholder="127.0.0.1" />+ </div>+ <div>+ <p>+ <strong>SMTP Server Port</strong>+ </p>+ <input type="text" class="input-mini" data-field="email:smtp:port" placeholder="25" />+ </div></div></form>+<button class="btn btn-large btn-primary" id="save">Save</button>-<button class="btn btn-large btn-primary" type="submit">Save</button>-<button class="btn btn-large" type="submit" disabled>Delete</button>\ No newline at end of file+<script>+ nodebb_admin.prepare();+</script>\ No newline at end of filediff --git a/public/templates/config.json b/public/templates/config.jsonindex 551606ba59..d562f3172e 100644--- a/public/templates/config.json+++ b/public/templates/config.json@@ -10,6 +10,7 @@"admin/twitter[^]*": "admin/twitter","admin/facebook[^]*": "admin/facebook","admin/gplus[^]*": "admin/gplus",+ "admin/motd/?$": "admin/motd","install/?$": "install/mail","install/mail/?": "install/mail","install/social/?": "install/social",diff --git a/src/routes/admin.js b/src/routes/admin.jsindex 14a73e36ef..f2c40226ce 100644--- a/src/routes/admin.js+++ b/src/routes/admin.js@@ -15,7 +15,7 @@ var user = require('./../user.js'),Admin.create_routes = function(app) {(function() {- var routes = ['categories', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus', 'redis'];+ var routes = ['categories', 'users', 'topics', 'settings', 'themes', 'twitter', 'facebook', 'gplus', 'redis', 'motd'];for (var i=0, ii=routes.length; i<ii; i++) {(function(route) {