From 6c10cc37880641b5f17ac902e1dbb0845ffd5c66 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 15 Aug 2014 17:42:00 -0400 Subject: [PATCH] FIX: top_menu with category links like category/Meta are not case sensitive --- app/assets/javascripts/discourse/models/category.js | 4 ++++ app/assets/javascripts/discourse/models/nav_item.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/discourse/models/category.js b/app/assets/javascripts/discourse/models/category.js index 49071428f40..4cc585a3f37 100644 --- a/app/assets/javascripts/discourse/models/category.js +++ b/app/assets/javascripts/discourse/models/category.js @@ -29,6 +29,10 @@ Discourse.Category = Discourse.Model.extend({ return Discourse.getURL("/category/") + Discourse.Category.slugFor(this); }.property('name'), + nameLower: function() { + return this.get('name').toLowerCase(); + }.property('name'), + unreadUrl: function() { return this.get('url') + '/l/unread'; }.property('url'), diff --git a/app/assets/javascripts/discourse/models/nav_item.js b/app/assets/javascripts/discourse/models/nav_item.js index 33986b1228b..365c6f1b8ed 100644 --- a/app/assets/javascripts/discourse/models/nav_item.js +++ b/app/assets/javascripts/discourse/models/nav_item.js @@ -21,7 +21,7 @@ Discourse.NavItem = Discourse.Model.extend({ categorySlug: function() { var split = this.get('name').split('/'); if (split[0] === 'category' && split[1]) { - var cat = Discourse.Site.current().categories.findProperty('name', split[1]); + var cat = Discourse.Site.current().categories.findProperty('nameLower', split[1].toLowerCase()); return cat ? Discourse.Category.slugFor(cat) : null; } return null;