Building New Topic Lists

Hello,

For the past few weeks I have been working on a plugin that defines new topic lists (there is going to be a new topic list for each user which is going to contain only user’s favorite categories). I am developing this new feature as a plugin and now I got to the part where I have to hook into the client-side. There are a few issues here.

  1. I noticed that right now, the current topic lists are “hard-coded” in the sense that there are a few filters that can be applied to categories and tags. This is a issue, because for example to fetch more topics, the client generates some links following a few rules.

  2. Adding new routes in Ember JS is not possible from a plugin, because Ember JS does not allow adding more rules at “run-time”.

  3. There is also no list support for multiple categories or tags, but I think this would be nice (similar to multi-reddits on Reddit). Somehow, this is basically what I am trying to do, but more limited. However, I would like to implement my plugin with this possibility in mind.

  4. Hooking into the navigation bar is a huge pain.

To be honest I am not really sure what you could do to help me, but if you have comments about this, please post. I will greatly appreciate this.

Best wishes,
Bianca

6 Likes

Hi Bianca, sorry not much response on your issues atm, but could you elaborate on (4) please ? I’m currently working on the plugin api for the new select-box-kit and always interested to know what issues you had while using plugin api so I can avoid falling in the same traps.

1 Like

Sorry, when I said navigation bar I should have been more clear. It is the category / tags dropdown and the nav pills used for filters. What I want to do is add more categories to the list and eventually more nav pills. The problem here is that I want to add my “favorite category” to the dropdown and it is not an actual category.

So… the navigation bar consists of a “bread-crumbs” component which is the category drop down and a “navigation-bar” component which is the bar with “latest”, “new”, etc. How the category drop down is working right now is like:

  1. you can only choose from a list of categories and a “fake” category “all categories”.
  2. if selected category is undefined than it must be all categories selected, but in my case, it might be favorites categories

Hooking into this navigation bar actually requires a few hooks in a few places and seems to be a very ugly solution and error prone. Also, these hooks do not exist and if I add them, I doubt anyone will ever want to use them as they seem rather specific to my needs.

Anyway, what I am trying to say is that I think that some things might have a more simple implementation and I am wondering what were the design decisions behind the current design.

1 Like

OK that’s even more interesting, those dropdowns are not using the new select-box-kit YET, I don’t know about the design decisions leading to this (it’s also probably very old code), but let’s focus on present/future.

Can I see your code somewhere? It might help me understand your needs more easily.

1 Like

Take a look at the Hot Topics repo:

If I understand what you’re asking correctly, this plugin does a lot of what you’re talking about. It creates a new topic list that you add to the navigation bar in your site settings. Check out the Meta topic here for more on what it does:

Ultimately, you just need to create new filters for the ListController to work with. If you want to redefine the handlebars template for it you can. But in most cases, this isn’t necessary as you can see in this plugin. It simply needed the I18n YAML and it was ready to go.

Here’s an example from the Static Pages plugin.

/my-plugin/assets/javascripts/discourse/my-plugin-route-map.js.es6

export default function(){
  this.route('dl-static-pages', {path: '/page'}, function(){
    this.route('page', {path: '/' }, function(){
      this.route('show', {path: '/:slug/:id'});
    });
  });
};
5 Likes

Can you elaborate on the use case here? What is this for, what user need does it address? Can you provide a real world example?

2 Likes

If I understand correctly, this is something I always wanted to do.
In all social networks people subscribe. Once subscribed, the person gets exactly what he wants to see. Very convenient. Follow the categories, tags - topics (next people). Example: Quora.
A lot of people who want this implementation.

1 Like

Is it not this?

4 Likes