Steps for creating custom small-actions to use in plugin?

I’m working on some domain-specific plugins for our forum and we would like to create custom small actions similar to these:

In particular I just need to be able to put notices like these on the topic but being able to customize the icon and the text.

Can anyone walk me through the constructs/modules/templates/etc I would need to hook into to accomplish this on the back-end and front-end, or could you point me to an existing plugin that currently implements this?

Thank you!

2 Likes

discourse-assign is probably the best example of this:

And then some stuff to add the icon / content

10 Likes

Thanks, this helped out a lot.

What would be the best way to go about making the small action display richer text?

Current:
image

What I want: (I achieved this by manually inserting the cooked class into the div with class small-action-desc)

image

I skimmed through the source code about post transformers but could not find anything related to this


EDIT: ended up just adding this as .scss

.custom-message {
    ins {
        background-color: dark-light-choose(
            $success-low,
            scale-color($success, $lightness: -60%)
        );
    }
    del {
        background-color: dark-light-choose(
            $danger-low,
            scale-color($danger, $lightness: -60%)
        );
    }
}
5 Likes