FIX: make compatible with 'debundled plugin css assets' feature.

FIX: make compatible with ‘debundled plugin css assets’ feature.

diff --git a/assets/stylesheets/reviewable-akismet-post-styles.scss b/assets/stylesheets/reviewable-akismet-post-styles.scss
index 095624f..4af0256 100644
--- a/assets/stylesheets/reviewable-akismet-post-styles.scss
+++ b/assets/stylesheets/reviewable-akismet-post-styles.scss
@@ -1,3 +1,5 @@
+@import "common/components/buttons";
+
 .reviewable-akismet-post {
   .created-by {
     margin-right: 1em;

GitHub sha: c85e23b0

Adding this import means that we load the entire buttons stylesheet into the akismet CSS file, and it causes some unusual behaviour

I think we should try to avoid using @extend here. I wonder if we can add the btn-danger class directly to the element, rather than doing it in CSS :thinking:

cc @romanrizzi

2 Likes

The class can’t be directly added to the element, because actions are not defined conventionally, they’re dynamically generated as Ruby objects, then serialized and sent to the frontend.

An Akismet reviewable object defines available actions this way:

The action API is defined here (They don’t know about CSS classes):

@romanrizzi I wonder if it would make sense to add an option that add “btn-danger” to the button as a class?

I don’t love including the whole button scss and copying/pasting the css doesn’t seem like a great alternative either.

2 Likes

@eviltrout is this the kind of API design you were thinking of?

3 Likes

Yes exactly @davidtaylorhq

3 Likes

FIX: Set button styles using new button_class API