Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Display multilingual relation labels #344

Merged
merged 8 commits into from
Feb 17, 2025

Conversation

bellisk
Copy link
Contributor

@bellisk bellisk commented Feb 11, 2025

No description provided.

Also, make the values in the 'label' dict singular, so we can use them to label each relation ('Relation 1', 'Relation 2'...). This will make the form less confusing now we have texts in all for languages for the relations, going from two fields to five per relation.
@bellisk bellisk force-pushed the feat/allow-multilingual-relations branch from d37da2f to b7826c7 Compare February 12, 2025 10:05
@bellisk bellisk force-pushed the feat/allow-multilingual-relations branch from b7826c7 to 091bca0 Compare February 12, 2025 10:52
"""
relations = _get_relations_from_storage(data)
if not relations:
relations = get_relations_from_form(data)

data_empty = {'title': '', 'url': ''}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were using three different terms for the text of a relation in various places in the code (label, title, text) and it was a mess. I'm eliminating title to simplify things a bit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@@ -2,13 +2,13 @@
{% set publisher = h.ogdch_publisher_form_helper(data) %}

{# Input for publisher names in multiple languages #}
{% for lang in ['fr', 'de', 'it', 'en'] %}
{% for lang in h.fluent_form_languages(field, entity_type, object_type, schema) %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the order of languages the same as in the other multilingual form snippets.

Comment on lines +10 to +11
label=lang.upper() ~ ' ' + h.scheming_language_text(field.label_name),
placeholder=lang.upper() ~ ' ' + h.scheming_language_text(field.form_placeholder_name),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making the multilingual labels and placeholders consistent with the other multilingual form snippets.

@@ -2,19 +2,24 @@

{% set relations_rows = h.ogdch_relations_form_helper(data) %}
{%- for row in relations_rows -%}
<h4 class="relation-label {{row.css_class}}">{{h.scheming_language_text(field.label) ~ ' ' ~ row.index}}</h4>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a header for each relation in the form, just "Relation 1," "Relation 2," etc., because the form looks very cluttered now that there are five text-inputs per relation. :( Not sure how to improve this without spending a lot of extra time on it.

Screenshot 2025-02-12 at 15-41-42 Datensätze - opendata swiss

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@bellisk bellisk marked this pull request as ready for review February 12, 2025 14:45
firstHiddenRows.addClass('ogdch-show-row');
var firstHiddenLabel = $('.relation-label.ogdch-hide-row')
.slice(0, 1);
firstHiddenLabel.addClass('ogdch-show-row')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firstHiddenLabel.addClass('ogdch-show-row');
; - should be added

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

"""
relations = _get_relations_from_storage(data)
if not relations:
relations = get_relations_from_form(data)

data_empty = {'title': '', 'url': ''}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my

"""
relations = _get_relations_from_storage(data)
if not relations:
relations = get_relations_from_form(data)

data_empty = {'title': '', 'url': ''}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@@ -2,19 +2,24 @@

{% set relations_rows = h.ogdch_relations_form_helper(data) %}
{%- for row in relations_rows -%}
<h4 class="relation-label {{row.css_class}}">{{h.scheming_language_text(field.label) ~ ' ' ~ row.index}}</h4>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

@bellisk bellisk merged commit ab1b6bb into master Feb 17, 2025
4 checks passed
@bellisk bellisk deleted the feat/allow-multilingual-relations branch February 17, 2025 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants