Adding items to navigation bar?


#1

How to add more “Buttons/Categories” to navigation bar?


Private categories show up in nav menu when user does not have permissions
(Christopher Heald) #2

Admin > Settings > Basic Setup > top menu

You can add, remove and reorder items.


#3

@OnceWas i know about that, but how can i add these;


(Christopher Heald) #4

Use this syntax: ‘category/CategoryName’


(Christopher Heald) #5

Interestingly, category/ has been replaced with c/ in the URL, but ‘c/CategoryName’ doesn’t work as a top menu item.


(Jeff Atwood) #6

Hmm we should fix the above @sam


#7

@OnceWas Thanks ‘category/CategoryName’ Works fine :smile:


(Sam Saffron) #8

Those buttons are added with

admin -> customize -> css/html -> </body>

<script>

  Discourse.ExternalNavItem = Discourse.NavItem.extend({
    href : function() {
      return this.get('href');
    }.property('href')
  });

  I18n.translations.en.js.filters.bugs = { title: "Bugs", help: "Open Bugs" };
  I18n.translations.en.js.filters.features = { title: "Features", help: "Open Feature Requests" }

  Discourse.NavItem.reopenClass({
    buildList : function(category, args) {
      var list = this._super(category, args);
      if(!category) {
        list.push(Discourse.ExternalNavItem.create({href: '/category/bug?order=op_likes&status=open', name: 'bugs'}));
        list.push(Discourse.ExternalNavItem.create({href: '/category/feature?order=op_likes&status=open', name: 'features'}));
      }
      return list;
    }
  });

 </script>

We just need to simplify navitem control, I am thinking this belongs in customize in a separate section cause there is a fair amount of richness you want there.


Where or how does the function defined?