mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 11:05:54 +01:00 
			
		
		
		
	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:
		
							
								
								
									
										4
									
								
								public/language/de/language.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								public/language/de/language.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | { | ||||||
|  | 	"name": "German", | ||||||
|  | 	"code": "de" | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								public/language/en/language.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								public/language/en/language.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | { | ||||||
|  | 	"name": "English", | ||||||
|  | 	"code": "en" | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								public/language/es/language.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								public/language/es/language.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | { | ||||||
|  | 	"name": "Spanish", | ||||||
|  | 	"code": "es" | ||||||
|  | } | ||||||
							
								
								
									
										4
									
								
								public/language/fr/language.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								public/language/fr/language.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,4 @@ | |||||||
|  | { | ||||||
|  | 	"name": "French", | ||||||
|  | 	"code": "fr" | ||||||
|  | } | ||||||
							
								
								
									
										5
									
								
								public/src/forum/admin/languages.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								public/src/forum/admin/languages.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | define(['forum/admin/settings'], function(Settings) { | ||||||
|  | 	jQuery('document').ready(function() { | ||||||
|  | 		Settings.prepare(); | ||||||
|  | 	}); | ||||||
|  | }); | ||||||
| @@ -8,8 +8,7 @@ | |||||||
| 	 * 1. language en is hardcoded while system is developed. to switch language packs for now please edit DEFAULT_LANGUAGE | 	 * 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?) | 	 *     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 | 	 * 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 | 	 * 3. user side settings for preferred language | ||||||
| 	 * 4. user side settings for preferred language |  | ||||||
| 	 * | 	 * | ||||||
| 	 */ | 	 */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
|  |  | ||||||
| <div class="categories"> | <div class="categories"> | ||||||
| 	<h1>Categories</h1> | 	<h1><i class="fa fa-folder"></i> Categories</h1> | ||||||
| 	<hr /> | 	<hr /> | ||||||
|  |  | ||||||
| 	<ul class="nav nav-pills"> | 	<ul class="nav nav-pills"> | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| <!-- IF redis --> | <!-- IF redis --> | ||||||
| <h1>Redis</h1> | <h1><i class="fa fa-hdd-o"></i> Redis</h1> | ||||||
| <hr /> | <hr /> | ||||||
| <div id="admin-redis-info"> | <div id="admin-redis-info"> | ||||||
| 	<span>Redis Version</span> <span class="text-right">{redis_version}</span><br/> | 	<span>Redis Version</span> <span class="text-right">{redis_version}</span><br/> | ||||||
| @@ -32,7 +32,7 @@ | |||||||
| <!-- ENDIF redis --> | <!-- ENDIF redis --> | ||||||
|  |  | ||||||
| <!-- IF mongo --> | <!-- IF mongo --> | ||||||
| <h1>Mongo</h1> | <h1><i class="fa fa-hdd-o"></i> Mongo</h1> | ||||||
| <hr /> | <hr /> | ||||||
| <div id="admin-redis-info"> | <div id="admin-redis-info"> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Events</h1> | <h1><i class="fa fa-calendar-o"></i> Events</h1> | ||||||
|  |  | ||||||
| <pre> | <pre> | ||||||
| {eventdata} | {eventdata} | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Facebook Social Authentication</h1> | <h1><i class="fa fa-facebook-square"></i> Facebook Social Authentication</h1> | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
| <form> | <form> | ||||||
|   | |||||||
| @@ -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 /> | <hr /> | ||||||
|  |  | ||||||
| <form> | <form> | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Groups</h1> | <h1><i class="fa fa-group"></i> Groups</h1> | ||||||
|  |  | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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/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/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/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/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/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> | 						<li><a href="{relative_path}/admin/logger"><i class="fa fa-fw fa-th"></i> Logger</a></li> | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								public/templates/admin/languages.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								public/templates/admin/languages.tpl
									
									
									
									
									
										Normal 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> | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Logger</h1> | <h1><i class="fa fa-th"></i> Logger</h1> | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
| <h3>Logger Settings</h3> | <h3>Logger Settings</h3> | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
|  | <h1><i class="fa fa-comment"></i> MOTD</h1> | ||||||
| <h1>MOTD</h1> |  | ||||||
| <hr /> | <hr /> | ||||||
| <div class="alert alert-warning motd"> | <div class="alert alert-warning motd"> | ||||||
| 	<p> | 	<p> | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Plugins</h1> | <h1><i class="fa fa-code-fork"></i> Plugins</h1> | ||||||
|  |  | ||||||
| <ul class="plugins"> | <ul class="plugins"> | ||||||
| 	<!-- BEGIN plugins --> | 	<!-- BEGIN plugins --> | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Settings</h1> | <h1><i class="fa fa-cogs"></i> Settings</h1> | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
| <h3>General Settings</h3> | <h3>General Settings</h3> | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Themes</h1> | <h1><i class="fa fa-th"></i> Themes</h1> | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
| <h3>Custom Themes</h3> | <h3>Custom Themes</h3> | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Topics</h1> | <h1><i class="fa fa-book"></i> Topics</h1> | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <h1>Twitter Social Authentication</h1> | <h1><i class="fa fa-twitter-square"></i> Twitter Social Authentication</h1> | ||||||
| <hr /> | <hr /> | ||||||
|  |  | ||||||
| <form> | <form> | ||||||
|   | |||||||
| @@ -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> | <button id="createUser" class="btn btn-primary">Create User</button> | ||||||
| <a target="_blank" href="/admin/users/csv" class="btn btn-primary">Download CSV</a> | <a target="_blank" href="/admin/users/csv" class="btn btn-primary">Download CSV</a> | ||||||
|   | |||||||
| @@ -9,6 +9,7 @@ | |||||||
| 		"^admin/index.*": "admin/index", | 		"^admin/index.*": "admin/index", | ||||||
| 		"^admin/themes.*": "admin/themes", | 		"^admin/themes.*": "admin/themes", | ||||||
| 		"^admin/plugins/?$": "admin/plugins", | 		"^admin/plugins/?$": "admin/plugins", | ||||||
|  | 		"^admin/languages/?$": "admin/languages", | ||||||
| 		"^admin/settings.*": "admin/settings", | 		"^admin/settings.*": "admin/settings", | ||||||
| 		"^admin/twitter.*": "admin/twitter", | 		"^admin/twitter.*": "admin/twitter", | ||||||
| 		"^admin/facebook.*": "admin/facebook", | 		"^admin/facebook.*": "admin/facebook", | ||||||
|   | |||||||
							
								
								
									
										51
									
								
								src/languages.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								src/languages.js
									
									
									
									
									
										Normal 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; | ||||||
| @@ -11,11 +11,10 @@ var nconf = require('nconf'), | |||||||
| 	categories = require('./../categories'), | 	categories = require('./../categories'), | ||||||
| 	meta = require('../meta'), | 	meta = require('../meta'), | ||||||
| 	plugins = require('../plugins'), | 	plugins = require('../plugins'), | ||||||
|  | 	Languages = require('../languages'), | ||||||
| 	events = require('./../events'), | 	events = require('./../events'), | ||||||
| 	utils = require('./../../public/src/utils.js'); | 	utils = require('./../../public/src/utils.js'); | ||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
| (function (Admin) { | (function (Admin) { | ||||||
| 	Admin.isAdmin = function (req, res, next) { | 	Admin.isAdmin = function (req, res, next) { | ||||||
| 		user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) { | 		user.isAdministrator((req.user && req.user.uid) ? req.user.uid : 0, function (err, isAdmin) { | ||||||
| @@ -57,9 +56,9 @@ var nconf = require('nconf'), | |||||||
| 		(function () { | 		(function () { | ||||||
| 			var routes = [ | 			var routes = [ | ||||||
| 				'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes', | 				'categories/active', 'categories/disabled', 'users', 'topics', 'settings', 'themes', | ||||||
| 				'twitter', 'facebook', 'gplus', 'database', 'events', 'motd', 'groups', 'plugins', 'logger', | 				'twitter', 'facebook', 'gplus', 'database', 'events', 'motd', 'groups', 'plugins', | ||||||
| 				'users/latest', 'users/sort-posts', 'users/sort-reputation', | 				'languages', 'logger', | ||||||
| 				'users/search' | 				'users/latest', 'users/sort-posts', 'users/sort-reputation', 'users/search' | ||||||
| 			]; | 			]; | ||||||
|  |  | ||||||
| 			for (var i = 0, ii = routes.length; i < ii; i++) { | 			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) { | 			app.get('/settings', function (req, res) { | ||||||
| 				res.json(200, {}); | 				res.json(200, {}); | ||||||
| 			}); | 			}); | ||||||
|   | |||||||
| @@ -80,14 +80,6 @@ var	DebugRoute = function(app) { | |||||||
| 		}); | 		}); | ||||||
|  |  | ||||||
| 		app.get('/test', function(req, res) { | 		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(); | 			res.send(); | ||||||
| 		}); | 		}); | ||||||
| 	}); | 	}); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user