fixed sidebar flashing in on empty category - got rid of javascript control and set the visibility properly from serverside

v1.18.x
psychobunny 12 years ago
parent c0b018cdf4
commit 1fc596b74b

@ -15,11 +15,6 @@
'event:new_topic'
]);
if (jQuery('.category-item').length == 0) {
jQuery('#topics-container, .category-sidebar').hide();
jQuery('#category-no-topics').show();
}
socket.on('event:new_topic', function(data) {
var html = templates.prepare(templates['category'].blocks['topics']).parse({ topics: [data] }),
topic = document.createElement('div'),
@ -28,8 +23,8 @@
numTopics = topics.length,
x;
jQuery('#topics-container, .category-sidebar').show();
jQuery('#category-no-topics').hide();
jQuery('#topics-container, .category-sidebar').removeClass('hidden');
jQuery('#category-no-topics').remove();
topic.innerHTML = html;
if (numTopics > 0) {

@ -5,7 +5,7 @@
<div id="category_active_users"></div>
</ul>
</div>
<div class="alert alert-warning hide" id="category-no-topics">
<div class="alert alert-warning hide {no_topics_message}" id="category-no-topics">
<strong>There are no topics in this category.</strong><br />
Why don't you try posting one?
</div>
@ -42,10 +42,10 @@
</li></a>
<!-- END topics -->
</ul>
<hr />
<button id="new_post" class="btn btn-primary btn-large {show_category_features}">New Topic</button>
<hr class="{show_sidebar}" />
<button id="new_post" class="btn btn-primary btn-large {show_topic_button}">New Topic</button>
</div>
<div class="span3 {show_category_features} category-sidebar mobile-sidebar">
<div class="span3 {show_sidebar} category-sidebar mobile-sidebar">
<div class="sidebar-block img-polaroid">
<div class="block-header">
<a target="_blank" href="../{category_id}.rss"><i class="icon-rss-sign icon-2x"></i></a>&nbsp;

@ -27,7 +27,9 @@ var RDB = require('./redis.js'),
var categoryData = {
'category_name' : category_name,
'show_category_features' : 'show',
'show_sidebar' : 'show',
'show_topic_button': 'show',
'no_topics_message': 'hidden',
'topic_row_size': 'span9',
'category_id': category_id,
'active_users': active_users,
@ -50,6 +52,8 @@ var RDB = require('./redis.js'),
getModerators(function(err, moderators) {
categoryData.moderator_block_class = moderators.length > 0 ? '' : 'none';
categoryData.moderators = moderators;
categoryData.show_sidebar = 'hidden';
categoryData.no_topics_message = 'show';
callback(categoryData);
});
@ -70,7 +74,9 @@ var RDB = require('./redis.js'),
RDB.zrange('topics:recent', 0, -1, function(err, tids) {
var latestTopics = {
'category_name' : 'Recent',
'show_category_features' : 'hidden',
'show_sidebar' : 'hidden',
'show_topic_button' : 'hidden',
'no_topics_message' : 'hidden',
'topic_row_size': 'span12',
'category_id': false,
'topics' : []

Loading…
Cancel
Save