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!
3 curtidas
david
(David Taylor)
Março 17, 2020, 3:35pm
2
discourse-assign is probably the best example of this:
# frozen_string_literal: true
class ::TopicAssigner
def self.backfill_auto_assign
deprecation_note
Assigner.backfill_auto_assign
end
def self.assigned_self?(text)
deprecation_note
Assigner.assigned_self?(text)
end
def self.auto_assign(post, force: false)
deprecation_note
Assigner.auto_assign(post, force)
end
def self.is_last_staff_post?(post)
deprecation_note
This file has been truncated. show original
And then some stuff to add the icon / content
https://github.com/discourse/discourse-assign/blob/master/assets/javascripts/discourse-assign/initializers/extend-for-assigns.js.es6#L158-L169
11 curtidas
Thanks, this helped out a lot.
What would be the best way to go about making the small action display richer text?
Current:
What I want: (I achieved this by manually inserting the cooked class into the div with class small-action-desc)
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 curtidas