This theme component allows you to customize the New Topic button on a category or tag topic list as well as the action name and button in the composer (highlighted below). If you have a bug category, for example, you can update these texts to say “Report Bug”:
This setting allows you to set the filter (tag or category name), the icon for the “New Topic” button (this doesn’t change the icons in the composer), as well as the action name at the top of the composer, and the composer’s “Create Topic” button.
There’s an additional setting, enabled by default, called inherit parent category. When this is enabled all child categories will also have their text changed (unless otherwise specified in the settings).
Note that if you set up a tag it will override the selected category.
Ideas for future enhancements
Localizable text for different languages
Support for category and tag combinations, and multiple tags
Hosted by us? Theme components are available to use on our Standard, Business, and Enterprise plans.
Today, I was working on a much simpler version of this using api.customizeComposerText()
This is a so much better solution. Thank you @awesomerobot!
In my experiments, I was never able to override the Composer button label for the categories using the discourse-post-voting plugin. This becomes a bigger issue when multiple categories are enabled for post voting.
If I may suggest; enabling support for overriding discourse-post-voting labels, would be a great enhancement. ( :
This is a great theme component! An idea to take it a step further could be this:
If you are renaming the button because you effectively want to change what the type of topic is, then you should change the naming throughout the entire *category.
For example:
You have a category called Events. You would effectively change the word “topic” in the entire category to “events”. It’s not “New Topic” its “New Event”, instead of a Topics list you’d have an Events list, etc.
You see this in other tools where you change the primary use case of something. Here is what AirTable does when you create a new table. Tables, by default, have “records”.
But let’s say I want to create a table called “Users”, then I can change each record to be called Users:
Treating the theme component this way would allow us to easily, effectively rebrand a category as a more specific entity. Support Requests, Events, etc.
I found this theme component when searching, because I wanted to change this word for “Topic” to “Events”:
Sorry, one last thing: this also does not seem to respect the case where two subcategories (each of a different parent) have the same slug. e.g.:
parent1
sub1
parent2
sub1
In this case, I cannot get the theme component to differentiate between the two subcategories, and they both share the same configuration from the editor.
I completely overlooked the reply button! For now I’ve just kept it as reply, but a separate setting to change its text would make sense.
Good point, it seems like utilizing the category ID rather than the category name in the settings would be the best way to avoid this. So this means any existing settings you have in place will need to be updated.
Hmm attempting to use this component unsuccessfully and seeing a lot of warnings in my logs like this one.
Message (4 copies reported)
[DiscourseJsProcessor] DEPRECATION: Using {{attrs}} to reference named arguments has been deprecated. {{attrs.canCreateTopic}} should be updated to {{@canCreateTopic}}. (‘discourse/components/custom-new-topic-button.hbs’ @ L2:C8) [deprecation id: attrs-arg-access] See Ember.js - Deprecations for more details.
at theme-transpiler.js:3164:26752
at j. (theme-transpiler.js:3168:1693)
at theme-transpiler.js:3168:161
at j. (theme-transpiler.js:3168:1693)
at D (theme-transpiler.js:3168:1754)
at te (theme-transpiler.js:3168:1318)
at PathExpression (theme-transpiler.js:3198:21763)
at yo (theme-transpiler.js:3187:2776)
at Al (theme-transpiler.js:3187:3513)
at Ml (theme-transpiler.js:3187:3309)
at yo (theme-transpiler.js:3187:3013)
at Al (theme-transpiler.js:3187:3513)
at Ml (theme-transpiler.js:3187:3309)
at yo (theme-transpiler.js:3187:3013)
at Ml (theme-transpiler.js:3187:3350)
at yo (theme-transpiler.js:3187:3013)
at Al (theme-transpiler.js:3187:3513)
at Ml (theme-transpiler.js:3187:3309)
at yo (theme-transpiler.js:3187:3013)
at Bi (theme-transpiler.js:3187:3879)
at PA (theme-transpiler.js:3190:3002)
at Cf (theme-transpiler.js:3190:9856)
at Al (theme-transpiler.js:3176:35353)
at gf (theme-transpiler.js:3176:35600)
at D (theme-transpiler.js:3198:42250)
at Sft.o.precompile (theme-transpiler.js:3281:3078)
at dDe (theme-transpiler.js:3161:1003)
at e.CallExpression (theme-transpiler.js:3159:33796)
at h (theme-transpiler.js:10:111797)
at e.uPe [as _call] (theme-transpiler.js:59:16906)
at e.oPe [as call] (theme-transpiler.js:59:16726)
at e.lPe [as visit] (theme-transpiler.js:59:17700)
at t.visitQueue (theme-transpiler.js:59:40645)
at t.visitSingle (theme-tr…
Backtrace
/var/www/discourse/lib/discourse_js_processor.rb:133:in block in create_new_context' mini_racer-0.8.0/lib/mini_racer.rb:273:in block in attach’
mini_racer-0.8.0/lib/mini_racer.rb:242:in call_unsafe' mini_racer-0.8.0/lib/mini_racer.rb:242:in block (2 levels) in call’
mini_racer-0.8.0/lib/mini_racer.rb:369:in timeout' mini_racer-0.8.0/lib/mini_racer.rb:241:in block in call’
mini_racer-0.8.0/lib/mini_racer.rb:240:in synchronize' mini_racer-0.8.0/lib/mini_racer.rb:240:in call’
/var/www/discourse/lib/discourse_js_processor.rb:168:in block in v8_call' /var/www/discourse/lib/discourse_js_processor.rb:167:in synchronize’
Hmm strange, I tested it on the latest Discourse and everything’s working fine — I’ve just merged an update to the component that will solve that deprecation issue, can you update and try again?
When using your Component, the button changes it’s name, but pressing it no longer launches Wizard selected in the category settings. We would be glad to use your component in big production website, but unable now. Hope it could be fixed. No pressure