BUGFIX: properly hide categories/top lists view when loading another tab

This commit is contained in:
Régis Hanol 2014-01-14 01:47:36 +01:00
parent 3a6bffa05d
commit 9ab5b3a123
2 changed files with 149 additions and 146 deletions

View File

@ -1,102 +1,103 @@
<div class='contents'>
<table id='topic-list' class='categories'>
<thead>
<tr>
<th class='category'>{{i18n categories.category}}</th>
<th class='latest'>{{i18n categories.latest}}</th>
<th class='stats topics'>{{i18n categories.topics}}</th>
<th class='stats posts'>{{i18n categories.posts}}
{{#if canEdit}}<button title='{{i18n categories.toggle_ordering}}' class='btn toggle-admin no-text' {{action toggleOrdering}}><i class='fa fa-wrench'></i></button>{{/if}}
</th>
</tr>
</thead>
<tbody>
{{#each model.categories}}
<tr data-category_id='{{unbound id}}' {{bindAttr class="description_excerpt:has-description:no-description"}}>
<td class='category'>
<div>
<div class="pull-left">
{{#if controller.ordering}}<i class="fa fa-bars"></i>{{/if}}
{{categoryLink this allowUncategorized=true}}
{{#if unreadTopics}}
<a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{unbound unreadTopics}}</a>
{{/if}}
{{#if newTopics}}
<a href={{unbound newUrl}} class='badge new-posts badge-notification' title='{{i18n topic.new_topics count="newTopics"}}'>{{unbound newTopics}} <i class='fa fa-asterisk'></i></a>
{{/if}}
{{#if model.categories}}
<div class='contents'>
<table id='topic-list' class='categories'>
<thead>
<tr>
<th class='category'>{{i18n categories.category}}</th>
<th class='latest'>{{i18n categories.latest}}</th>
<th class='stats topics'>{{i18n categories.topics}}</th>
<th class='stats posts'>{{i18n categories.posts}}
{{#if canEdit}}<button title='{{i18n categories.toggle_ordering}}' class='btn toggle-admin no-text' {{action toggleOrdering}}><i class='fa fa-wrench'></i></button>{{/if}}
</th>
</tr>
</thead>
<tbody>
{{#each model.categories}}
<tr data-category_id='{{unbound id}}' {{bindAttr class="description_excerpt:has-description:no-description"}}>
<td class='category'>
<div>
<div class="pull-left">
{{#if controller.ordering}}<i class="fa fa-bars"></i>{{/if}}
{{categoryLink this allowUncategorized=true}}
{{#if unreadTopics}}
<a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{unbound unreadTopics}}</a>
{{/if}}
{{#if newTopics}}
<a href={{unbound newUrl}} class='badge new-posts badge-notification' title='{{i18n topic.new_topics count="newTopics"}}'>{{unbound newTopics}} <i class='fa fa-asterisk'></i></a>
{{/if}}
</div>
<div class='featured-users'>
{{#each featured_users}}
<a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
{{/each}}
</div>
<div class="clearfix"></div>
</div>
<div class='featured-users'>
{{#each featured_users}}
<a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
{{/each}}
</div>
<div class="clearfix"></div>
</div>
{{#if description_excerpt}}
<div class="category-description">
{{{description_excerpt}}}
</div>
{{/if}}
{{#if subcategories}}
<div class='subcategories'>
{{i18n categories.subcategories}}
{{#each subcategory in subcategories}}
{{categoryLink subcategory}}
{{/each}}
</div>
{{/if}}
</td>
<td {{bindAttr class="archived :latest"}}>
{{#each featuredTopics}}
<div class="featured-topic">
{{topicStatus topic=this}}
<a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
{{#if unread}}
<a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unread}}</a>
{{/if}}
{{#if new_posts}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts count="new_posts"}}'>{{new_posts}}</a>
{{/if}}
{{#if unseen}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new}}'><i class='fa fa-asterisk'></i></a>
{{/if}}
{{#if description_excerpt}}
<div class="category-description">
{{{description_excerpt}}}
</div>
{{/if}}
{{#if subcategories}}
<div class='subcategories'>
{{i18n categories.subcategories}}
{{#each subcategory in subcategories}}
{{categoryLink subcategory}}
{{/each}}
</div>
{{/if}}
</td>
<td {{bindAttr class="archived :latest"}}>
{{#each featuredTopics}}
<div class="featured-topic">
{{topicStatus topic=this}}
<a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
{{#if unread}}
<a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unread}}</a>
{{/if}}
{{#if new_posts}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts count="new_posts"}}'>{{new_posts}}</a>
{{/if}}
{{#if unseen}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new}}'><i class='fa fa-asterisk'></i></a>
{{/if}}
{{#if controller.latestTopicOnly}}
<div class='last-user-info'>
{{i18n categories.latest_by}} <a href="{{{unbound lastPosterUrl}}}">{{unbound last_poster.username}}</a>
<a href="{{unbound lastPostUrl}}">{{unboundAge last_posted_at}}</a>
</div>
{{else}}
&nbsp;
<a href="{{unbound lastPostUrl}}" class="last-posted-at">{{unboundAge last_posted_at}}</a>
{{/if}}
</div>
{{/each}}
</td>
<td class='stats' {{bindAttr title="topicStatsTitle"}}>
<table class="categoryStats">
{{#each topicCountStats}}
<tr>
<td class="value">{{value}}</td>
<td class="unit">{{unit}}</td>
</tr>
{{#if controller.latestTopicOnly}}
<div class='last-user-info'>
{{i18n categories.latest_by}} <a href="{{{unbound lastPosterUrl}}}">{{unbound last_poster.username}}</a>
<a href="{{unbound lastPostUrl}}">{{unboundAge last_posted_at}}</a>
</div>
{{else}}
&nbsp;
<a href="{{unbound lastPostUrl}}" class="last-posted-at">{{unboundAge last_posted_at}}</a>
{{/if}}
</div>
{{/each}}
</table>
</td>
<td class='stats' {{bindAttr title="postStatsTitle"}}>
<table class="categoryStats">
{{#each postCountStats}}
<tr>
<td class="value">{{value}}</td>
<td class="unit">{{unit}}</td>
</tr>
{{/each}}
</table>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<footer id='topic-list-bottom'></footer>
</td>
<td class='stats' {{bindAttr title="topicStatsTitle"}}>
<table class="categoryStats">
{{#each topicCountStats}}
<tr>
<td class="value">{{value}}</td>
<td class="unit">{{unit}}</td>
</tr>
{{/each}}
</table>
</td>
<td class='stats' {{bindAttr title="postStatsTitle"}}>
<table class="categoryStats">
{{#each postCountStats}}
<tr>
<td class="value">{{value}}</td>
<td class="unit">{{unit}}</td>
</tr>
{{/each}}
</table>
</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
<footer id='topic-list-bottom'></footer>
{{/if}}

View File

@ -1,48 +1,50 @@
<div class="top-lists">
{{#if redirectedToTopPageReason}}
<div class="alert alert-info">
{{redirectedToTopPageReason}}
</div>
{{/if}}
{{#if content.yearly}}
<div class="clearfix">
<h2>{{i18n filters.top.this_year}}</h2>
{{basic-topic-list topicList=content.yearly}}
{{#if content.yearly.topics.length}}<a href={{unbound showMoreYearlyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
{{#if content.monthly}}
<div class="clearfix">
<h2>{{i18n filters.top.this_month}}</h2>
{{basic-topic-list topicList=content.monthly}}
{{#if content.monthly.topics.length}}<a href={{unbound showMoreMonthlyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
{{#if content.weekly}}
<div class="clearfix">
<h2>{{i18n filters.top.this_week}}</h2>
{{basic-topic-list topicList=content.weekly}}
{{#if content.weekly.topics.length}}<a href={{unbound showMoreWeeklyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
{{#if content.daily}}
<div class="clearfix">
<h2>{{i18n filters.top.today}}</h2>
{{basic-topic-list topicList=content.daily}}
{{#if content.daily.topics.length}}<a href={{unbound showMoreDailyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
<footer id="topic-list-bottom">
<h3>
{{#if hasDisplayedAllTopLists}}
{{#link-to "list.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}.
{{else}}
{{#link-to "list.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}}, {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}} {{i18n or}} {{i18n filters.top.other_periods}}
{{#unless content.yearly}}<a href={{unbound showMoreYearlyUrl}} class='btn'>{{i18n filters.top.this_year}}</a>{{/unless}}
{{#unless content.monthly}}<a href={{unbound showMoreMonthlyUrl}} class='btn'>{{i18n filters.top.this_month}}</a>{{/unless}}
{{#unless content.weekly}}<a href={{unbound showMoreWeeklyUrl}} class='btn'>{{i18n filters.top.this_week}}</a>{{/unless}}
{{#unless content.daily}}<a href={{unbound showMoreDailyUrl}} class='btn'>{{i18n filters.top.today}}</a>{{/unless}}
{{#if content}}
<div class="top-lists">
{{#if redirectedToTopPageReason}}
<div class="alert alert-info">
{{redirectedToTopPageReason}}
</div>
{{/if}}
</h3>
</footer>
</div>
{{#if content.yearly}}
<div class="clearfix">
<h2>{{i18n filters.top.this_year}}</h2>
{{basic-topic-list topicList=content.yearly}}
{{#if content.yearly.topics.length}}<a href={{unbound showMoreYearlyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
{{#if content.monthly}}
<div class="clearfix">
<h2>{{i18n filters.top.this_month}}</h2>
{{basic-topic-list topicList=content.monthly}}
{{#if content.monthly.topics.length}}<a href={{unbound showMoreMonthlyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
{{#if content.weekly}}
<div class="clearfix">
<h2>{{i18n filters.top.this_week}}</h2>
{{basic-topic-list topicList=content.weekly}}
{{#if content.weekly.topics.length}}<a href={{unbound showMoreWeeklyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
{{#if content.daily}}
<div class="clearfix">
<h2>{{i18n filters.top.today}}</h2>
{{basic-topic-list topicList=content.daily}}
{{#if content.daily.topics.length}}<a href={{unbound showMoreDailyUrl}} class='btn pull-right'>{{i18n show_more}}</a>{{/if}}
</div>
{{/if}}
<footer id="topic-list-bottom">
<h3>
{{#if hasDisplayedAllTopLists}}
{{#link-to "list.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}.
{{else}}
{{#link-to "list.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}}, {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}} {{i18n or}} {{i18n filters.top.other_periods}}
{{#unless content.yearly}}<a href={{unbound showMoreYearlyUrl}} class='btn'>{{i18n filters.top.this_year}}</a>{{/unless}}
{{#unless content.monthly}}<a href={{unbound showMoreMonthlyUrl}} class='btn'>{{i18n filters.top.this_month}}</a>{{/unless}}
{{#unless content.weekly}}<a href={{unbound showMoreWeeklyUrl}} class='btn'>{{i18n filters.top.this_week}}</a>{{/unless}}
{{#unless content.daily}}<a href={{unbound showMoreDailyUrl}} class='btn'>{{i18n filters.top.today}}</a>{{/unless}}
{{/if}}
</h3>
</footer>
</div>
{{/if}}