diff --git a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6
index 0fff6219a69..1e23c9154a0 100644
--- a/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6
+++ b/app/assets/javascripts/discourse/controllers/discovery/categories.js.es6
@@ -8,7 +8,6 @@ export default DiscoveryController.extend({
actions: {
refresh: function() {
- var self = this;
// Don't refresh if we're still loading
if (this.get('controllers.discovery.loading')) { return; }
@@ -17,7 +16,17 @@ export default DiscoveryController.extend({
// router and ember throws an error due to missing `handlerInfos`.
// Lesson learned: Don't call `loading` yourself.
this.set('controllers.discovery.loading', true);
- Discourse.CategoryList.list('categories').then(function(list) {
+
+ var parentCategory = this.get('model.parentCategory');
+ var promise;
+ if (parentCategory) {
+ promise = Discourse.CategoryList.listForParent(parentCategory);
+ } else {
+ promise = Discourse.CategoryList.list();
+ }
+
+ var self = this;
+ promise.then(function(list) {
self.set('model', list);
self.send('loadingComplete');
});
diff --git a/app/assets/javascripts/discourse/models/category_list.js b/app/assets/javascripts/discourse/models/category_list.js
index ee8b08c1583..bd1e1711fb3 100644
--- a/app/assets/javascripts/discourse/models/category_list.js
+++ b/app/assets/javascripts/discourse/models/category_list.js
@@ -1,11 +1,3 @@
-/**
- A data model for containing a list of categories
-
- @class CategoryList
- @extends Discourse.Model
- @namespace Discourse
- @module Discourse
-**/
Discourse.CategoryList = Ember.ArrayProxy.extend({
init: function() {
this.set('content', []);
@@ -50,7 +42,8 @@ Discourse.CategoryList.reopenClass({
var self = this;
return Discourse.ajax('/categories.json?parent_category_id=' + category.get('id')).then(function(result) {
return Discourse.CategoryList.create({
- categories: self.categoriesFrom(result)
+ categories: self.categoriesFrom(result),
+ parentCategory: category
});
});
},
diff --git a/app/assets/javascripts/discourse/templates/discovery/categories.hbs b/app/assets/javascripts/discourse/templates/discovery/categories.hbs
index 691b4d04738..c3055c93b66 100644
--- a/app/assets/javascripts/discourse/templates/discovery/categories.hbs
+++ b/app/assets/javascripts/discourse/templates/discovery/categories.hbs
@@ -10,71 +10,71 @@
{{#each c in categories}}
-
-
-
- {{#if c.description_excerpt}}
-
- {{{c.description_excerpt}}}
-
- {{/if}}
- {{#if c.subcategories}}
-
- {{#each s in c.subcategories}}
- {{category-link s showParent="true" onlyStripe="true"}}
- {{#if s.unreadTopics}}
- {{unbound s.unreadTopics}}
+
+
+
- {{/if}}
- |
-
- {{#each f in c.featuredTopics}}
-
- {{topic-status topic=f}}
- {{{unbound f.fancy_title}}}
- {{topic-post-badges newPosts=f.totalUnread unseen=f.unseen url=f.lastUnreadUrl}}
+ {{#if c.description_excerpt}}
+
+ {{{c.description_excerpt}}}
+
+ {{/if}}
+ {{#if c.subcategories}}
+
+ {{/if}}
+ |
+
+ {{#each f in c.featuredTopics}}
+
- {{/each}}
- |
-
-
-
- {{#each s in c.topicCountStats}}
-
- {{s.value}} |
- / {{s.unit}} |
-
+ {{#if controller.latestTopicOnly}}
+
+ {{else}}
+
+ {{format-age f.last_posted_at}}
+ {{/if}}
+
{{/each}}
-
-
- |
-
+ |
+
+
+
+ {{#each s in c.topicCountStats}}
+
+ {{s.value}} |
+ / {{s.unit}} |
+
+ {{/each}}
+
+
+ |
+
{{/each}}
diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.hbs b/app/assets/javascripts/discourse/templates/discovery/topics.hbs
index b5417dfdecf..9731eb00f8a 100644
--- a/app/assets/javascripts/discourse/templates/discovery/topics.hbs
+++ b/app/assets/javascripts/discourse/templates/discovery/topics.hbs
@@ -16,7 +16,7 @@
{{#if selected}}
-
+ {{d-button action="showBulkActions" icon="wrench" class="no-text"}}
{{/if}}