From 3d0587d8cee572312ac38620f31315c0426c6a2c Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 29 May 2013 14:18:02 -0400 Subject: [PATCH] Refactor: move category slug helper to Category model --- .../discourse/components/utilities.js | 10 +-------- .../javascripts/discourse/models/category.js | 8 +++++++ .../discourse/routes/list_category_route.js | 2 +- .../views/modal/edit_category_view.js | 2 +- spec/javascripts/components/utilities_spec.js | 16 -------------- spec/javascripts/models/category_spec.js | 21 +++++++++++++++++++ 6 files changed, 32 insertions(+), 27 deletions(-) create mode 100644 spec/javascripts/models/category_spec.js diff --git a/app/assets/javascripts/discourse/components/utilities.js b/app/assets/javascripts/discourse/components/utilities.js index 2a08c38cea6..60719fe0e78 100644 --- a/app/assets/javascripts/discourse/components/utilities.js +++ b/app/assets/javascripts/discourse/components/utilities.js @@ -29,14 +29,6 @@ Discourse.Utilities = { } }, - categoryUrlId: function(category) { - if (!category) return ""; - var id = Em.get(category, 'id'); - var slug = Em.get(category, 'slug'); - if ((!slug) || slug.isBlank()) return "" + id + "-category"; - return slug; - }, - // Create a badge like category link categoryLink: function(category) { if (!category) return ""; @@ -47,7 +39,7 @@ Discourse.Utilities = { var description = Em.get(category, 'description'); // Build the HTML link - var result = "