mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 10:42:45 +08:00
more work in progress, wide category list
This commit is contained in:
parent
8f0e3de675
commit
9ad01a1afb
|
@ -315,21 +315,3 @@ Handlebars.registerHelper('faqLink', function(property, options) {
|
|||
"'>" + I18n.t('faq') + "</a>"
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Ember.Handlebars.registerHelper('link-to-categories', function(){
|
||||
|
||||
var options = [].slice.call(arguments, -1)[0],
|
||||
params = Discourse.SiteSettings.enable_wide_category_list ? ['list.wideCategories'] : ['list.categories'],
|
||||
hash = options.hash;
|
||||
|
||||
hash.disabledBinding = hash.disabledWhen;
|
||||
|
||||
hash.parameters = {
|
||||
context: this,
|
||||
options: options,
|
||||
params: params
|
||||
};
|
||||
|
||||
return Ember.Handlebars.helpers.view.call(this, Ember.LinkView, options);
|
||||
});
|
||||
|
|
|
@ -97,7 +97,11 @@ Discourse.Category = Discourse.Model.extend({
|
|||
{group_name: "admins", permission: Discourse.PermissionType.create({id: 2}) },
|
||||
{group_name: "crap", permission: Discourse.PermissionType.create({id: 3}) }
|
||||
]);
|
||||
}.property()
|
||||
}.property(),
|
||||
|
||||
latestTopic: function(){
|
||||
return this.get("topics")[0];
|
||||
}.property("topics")
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ Discourse.CategoryList.reopenClass({
|
|||
},
|
||||
|
||||
list: function(filter) {
|
||||
var route = this;
|
||||
var self = this;
|
||||
var finder = null;
|
||||
if (filter === 'categories') {
|
||||
finder = PreloadStore.getAndRemove("categories_list", function() {
|
||||
|
@ -60,7 +60,7 @@ Discourse.CategoryList.reopenClass({
|
|||
categoryList.setProperties({
|
||||
can_create_category: result.category_list.can_create_category,
|
||||
can_create_topic: result.category_list.can_create_topic,
|
||||
categories: route.categoriesFrom(result),
|
||||
categories: self.categoriesFrom(result),
|
||||
draft_key: result.category_list.draft_key,
|
||||
draft_sequence: result.category_list.draft_sequence
|
||||
});
|
||||
|
|
|
@ -33,11 +33,7 @@ Discourse.Route.buildRoutes(function() {
|
|||
var homepage = settings.top_menu.split("|")[0].split(",")[0];
|
||||
this.route(homepage, { path: '/' });
|
||||
|
||||
if(settings.enable_wide_category_list) {
|
||||
this.route('wideCategories', { path: '/categories' });
|
||||
} else {
|
||||
this.route('categories', { path: '/categories' });
|
||||
}
|
||||
this.route('categories', { path: '/categories' });
|
||||
this.route('category', { path: '/category/:slug/more' });
|
||||
this.route('category', { path: '/category/:slug' });
|
||||
});
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
**/
|
||||
Discourse.ListCategoriesRoute = Discourse.Route.extend({
|
||||
|
||||
template: 'listCategories',
|
||||
template: function(){
|
||||
return Discourse.SiteSettings.enable_wide_category_list ? 'listWideCategories' : 'listCategories';
|
||||
}.property(),
|
||||
|
||||
redirect: function() { Discourse.redirectIfLoginRequired(this); },
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
Discourse.ListWideCategoriesRoute = Discourse.ListCategoriesRoute.extend({
|
||||
template: 'listWideCategories'
|
||||
});
|
||||
|
||||
|
||||
Discourse.ListWideCategoriesController = Discourse.Controller.extend({
|
||||
});
|
|
@ -139,7 +139,7 @@
|
|||
{{#if categories}}
|
||||
<ul class="category-links">
|
||||
<li class='heading' title="{{i18n filters.categories.help}}">
|
||||
{{#link-to-categories}}{{i18n filters.categories.title}}{{/link-to-categories}}
|
||||
{{#link-to "list.categories"}}{{i18n filters.categories.title}}{{/link-to}}
|
||||
</li>
|
||||
|
||||
{{#each categories}}
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<a href='#' {{action createTopic}}>{{i18n topic.suggest_create_topic}}</a>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{#link-to-categories}}{{i18n topic.browse_all_categories}}{{/link-to-categories}} {{i18n or}} {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
|
||||
{{#link-to "list.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'list.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
</h3>
|
||||
|
|
|
@ -24,9 +24,15 @@
|
|||
<a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
|
||||
{{/each}}
|
||||
</td>
|
||||
<td>{{number topics_total}}</td>
|
||||
<td>{{number topic_count}}</td>
|
||||
<td>{{number posts_total}}</td>
|
||||
<td><a href="#">this is a link to a post</a> <span class="age" data-bindattr-177="177" title="October 11, 2013 8:37am"><span class="relative-date" data-time="1381441065000" data-format="tiny">4d</span></span></td>
|
||||
{{#with latestTopic}}
|
||||
<td {{bindAttr class="archived"}}>
|
||||
{{topicStatus topic=this}}
|
||||
{{{topicLink this}}}
|
||||
|
||||
</td>
|
||||
{{/with}}
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
|
|
@ -69,5 +69,4 @@ class ListableTopicSerializer < BasicTopicSerializer
|
|||
@unread_helper ||= Unread.new(object, object.user_data)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user