diff --git a/static/css/style.css b/static/css/style.css index c19ba90..d44b9be 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -434,6 +434,7 @@ p.authorization-code { font-size: 140%; } + /* Icon menus */ .icon-menu .option { @@ -870,6 +871,35 @@ button:hover, .right-column .button { padding: 2px 6px; } +form .field.multi-option { + margin-bottom: 10px; +} +form .field.multi-option { + margin-bottom: 10px; +} +form .option.option-row { + margin: 0px 0px 5px 0px; +} +.option-row .right { + float: right; +} +form .option-row .option-field { + vertical-align: middle; + display: inline-block; + line-height: normal; + width: 40%; + min-width: 30px; + padding-left: 0px; + padding-right: 7px; + +} + +form .option-row .right button { + vertical-align: middle; + margin-top: 0px; + margin-right: 5px; +} + /* Logged out homepage */ @@ -933,6 +963,32 @@ h1.identity small { margin: 0 0 10px 0; } +.identity-metadata .metadata-pair { + display: block; + margin: 0px 0 10px 0; + background: var(--color-bg-box); + box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.1); + color: inherit; + text-decoration: none; + padding: 10px 20px; + border: 2px solid rgba(255, 255, 255, 0); + border-radius: 10px; + overflow: hidden; +} + +.identity-metadata .metadata-pair .metadata-name { + display: inline-block; + min-width: 80px; + margin-right: 15px; + text-align: right; + color: var(--color-text-dull); +} +.identity-metadata .metadata-pair .metadata-name::after { + padding-left: 3px; + + color: var(--color-text-dull); +} + .system-note { background: var(--color-bg-menu); color: var(--color-text-dull); @@ -1602,3 +1658,7 @@ form .post { .debug-section .hidden { display: none; } + +.field .hidden { + display: none; +} diff --git a/templates/forms/_json_name_value_list.html b/templates/forms/_json_name_value_list.html new file mode 100644 index 0000000..65a7262 --- /dev/null +++ b/templates/forms/_json_name_value_list.html @@ -0,0 +1,72 @@ +{% with name_one=field_name_one|default:"name" name_two=field_name_two|default:"value" %} + + + +{% include "forms/_field.html" %} + +
+
+ + +
+ + + +
+ + + +
+ +
+ +{% endwith %} diff --git a/templates/identity/view.html b/templates/identity/view.html index 39f73cc..d5619fc 100644 --- a/templates/identity/view.html +++ b/templates/identity/view.html @@ -68,14 +68,14 @@ {% endif %} {% if identity.metadata %} - +
{% for entry in identity.safe_metadata %} -
- - +
+ {{ entry.name }} + {{ entry.value }} +
{% endfor %} -
{{ entry.name }} - {{ entry.value }}
+ {% endif %} {% if identity.local and identity.config_identity.visible_follows %} diff --git a/templates/settings/profile.html b/templates/settings/profile.html index 3cac026..3e878dd 100644 --- a/templates/settings/profile.html +++ b/templates/settings/profile.html @@ -3,15 +3,19 @@ {% block subtitle %}Profile{% endblock %} {% block content %} -
+ {% csrf_token %} +
Details {% include "forms/_field.html" with field=form.name %} {% include "forms/_field.html" with field=form.summary %} + {% include "forms/_json_name_value_list.html" with field=form.metadata %} {% include "forms/_field.html" with field=form.discoverable %} {% include "forms/_field.html" with field=form.visible_follows %}
+
Images {% include "forms/_field.html" with field=form.icon %} diff --git a/users/views/settings/profile.py b/users/views/settings/profile.py index 599d653..0e9ebf4 100644 --- a/users/views/settings/profile.py +++ b/users/views/settings/profile.py @@ -47,6 +47,12 @@ class ProfilePage(FormView): widget=forms.Select(choices=[(True, "Visible"), (False, "Hidden")]), required=False, ) + metadata = forms.JSONField( + label="Profile Metadata Fields", + help_text="These values will appear on your profile below your Bio", + widget=forms.HiddenInput, + required=False, + ) def get_initial(self): identity = self.request.identity @@ -57,6 +63,7 @@ class ProfilePage(FormView): "image": identity.image and identity.image.url, "discoverable": identity.discoverable, "visible_follows": identity.config_identity.visible_follows, + "metadata": identity.metadata, } def form_valid(self, form): @@ -78,6 +85,9 @@ class ProfilePage(FormView): image.name, resize_image(image, size=(1500, 500)), ) + metadata = form.cleaned_data.get("metadata") + if metadata: + identity.metadata = metadata identity.save() identity.transition_perform(IdentityStates.edited)