Topic List Sort By Votes in voting plugin

Any idea for when the plugin API will offer the functionality to let sorting by votes be included in the plugin?

Hoping “soon” is soon. :smiley:

I have added the required plugin API in discourse#7158 and used it in discourse-voting#38.

Sorry for taking me so long. :cry:

9 curtidas

This is awesome, sorting by votes is now an option, but is there any way to make it a category default through the plugin per OP?

The Wyze Wishlist appears to sort by votes by default, but I’ve not had time to dig through their page to see if they’re using another method.

With the voting plugin installed these are the two available options:

09%20PM

Did I miss a step?

1 curtida

You can add the option like this

<script type="text/discourse-plugin" version="0.8.25">
  api.modifyClass('component:edit-category-settings', {
    availableViews: Ember.computed(function() {
      let views = this._super();
      let voteView = {};
      voteView["name"] = "Votes";
      voteView["value"] = "votes";
      views.push(voteView);
      return views;
    })
  });
</script>

Seems like it would be a nice option to include in the plugin.

5 curtidas

Thanks, that gets most of the way.

For some reason items in the extra-nav-item-outlet apply the active class to the list item rather than the link, so ‘Votes’ isn’t shown as active. Is that intentional?

I’ve created a CSS workaround for now, styling both .nav-pills>li.active a and .nav-pills>li a.active.

A post was split to a new topic: Topics that were voted on disappear from user profile after being closed

Hello Stephen,

Could you please assist in explaining where I need to place @awesomerobot 's code for my topics to be ranked by vote on my Boxes with Featured Topics desktop category page style?

Many thanks,

AGEID

Também gostaria de ajuda sobre onde colocar esse código, @awesomerobot?

Também notei que, se eu usar as configurações abaixo, isso faz com que a aba “Mais recentes” mostre os mais votados em vez dos mais recentes e, portanto, você não consegue ver os tópicos mais recentes. Isso é um bug ou algo que estou fazendo de errado?

Gostaria que a categoria, por padrão, fosse ordenada por votos (desc), com os usuários tendo a opção de ordenar por mais recentes, se assim desejarem. Obrigado.

1 curtida

Não, isso parece estar funcionando como pretendido, embora não seja a melhor experiência. Quando a “ordenação da lista de tópicos por” é alterada para Votos, é confuso que ainda seja chamada de “Mais recente”.

Você pode colocá-lo na seção Head do seu tema, em admin → personalizar → temas.

3 curtidas