diff --git a/app.js b/app.js index 7fbd6ae288..39edfd5d6b 100644 --- a/app.js +++ b/app.js @@ -33,20 +33,33 @@ global.modules = modules; console.log('Setting up default categories...'); modules.categories.create({ - 'name': 'General', - 'description': 'A place to talk about whateeeever you want' + 'name': 'Announcements', + 'description': 'A place to talk about whateeeever you want', + 'blockclass': 'category-purple', + 'icon' : 'icon-bullhorn' + }); + + modules.categories.create({ + 'name': 'General Discussion', + 'description': 'A place to talk about whateeeever you want', + 'blockclass': 'category-purple', + 'icon' : 'icon-comment' }); modules.categories.create({ 'name': 'NodeBB Development', - 'description': 'Bugs? Dont worry, we dont read this thread, so post them here.' + 'description': 'Bugs? Dont worry, we dont read this thread, so post them here.', + 'blockclass': 'category-purple', + 'icon' : 'icon-github-alt' }); modules.categories.create({ - 'name': 'Design Create Play', - 'description': 'In future an example of how a hidden category should look like.' + 'name': 'Blogs', + 'description': 'In future an example of how a hidden category should look like.', + 'blockclass': 'category-purple', + 'icon' : 'icon-pencil' }); } else console.log('Good.'); diff --git a/public/css/style.less b/public/css/style.less index c280a59b97..0c2c357186 100644 --- a/public/css/style.less +++ b/public/css/style.less @@ -296,4 +296,30 @@ footer.footer { .account-bio-label{ display:inline-block; width:100px; +} + + + +.category-icon { + width: 100%; + height: 90px; + text-align: center; + border-radius: 5px; + margin: 0; + padding-top:20px; + cursor: pointer; +} +.category-row h4 { + font-weight: 700; + text-align: center; + color: #555; +} +.category-row a { + text-decoration: none; + border: 0; +} + +.category-purple { + background: #ab1290; + color: white; } \ No newline at end of file diff --git a/public/src/ajaxify.js b/public/src/ajaxify.js index 65ccfb9776..95d6847888 100644 --- a/public/src/ajaxify.js +++ b/public/src/ajaxify.js @@ -30,6 +30,7 @@ var ajaxify = {}; var url = url.replace(/\/$/, ""); var tpl_url = (url === '' || url === '/') ? 'home' : url.split('/')[0]; + tpl_url = templates.get_custom_map(tpl_url); if (templates[tpl_url]) { window.history.pushState({}, url, "/" + url); diff --git a/public/src/templates.js b/public/src/templates.js index 3290c9365f..8eaea3502f 100644 --- a/public/src/templates.js +++ b/public/src/templates.js @@ -1,7 +1,12 @@ var templates = {}; (function() { - var ready_callback; + var ready_callback, + config; + + templates.get_custom_map = function(tpl) { + return (config['custom_mapping'] && config['custom_mapping'][tpl]) ? config['custom_mapping'][tpl] : tpl; + } templates.ready = function(callback) { //quick implementation because introducing a lib to handle several async callbacks @@ -21,6 +26,10 @@ var templates = {}; var timestamp = new Date().getTime(); var loaded = templatesToLoad.length; + $.getJSON('/templates/config.json', function(data) { + config = data; + }); + for (var t in templatesToLoad) { (function(file) { $.get('/templates/' + file + '.tpl?v=' + timestamp, function(html) { @@ -146,7 +155,10 @@ function load_template(callback) { url = (url === '' || url === '/') ? 'home' : url; jQuery.get(API_URL + url, function(data) { - document.getElementById('content').innerHTML = templates[url.split('/')[0]].parse(JSON.parse(data)); + var tpl = url.split('/')[0]; + tpl = templates.get_custom_map(tpl); + + document.getElementById('content').innerHTML = templates[tpl].parse(JSON.parse(data)); if (callback) callback(); }); } \ No newline at end of file diff --git a/public/templates/category.tpl b/public/templates/category.tpl index 4fb3c46bc8..513070c198 100644 --- a/public/templates/category.tpl +++ b/public/templates/category.tpl @@ -1,4 +1,4 @@ - +