added icons to all h1s in admin panel

languages tab in ACP
each language now also has a "language.json"
This commit is contained in:
Julian Lam
2014-01-09 13:29:41 -05:00
parent 119079ace5
commit cd6af45afb
26 changed files with 128 additions and 33 deletions

View File

@@ -0,0 +1,4 @@
{
"name": "German",
"code": "de"
}

View File

@@ -0,0 +1,4 @@
{
"name": "English",
"code": "en"
}

View File

@@ -0,0 +1,4 @@
{
"name": "Spanish",
"code": "es"
}

View File

@@ -0,0 +1,4 @@
{
"name": "French",
"code": "fr"
}

View File

@@ -0,0 +1,5 @@
define(['forum/admin/settings'], function(Settings) {
jQuery('document').ready(function() {
Settings.prepare();
});
});

View File

@@ -8,8 +8,7 @@
* 1. language en is hardcoded while system is developed. to switch language packs for now please edit DEFAULT_LANGUAGE
* b. need to write fallback system to default language if keys are missing (is this even necessary?)
* 2. recursion needed when parsing language keys (ex. topics:modal.delete.title), right now json is all one level deep
* 3. server side settings for default language
* 4. user side settings for preferred language
* 3. user side settings for preferred language
*
*/

View File

@@ -1,6 +1,6 @@
<div class="categories">
<h1>Categories</h1>
<h1><i class="fa fa-folder"></i> Categories</h1>
<hr />
<ul class="nav nav-pills">

View File

@@ -1,7 +1,7 @@
<!-- IF redis -->
<h1>Redis</h1>
<h1><i class="fa fa-hdd-o"></i> Redis</h1>
<hr />
<div id="admin-redis-info">
<span>Redis Version</span> <span class="text-right">{redis_version}</span><br/>
@@ -32,7 +32,7 @@
<!-- ENDIF redis -->
<!-- IF mongo -->
<h1>Mongo</h1>
<h1><i class="fa fa-hdd-o"></i> Mongo</h1>
<hr />
<div id="admin-redis-info">

View File

@@ -1,4 +1,4 @@
<h1>Events</h1>
<h1><i class="fa fa-calendar-o"></i> Events</h1>
<pre>
{eventdata}

View File

@@ -1,4 +1,4 @@
<h1>Facebook Social Authentication</h1>
<h1><i class="fa fa-facebook-square"></i> Facebook Social Authentication</h1>
<hr />
<form>

View File

@@ -1,4 +1,4 @@
<h1>Google Accounts Social Authentication</h1>
<h1><i class="fa fa-google-plus-square"></i> Google Accounts Social Authentication</h1>
<hr />
<form>

View File

@@ -1,4 +1,4 @@
<h1>Groups</h1>
<h1><i class="fa fa-group"></i> Groups</h1>
<hr />
@@ -7,7 +7,7 @@
<!-- BEGIN groups -->
<li data-gid="{groups.gid}">
<div class="row">
<div class="col-lg-8">
<div class="col-lg-8">
<h2>{groups.name}</h2>
<p>{groups.description}</p>
<div class="btn-group">

View File

@@ -102,6 +102,7 @@
<li><a href="{relative_path}/admin/topics"><i class="fa fa-fw fa-book"></i> Topics</a></li>
<li><a href="{relative_path}/admin/themes"><i class="fa fa-fw fa-th"></i> Themes</a></li>
<li><a href="{relative_path}/admin/plugins"><i class="fa fa-fw fa-code-fork"></i> Plugins</a></li>
<li><a href="{relative_path}/admin/languages"><i class="fa fa-fw fa-comments-o"></i> Languages</a></li>
<li><a href="{relative_path}/admin/settings"><i class="fa fa-fw fa-cogs"></i> Settings</a></li>
<li><a href="{relative_path}/admin/database"><i class="fa fa-fw fa-hdd-o"></i> Database</a></li>
<li><a href="{relative_path}/admin/logger"><i class="fa fa-fw fa-th"></i> Logger</a></li>

View File

@@ -0,0 +1,24 @@
<div class="languages">
<h1><i class="fa fa-comments-o"></i> Languages</h1>
<hr />
<p>
The following setting(s) determine the language settings for your NodeBB.
The default language determines the language settings for all users who
are visiting your NodeBB. Keep in mind that individual users may decide
to switch languages for their own accounts.
</p>
<form class="row">
<div class="form-group col-sm-6">
<label for="defaultLang">Default Language</label>
<select data-field="defaultLang" class="form-control">
<!-- BEGIN languages -->
<option value="{languages.code}">{languages.name}</option>
<!-- END languages -->
</select>
</div>
</form>
</div>
<button class="btn btn-lg btn-primary" id="save">Save</button>

View File

@@ -1,4 +1,4 @@
<h1>Logger</h1>
<h1><i class="fa fa-th"></i> Logger</h1>
<hr />
<h3>Logger Settings</h3>

View File

@@ -1,5 +1,4 @@
<h1>MOTD</h1>
<h1><i class="fa fa-comment"></i> MOTD</h1>
<hr />
<div class="alert alert-warning motd">
<p>

View File

@@ -1,4 +1,4 @@
<h1>Plugins</h1>
<h1><i class="fa fa-code-fork"></i> Plugins</h1>
<ul class="plugins">
<!-- BEGIN plugins -->

View File

@@ -1,4 +1,4 @@
<h1>Settings</h1>
<h1><i class="fa fa-cogs"></i> Settings</h1>
<hr />
<h3>General Settings</h3>
@@ -128,7 +128,7 @@
<form>
<h3>Web Crawler Settings</h3>
<div class="alert alert-warning">
<strong>Custom Robots.txt <small>Leave blank for default</small></strong><br />
<strong>Custom Robots.txt <small>Leave blank for default</small></strong><br />
<textarea class="form-control" data-field="robots.txt"></textarea>
</div>
</form>

View File

@@ -1,4 +1,4 @@
<h1>Themes</h1>
<h1><i class="fa fa-th"></i> Themes</h1>
<hr />
<h3>Custom Themes</h3>

View File

@@ -1,4 +1,4 @@
<h1>Topics</h1>
<h1><i class="fa fa-book"></i> Topics</h1>
<hr />

View File

@@ -1,4 +1,4 @@
<h1>Twitter Social Authentication</h1>
<h1><i class="fa fa-twitter-square"></i> Twitter Social Authentication</h1>
<hr />
<form>

View File

@@ -1,4 +1,4 @@
<h1>Users</h1>
<h1><i class="fa fa-user"></i> Users</h1>
<button id="createUser" class="btn btn-primary">Create User</button>
<a target="_blank" href="/admin/users/csv" class="btn btn-primary">Download CSV</a>

View File

@@ -9,6 +9,7 @@
"^admin/index.*": "admin/index",
"^admin/themes.*": "admin/themes",
"^admin/plugins/?$": "admin/plugins",
"^admin/languages/?$": "admin/languages",
"^admin/settings.*": "admin/settings",
"^admin/twitter.*": "admin/twitter",
"^admin/facebook.*": "admin/facebook",

51
src/languages.js Normal file
View File

@@ -0,0 +1,51 @@
var fs = require('fs'),
path = require('path'),
async = require('async'),
Languages = {};
Languages.list = function(callback) {
var languagesPath = path.join(__dirname, '../public/language'),
languages = [];
fs.readdir(languagesPath, function(err, files) {
async.each(files, function(folder, next) {
fs.stat(path.join(languagesPath, folder), function(err, stat) {
if (!err) {
if (stat.isDirectory()) {
var configPath = path.join(languagesPath, folder, 'language.json');
fs.exists(configPath, function(exists) {
if (exists) {
fs.readFile(configPath, function(err, stream) {
languages.push(JSON.parse(stream.toString()));
next();
});
} else {
next();
}
});
} else {
next();
}
} else {
next();
}
});
}, function(err) {
// Float "en" to the top
languages = languages.sort(function(a, b) {
if (a.code === 'en') {
return -1;
} else if (b.code === 'en') {
return 1;
} else {
return 0;
}
});
callback(err, languages);
});
});
};
module.exports = Languages;

View File

@@ -11,11 +11,10 @@ var nconf = require('nconf'),
categories = require('./../categories'),
meta = require('../meta'),
plugins = require('../plugins'),
Languages = require('../languages'),
events = require('./../events'),
utils = require('./../../public/src/utils.js');
(function (Admin) {
Admin.isAdmin = function (req, res, next) {
user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) {
@@ -57,9 +56,9 @@ var nconf = require('nconf'),
(function () {
var routes = [
'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes',
'twitter', 'facebook', 'gplus', 'database', 'events', 'motd', 'groups', 'plugins', 'logger',
'users/latest', 'users/sort-posts', 'users/sort-reputation',
'users/search'
'twitter', 'facebook', 'gplus', 'database', 'events', 'motd', 'groups', 'plugins',
'languages', 'logger',
'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/search'
];
for (var i = 0, ii = routes.length; i < ii; i++) {
@@ -384,6 +383,14 @@ var nconf = require('nconf'),
});
});
app.get('/languages', function(req, res) {
Languages.list(function(err, languages) {
res.send(200, {
languages: languages
});
});
});
app.get('/settings', function (req, res) {
res.json(200, {});
});

View File

@@ -80,14 +80,6 @@ var DebugRoute = function(app) {
});
app.get('/test', function(req, res) {
var Emailer = require('../emailer');
Emailer.send('welcome', 1, {
username: 'test',
subject: 'this is a subject',
site_title: 'derp',
confirm_link: 'linkylink'
});
res.send();
});
});