The Voting plugin offers a “Votes” item for the top menu in the categories where it is enabled. Clicking this option users get a list of most voted topics in that category.
For sites built around this Voting feature it would be very useful to have a “Votes” option in the main page top menu. Admins could set the Votes view as default, and users could too in their preferences, just like Latest, Categories, Top…
If the Votes are enabled in more than one category, this view would provide a consolidated ranking of voted topics from multiple categories.
「いいね!」 1
I just learned that appending “/votes” to the Discourse instance URL provides that consolidated list of votes. Example:
Therefore what is only missing is the possibility to add a “Votes” option in the top menu.
Can this be achieved with a theme component, or must this addition be made to the Voting plugin?
4ong
(Anatol Myshkin)
2021 年 11 月 6 日午後 7:56
3
Hi @icaria36
Try GitHub - discourse/Discourse-nav-links-component
If you want to add a link to the navigation menu.
Do you prefer it visible for all members? Or particular groups?
「いいね!」 1
はい、Custom Top Navigation Links ですね。良い点をご指摘いただきありがとうございます。
このテーマコンポーネントが、投票が有効になっているカテゴリのトップメニューに表示される「Votes」および「My Votes」リンクにどのような影響を与えるか気になっています。このテーマコンポーネントがカテゴリのナビゲーションに与える影響について、多くのコメントを読みましたが、明確な印象は得られませんでした。試してみる必要がありますが、一つの問題を解決するために、いくつかの新しい問題を引き起こすのではないかという印象を持っています。
要求されている動作は、他の非常に人気のある2つのプラグインが提供するものと全く同じです。Events Plugin 📅 および https://meta.discourse.org/t/locations-plugin/69742。どちらも、Discourseのトップメニュー項目と同様に追加および削除できるトップメニュー項目をもたらします。
もし「Votes」がトップメニューの最初の項目であれば、「/votes」ページがデフォルトで表示されるでしょう。
これらのプラグインのコードの一部を再利用できるかもしれません。もしプルリクエスト(PR)が歓迎され、@angus または他の誰かが興味を持てば、私たちはこれを「マーケットプレイス化」することさえできるかもしれません(パッチの作成とテストがどれほど簡単または複雑かは全く分かりません)。
angus
(Angus McLeod)
2021 年 11 月 10 日午前 2:50
6
このようなものでうまくいくはずです。
main ← angusmcleod:add_homepage_navigattion
opened 02:47AM - 10 Nov 21 UTC
Adds settings that allow you to use the ``votes`` and ``my votes`` lists on the … homepage.
Note that ``/votes`` and ``/latest?order=votes`` currently return different results, partly because the topic list version has a secondary order attribute ``topics.bumped_at``. I've added that as a secondary attribute to the ``/votes`` list.
2つの設定が追加されます。
voting_show_votes_on_homepage: 「ホームページに投票リストナビゲーション項目を表示しますか?」
voting_show_votes_before: 「このナビゲーション項目の前に投票リストナビゲーション項目を表示します」
現在、プラグインの /votes と /latest?order=votes の間にこの機能に影響する違いがあるため、ドラフト状態のままにしてあります。まず、メンテナーからのフィードバックが必要です。
「いいね!」 3
@angus 、あなたは多くの点で素晴らしいです。本当にありがとうございます!
興味深いですね。/votes は、同じ票数のトピックに対して、2番目のソート基準として「最新」を持っているようです。これは /latest?order=votes で期待されることですが、何らかの理由で2番目のソート基準が異なります。パターンを見つけることができませんでした。
また、ソート基準に触れる人がいる場合に備えてメモしておきます。現在、票数がゼロのトピックと、票の概念がないトピックがすべて混在しています。票数がゼロのトピックをすべて一緒にし、その後、投票が有効になっていないトピックを最後に、別に表示する方が理にかなっています。
「いいね!」 1