diff --git a/common/static/scss/_dialog.scss b/common/static/scss/_dialog.scss index a973ed00..a13f7992 100644 --- a/common/static/scss/_dialog.scss +++ b/common/static/scss/_dialog.scss @@ -78,11 +78,11 @@ dialog { .grid>div:nth-child(2) fieldset { float: unset; } + .grid { + grid-row-gap: 0; + } } - fieldset { - margin: 0; - } article { padding-bottom: 1em; diff --git a/common/static/scss/_l10n.scss b/common/static/scss/_l10n.scss index 8c40ef0e..0cfb39d9 100644 --- a/common/static/scss/_l10n.scss +++ b/common/static/scss/_l10n.scss @@ -1,4 +1,4 @@ -h1, h2, h3, h4, h5, h6 { +h1, h2, h3, h4, h5 { text-transform: capitalize; } diff --git a/common/templates/_sidebar.html b/common/templates/_sidebar.html index cca046c2..1720452f 100644 --- a/common/templates/_sidebar.html +++ b/common/templates/_sidebar.html @@ -35,7 +35,7 @@ -
+
{{ identity.display_name }}
@@ -68,9 +68,10 @@ {% include 'users/profile_actions.html' %} {% endif %} -

- {{ identity.summary|bleach:"a,p,span,br"|default:"
" }} -

+
+ {{ identity.summary|bleach:"a,p,span,br"|default:"" }} +
+
diff --git a/journal/migrations/0025_pin_tags.py b/journal/migrations/0025_pin_tags.py new file mode 100644 index 00000000..828460d9 --- /dev/null +++ b/journal/migrations/0025_pin_tags.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.13 on 2024-06-04 19:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("journal", "0024_i18n"), + ] + + operations = [ + migrations.AddField( + model_name="tag", + name="pinned", + field=models.BooleanField(default=False, null=True), + ), + ] diff --git a/journal/models/tag.py b/journal/models/tag.py index 1eeba59a..2858b361 100644 --- a/journal/models/tag.py +++ b/journal/models/tag.py @@ -47,8 +47,7 @@ class Tag(List): title = models.CharField( max_length=100, null=False, blank=False, validators=TagValidators ) - # TODO case convert and space removal on save - # TODO check on save + pinned = models.BooleanField(default=False, null=True) class Meta: unique_together = [["owner", "title"]] @@ -61,7 +60,27 @@ class Tag(List): @staticmethod def deep_cleanup_title(title): """Remove all non-word characters, only for public index purpose""" - return re.sub(r"\W+", " ", title).rstrip().lstrip("# ").lower() or "_" + return re.sub(r"\W+", " ", title).rstrip().lstrip("# ").lower()[:100] or "_" + + def update( + self, title: str, visibility: int | None = None, pinned: bool | None = None + ): + old_title = Tag.deep_cleanup_title(self.title) + new_title = Tag.deep_cleanup_title(title) + was_pinned = bool(self.pinned) + if visibility is not None: + self.visibility = 2 if visibility else 0 + if pinned is not None: + self.pinned = pinned + self.title = title + self.save() + if was_pinned != self.pinned or (old_title != new_title and self.pinned): + from takahe.utils import Takahe + + if was_pinned: + Takahe.unpin_hashtag_for_user(self.owner.pk, old_title) + if self.pinned: + Takahe.pin_hashtag_for_user(self.owner.pk, new_title) class TagManager: diff --git a/journal/templates/tag_edit.html b/journal/templates/tag_edit.html index 0e06c488..dff32184 100644 --- a/journal/templates/tag_edit.html +++ b/journal/templates/tag_edit.html @@ -4,72 +4,57 @@ {% load humanize %} {% load mastodon %} {% load thumb %} -