adopilot
(Admir Hodzic)
December 30, 2016, 8:05am
1
Is there a way to add groups to top menu ?
My /admin/site_settings/category/basic top_menu settings looks like
But I do not get Groups at top menu.
I’ll love to add grop page to top menu so users can join freely
My Discourse is at v1.7.0.beta10 +149 Version
2 Likes
Falco
(Falco)
December 30, 2016, 1:42pm
2
That setting is only for topic listings.
You can add a Groups button with something like:
<script>
Discourse.ExternalNavItem = Discourse.NavItem.extend({
href : function() {
return this.get('href');
}.property('href')
});
I18n.translations.en.js.filters.groups = { title: "Groups", help: "Groups Listing" };
Discourse.NavItem.reopenClass({
buildList : function(category, args) {
var list = this._super(category, args);
if(!category) {
list.push(Discourse.ExternalNavItem.create({href: '/groups', name: 'groups'}));
}
return list;
}
});
</script>
On </head>
customization.
10 Likes
adopilot
(Admir Hodzic)
January 2, 2017, 6:45am
3
Thanx a lot . It is working as shoud.
It is not case whit Categories, They are not topic listing.
1 Like
Thank you very much. While at the same time, could you please do me a favor about how to solve the translation problem?
I used your most code while only changed to
I18n.translations.zh_CN .js.filters.groups = { title: “Groups”, help: “See the Groups” };
But still it shows “Groups” in English on the top menu.
Could you please tell me how to change the word to a Chinese Word “群组” ?
Yours
Dax
(Daniela)
May 29, 2017, 10:15am
5
Change
I18n.translations.zh_CN.js.filters.groups = { title: "Groups", help: "See the Groups" };
to
I18n.translations.zh_CN.js.filters.groups = { title: "群组", help: "See the Groups" };
5 Likes
Great!! It works perfectly. And I think that must be a way to hold any language in this task.
Dax
(Daniela)
May 29, 2017, 5:36pm
7
People can change languages after I18n.translations.
and change accordingly also the text inside the double quote in title
and help
.
2 Likes
schungx
(Stephen Chung)
August 31, 2017, 4:15am
8
It seems that en
is always loaded, and the user’s current locale is loaded, but nothing else.
So it probably should be protected by a conditional:
if (I18n.translations.zh_CN) I18n.translations.zh_CN.js.filters.groups = { title: "群组", help: "See the Groups" };
1 Like
Johani
(Joe)
May 11, 2018, 3:15am
9
Now possible with a theme component:
This is a theme component that will allow you to add links to Discourse top navigation.
Screenshot:
Desktop
[Capture]
Mobile
[Capture]
Settings:
A navigation link needs three things
Name
Description
Path or URL
Name is the text for the link that shows up on the menu. Description shows up when you hover the name like this:
[hover2]
Path/URL is where you want the link to go.
You can add links as semicolon delimited values in theme settings following this order
name;description;URL …
4 Likes