Alternative Voting Category Style

This theme component offers alternative styling for any specified categories that make use of the Discourse Voting plugin.

Installation

Repository Link
https://github.com/discourse/discourse-alternative-voting-category-style

If you are unfamiliar with theme components and how to install them, check out the theme installation guide. And if you’d like to learn more about Discourse themes, take a look at this guide.

Preview

The overall idea is based off of this mockup created by @erlend_sh.

Notable Features

  • Compact view
  • More prominent vote count
  • Colored icon to indicate that you voted on the topic

Settings

There is currently one setting use to specify which categories to apply the style:

Extra Customizations

If you want to customize the look of specific tags within your voting topic (see the “IN PROGRESS” tag in the preview image above), you can create an additional component and modify the following CSS to fit your needs

.voting-category.list-container {
    .topic-list-item:not(.about-topic) {
        // Common styling for all listed tags
        [data-tag-name="in-progress"],
        [data-tag-name="my-tag-one"],
        [data-tag-name="my-tag-two"] {
            font-weight: bold;
            text-transform: uppercase;
            font-family: Trebuchet MS;
        }
        // Specific styling for individual tags
        [data-tag-name="in-progress"] {
            color: #9e63d0;
        }
        [data-tag-name="my-tag-one"] {
            color: #5bd04a;
        }
        [data-tag-name="my-tag-two"] {
            color: #5f5dd0;
        }
    }
}

Future

The one thing that you may notice missing from the original mockup is an excerpt of the topic under the topic title. This feature would require changes to core or the voting plugin that will need to wait for now.

As always, please let me know if you experience any issues.

Big thanks @simon and @erlend_sh for working with me on this :heart_eyes:

「いいね!」 37

Great theme component! One thing I found was that the unlisted icon is not fitting into your design. The topic title is overlapping it.

03%20AM

「いいね!」 8

Thanks for the quick feedback! I will try to get that fixed a little later today :slightly_smiling_face:

Edit: @Sean_R I just pushed a quick fix. I may try to tinker with it a little more to get it even better, but there shouldn’t be any more overlap!

「いいね!」 6

Looks good now

image

I also had to change the CSS to make the topic list wider.

Was

.voting-category.list-container {
  max-width: $small-width;

Changed to

.voting-category.list-container {
  max-width: $large-width;
「いいね!」 6

Thanks for confirming that is fixed!

The smaller width was based on the original design. The rationale was that there was so little information displayed on each topic row that it would look odd at full width. I can imagine some people might feel the opposite - that the smaller width looks odd. A width option to toggle via a theme setting would be an easy addition. I’ll add that to my to-do list with this.

「いいね!」 5

This component has been updated! The changes include:

  • Support for font awesome changes
  • Additional setting to toggle between small-width and large-width
「いいね!」 6

Does this component still work?

I use an instance of free.discourse.group and am looking for an alternative for the Discourse Vote Plugin

The component still works, but it is meant to be used alongside the voting plugin, not instead. It only provides an alternative style option for the voting plugin.

「いいね!」 3

Ah, now I get it, thanks for your attention :hugs:

「いいね!」 3

Is somebody still actively using this? Tried it with the current Version of the voting Plugin (0.5), looks pretty good, but doesn’t seem to be functional anymore - at least in our instance.

Can you elaborate on what isn’t functioning? I just tested it out and everything seems to be working. Noting that this component is purely styling right now. You aren’t able to vote directly from the topic list.

「いいね!」 2

thanks for the immediate reply!!!

First

Noting that this component is purely styling right now. You aren’t able to vote directly from the topic list.

Ok, I did not realise that. I thought it would actually allow exactly that: Voting from the topic list. Good to know. Need to reevaluate then.

Second
It does not seem to show the actual data/votes. Two pictures here: one with the style activated and one deactivated.


I suspected a conflict with the theme used, but even using another one, it does not seem to solve the issue.

「いいね!」 1

Hmm I just tested it on an up-to-date site and I’m not having any issues with the vote count or “I voted” indicator:

Can you check to see if there are any errors in your browser’s console? Have you tried with a brand new default theme with no other components or customizations added?

「いいね!」 2

You should be able to add a CSS rule to a theme/component to fix this up. I don’t have the Ratings plugin installed to test this, but I think it should be something like:

.rating-list {
  margin-left: 65px;
}

I’m actually doing some work on this component right now (it hadn’t been touched in a long time!), so I’ll see if I can make it so that any custom topic list content is positioned correctly by default.

「いいね!」 3

Perfect, thank you :ok_hand:

「いいね!」 1

このテーマコンポーネントをインストールし、2つのカテゴリで有効にしました。1つはバグがあり、もう1つは正常に表示されます。違いは、カテゴリ名がリストに表示され、投票数と重なっていることです。考えられる唯一の違いは、バグのあるカテゴリにはサブカテゴリがあり、もう一方にはないことです。

バグあり、サブカテゴリあり:

正常、サブカテゴリなし:

参考までに、これはGrey Amberカラーパレットのデフォルトテーマです。

「いいね!」 1

レポートありがとうございます。コンポーネントを更新すると、以下の修正が適用されます。

「いいね!」 4

この超高速な対応に本当に感謝します!修正はうまくいきました。

追伸:#voting タグを追加してください。このコンポーネントは隠しておくには良すぎます。 :slight_smile:

「いいね!」 3

個々のトピックの投票インジケーターが同じように見えるようにするテーマコンポーネントはありますか?

「いいね!」 1

このコンポーネントは、参加者、ビュー、アクティビティ時間を表示する列も非表示にします。それを分離して、投票スタイルの変更だけを簡単に有効にできるようにすると良いかもしれません。そうすれば、それらを非表示にすることなく済むでしょう。

または、

  .posters,
  .views,
  .activity {
    display: none;
  }

@if $use_compact_width == \"true\" { の中に移動しますか?

「いいね!」 2