REFACTOR: bread-crumbs (#7064)

REFACTOR: bread-crumbs (#7064)

diff --git a/app/assets/javascripts/discourse/components/bread-crumbs.js.es6 b/app/assets/javascripts/discourse/components/bread-crumbs.js.es6
index ded546e..3ef5c99 100644
--- a/app/assets/javascripts/discourse/components/bread-crumbs.js.es6
+++ b/app/assets/javascripts/discourse/components/bread-crumbs.js.es6
@@ -1,7 +1,10 @@
+import { default as computed } from "ember-addons/ember-computed-decorators";
+
 //  A breadcrumb including category drop downs
 export default Ember.Component.extend({
   classNameBindings: ["hidden:hidden", ":category-breadcrumb"],
   tagName: "ol",
+
   parentCategory: Ember.computed.alias("category.parentCategory"),
 
   parentCategories: Ember.computed.filter("categories", function(c) {
@@ -12,42 +15,44 @@ export default Ember.Component.extend({
       // Don't show "uncategorized" if allow_uncategorized_topics setting is false.
       return false;
     }
+
     return !c.get("parentCategory");
   }),
 
-  parentCategoriesSorted: function() {
-    let cats = this.get("parentCategories");
+  @computed("parentCategories")
+  parentCategoriesSorted(parentCategories) {
     if (this.siteSettings.fixed_category_positions) {
-      return cats;
+      return parentCategories;
     }
 
-    return cats.sortBy("totalTopicCount").reverse();
-  }.property("parentCategories"),
+    return parentCategories.sortBy("totalTopicCount").reverse();
+  },
 
-  hidden: function() {
-    return this.site.mobileView && !this.get("category");
-  }.property("category"),
+  @computed("category")
+  hidden(category) {
+    return this.site.mobileView && !category;
+  },
 
-  firstCategory: function() {
-    return this.get("parentCategory") || this.get("category");
-  }.property("parentCategory", "category"),
+  firstCategory: Ember.computed.or("{parentCategory,category}"),
 
-  secondCategory: function() {
-    if (this.get("parentCategory")) return this.get("category");
+  @computed("category", "parentCategory")
+  secondCategory(category, parentCategory) {
+    if (parentCategory) return category;
     return null;
-  }.property("category", "parentCategory"),
+  },
 
-  childCategories: function() {
-    if (this.get("hideSubcategories")) {
+  @computed("firstCategory", "hideSubcategories")
+  childCategories(firstCategory, hideSubcategories) {
+    if (hideSubcategories) {
       return [];
     }
-    var firstCategory = this.get("firstCategory");
+
     if (!firstCategory) {
       return [];
     }
 
-    return this.get("categories").filter(function(c) {
-      return c.get("parentCategory") === firstCategory;
-    });
-  }.property("firstCategory", "hideSubcategories")
+    return this.get("categories").filter(
+      c => c.get("parentCategory") === firstCategory
+    );
+  }
 });
diff --git a/app/assets/javascripts/discourse/templates/components/bread-crumbs.hbs b/app/assets/javascripts/discourse/templates/components/bread-crumbs.hbs
index cee547d..02d6869 100644
--- a/app/assets/javascripts/discourse/templates/components/bread-crumbs.hbs
+++ b/app/assets/javascripts/discourse/templates/components/bread-crumbs.hbs
@@ -13,9 +13,12 @@
 {{/if}}
 
 {{#if siteSettings.tagging_enabled}}
-  {{tag-drop firstCategory=firstCategory secondCategory=secondCategory tagId=tagId}}
+  {{tag-drop
+    firstCategory=firstCategory
+    secondCategory=secondCategory
+    tagId=tagId}}
 {{/if}}
 
 {{plugin-outlet name="bread-crumbs-right" connectorTagName="li"}}
 
-<div class='clear'></div>
+<div class="clear"></div>

GitHub sha: c0dd171c