diff --git a/app/assets/javascripts/discourse/components/utilities.js b/app/assets/javascripts/discourse/components/utilities.js index 9936a67ba02..c96efb2cf76 100644 --- a/app/assets/javascripts/discourse/components/utilities.js +++ b/app/assets/javascripts/discourse/components/utilities.js @@ -39,10 +39,11 @@ Discourse.Utilities = { // Create a badge like category link categoryLink: function(category) { - var color, name, description, result; + var color, textColor, name, description, result; if (!category) return ""; color = Em.get(category, 'color'); + textColor = Em.get(category, 'text_color'); name = Em.get(category, 'name'); description = Em.get(category, 'description'); @@ -52,7 +53,7 @@ Discourse.Utilities = { // Add description if we have it if (description) result += "title=\"" + description + "\" "; - return result + "style=\"background-color: #" + color + "\">" + name + ""; + return result + "style=\"background-color: #" + color + "; color: #" + textColor + ";\">" + name + ""; }, avatarUrl: function(username, size, template) { diff --git a/app/assets/javascripts/discourse/models/category.js b/app/assets/javascripts/discourse/models/category.js index 4bf87ca0caa..461faadb2fc 100644 --- a/app/assets/javascripts/discourse/models/category.js +++ b/app/assets/javascripts/discourse/models/category.js @@ -13,8 +13,8 @@ Discourse.Category = Discourse.Model.extend({ }).property('name'), style: (function() { - return "background-color: #" + (this.get('color')); - }).property('color'), + return "background-color: #" + (this.get('category.color')) + "; color: #" + (this.get('category.text_color')) + ";"; + }).property('color', 'text_color'), moreTopics: (function() { return this.get('topic_count') > Discourse.SiteSettings.category_featured_topics; @@ -32,7 +32,8 @@ Discourse.Category = Discourse.Model.extend({ return this.ajax(url, { data: { name: this.get('name'), - color: this.get('color') + color: this.get('color'), + text_color: this.get('text_color') }, type: this.get('id') ? 'PUT' : 'POST', success: function(result) { return args.success(result); }, diff --git a/app/assets/javascripts/discourse/templates/excerpt/category.js.handlebars b/app/assets/javascripts/discourse/templates/excerpt/category.js.handlebars index db20ce8f6c4..2a57235f3b8 100644 --- a/app/assets/javascripts/discourse/templates/excerpt/category.js.handlebars +++ b/app/assets/javascripts/discourse/templates/excerpt/category.js.handlebars @@ -1,5 +1,5 @@