summaryrefslogtreecommitdiffstats
path: root/activities/views/compose.py
diff options
context:
space:
mode:
Diffstat (limited to 'activities/views/compose.py')
-rw-r--r--activities/views/compose.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/activities/views/compose.py b/activities/views/compose.py
index 3c2e3a8..08b54ab 100644
--- a/activities/views/compose.py
+++ b/activities/views/compose.py
@@ -30,6 +30,19 @@ class Compose(FormView):
"autofocus": "autofocus",
"maxlength": Config.lazy_system_value("post_length"),
"placeholder": "What's on your mind?",
+ "_": f"""
+ on load or input
+ set characters to my.value.trim().length
+ put { Config.system.post_length } - characters into #character-counter
+
+ if characters > { Config.system.post_length } then
+ set #character-counter's style.color to 'var(--color-text-error)'
+ add [@disabled=] to #post-button
+ else
+ set #character-counter's style.color to ''
+ remove @disabled from #post-button
+ end
+ """,
},
)
)