Skip to content

Commit

Permalink
💄 RENEW and REFACTOR update form and set the fields next to each other
Browse files Browse the repository at this point in the history
  • Loading branch information
stefrado committed Oct 18, 2024
1 parent bb83729 commit 82ea45d
Show file tree
Hide file tree
Showing 48 changed files with 1,635 additions and 1,719 deletions.
21 changes: 21 additions & 0 deletions src/sdg/components/templates/components/fields/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% if as_row %}
<tr {% if hide_element %}style="display: none"{% endif %}>
<td>
{% endif %}

<div class="form__field {% if inline %}form__field--inline{% endif %}">
<header class="form__field-header">
{% block header %}{% endblock %}
</header>

<div class="form__field-body">
{% block body %}{% endblock %}
</div>

{% block footer %}{% endblock %}
</div>

{% if as_row %}
</td>
</tr>
{% endif %}
18 changes: 18 additions & 0 deletions src/sdg/components/templates/components/fields/checkbox.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% extends 'components/fields/base.html' %}
{% load fields %}

{% block header %}
<label class="form__field-label">
{{field.label|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ field.help_text }}"></i>
</label>
{% endblock %}

{% block body %}
<div class="form__control">
<div class="form__control-body">
{{ field }}
{{ field.errors }}
</div>
</div>
{% endblock %}
17 changes: 17 additions & 0 deletions src/sdg/components/templates/components/fields/core.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'components/fields/base.html' %}
{% load fields %}

{% block header %}
<label class="form__field-label">
{{label|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ tooltip }}"></i>
</label>
{% endblock %}

{% block body %}
<div class="form__control">
<div class="form__control-body">
<p>{{ value }}</p>
</div>
</div>
{% endblock %}
91 changes: 91 additions & 0 deletions src/sdg/components/templates/components/fields/localized.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{% extends 'components/fields/base.html' %}
{% load fields utils i18n %}

{% block header %}
{% for field in object.bound_fields %}
{% if field.language == 'nl' %}
<label class="form__field-label">
{{field.label|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ field.help_text }}"></i>
</label>
{% endif %}
{% endfor %}
{% endblock %}

{% block body %}
{% for field in object.bound_fields %}
<div class="form__control" lang="{{ field.language }}">
<header class="form__control-header">
<p class="form__control-hint">
{% if field.language == 'nl' %}
{% trans 'Nederlands' %}
{% else %}
{% trans 'Engels' %}
{% endif %}

<i class="fas fa-info-circle fa-xs dark" title="{% trans 'De waarde voor deze taal is aangepast.' %}" aria-hidden="true"></i>
</p>
</header>
<div class="form__control-body" lang="{{ field.language }}">
{% if inline != True and 'dynamic_array' not in field.field.widget.template_name %}
<div class="diff" aria-hidden="true">
<header class="diff__versions">
<ins></ins>
<del></del>
</header>
<div class="form__input form__input--preview diff__preview"></div>
</div>
{% endif %}

{# Field. #}
<div class="form__input form__input--wrapper">
{{ field|addclass:"form__input" }}
{{ field.errors }}
</div>
</div>

{% if inline != True and 'dynamic_array' not in field.field.widget.template_name %}
<footer class="form__control-footer reference" aria-hidden="true">
<div class="reference__versions" aria-hidden="true">
<del></del>
<ins></ins>
</div>
<div class="form__input form__input--preview reference__preview">
<p class="italic">Geen standaardtekst beschikbaar</p>
</div>
</footer>
{% endif %}
</div>
{% endfor %}
{% endblock %}

{% block footer %}
{% for field in object.bound_fields %}
{% if forloop.counter == 1 and inline != True and 'dynamic_array' not in field.field.widget.template_name %}
<footer class="form__field-footer">
<section class="form__field-toolbar" aria-hidden="true">
<div class="button-group">
<button class="button button--light button--small form__diff-btn" type="button" title="{% trans "Toon de verschillen tussen mijn tekst en de standaardtekst" %}">
<i class="fa fa-eye fa-xs"></i>
{% trans 'Vergelijk met mijn teksten' %}
</button>
<button class="button button--light button--small reference__diff-btn" type="button"
title="{% trans "Toon de verschillen tussen mijn tekst en de standaardtekst" %}">
<i class="fa fa-eye fa-xs"></i>
{% trans 'Vergelijk met vorige versie' %}
</button>
<button class="button button--light button--small form__reference-btn" type="button">
<i class="fa fa-undo fa-xs"></i>
{% trans 'Gebruik standaardteksten' %}
</button>
</div>
</section>

<button class="button button--light button--small form__display-btn" type="button">
<i class="fa fa-chevron-right"></i>
{% trans 'Toon standaardtekst' %}
</button>
</footer>
{% endif %}
{% endfor %}
{% endblock %}
51 changes: 51 additions & 0 deletions src/sdg/components/templates/components/fields/localized_url.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% extends 'components/fields/base.html' %}
{% load utils fields i18n %}

{% block header %}
{% for field in bound_fields %}
{% if field.link and field.label and field.language == 'nl' %}
<label class="form__field-label">
{{field.link.label|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ field.link.help_text }}"></i>
</label>
{% endif %}
{% endfor %}
{% endblock %}

{% block body %}
{% for field in bound_fields %}
{% if field.link and field.label %}
<section class="form__control">
<header class="form__control-header">
<p class="form__control-hint">
{% if field.language == 'nl' %}
{% trans 'Nederlands' %}
{% else %}
{% trans 'Engels' %}
{% endif %}

<i class="fas fa-info-circle fa-xs dark" title="{% trans 'De waarde voor deze taal is aangepast.' %}" aria-hidden="true"></i>
</p>
</header>
<div class="form__control-body">
<div class="url_label_field">
<div
class="url_label_field__container"
data-initialized="true"
>
<div class="url_label_field__container-item">
{{ field.label|addlabelclass:"form__input form__input--left" }}
{{ field.link|addlinkclass:"form__input form__input--right" }}
</div>
{% if field.label.errors or field.link.errors %}
<div class="url_label_field__container-item url_label_field__container-item--errorlist">
{{ field.label.errors }}{{ field.link.errors}}
</div>
{% endif %}
</div>
</div>
</div>
</section>
{% endif %}
{% endfor %}
{% endblock %}
23 changes: 23 additions & 0 deletions src/sdg/components/templates/components/fields/nonlocalized.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% extends 'components/fields/base.html' %}
{% load fields utils %}

{% block header %}
{% for field in object.bound_fields %}
<label class="form__field-label">
{{field.label|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ field.help_text }}"></i>
</label>
{% endfor %}
{% endblock %}

{% block body %}
{% for field in object.bound_fields %}
{# Field. #}
<div class="form__control">
<div class="form__control-body">
{{ field|addclass:"form__input" }}
{{ field.errors }}
</div>
</div>
{% endfor %}
{% endblock %}
43 changes: 43 additions & 0 deletions src/sdg/components/templates/components/fields/readonly.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{% extends 'components/fields/base.html' %}
{% load producten fields i18n %}

{% block header %}
{% for field in object.bound_fields %}
{% if field.language == 'nl' %}
<label class="form__field-label">
{{field.configuration.label|default:field.verbose_name|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ field.configuration.tooltip|default:field.help_text }}"></i>
</label>
{% endif %}
{% endfor %}
{% endblock %}


{% block body %}
{% for field in object.bound_fields %}
<section class="form__control" lang={{field.language}}>
<header class="form__control-header">
<p class="form__control-hint">
{% if field.language == 'nl' %}
{% trans 'Nederlands' %}
{% else %}
{% trans 'Engels' %}
{% endif %}

<i class="fas fa-info-circle fa-xs dark" title="{% trans 'De waarde voor deze taal is aangepast.' %}" aria-hidden="true"></i>
</p>
</header>
<div class="form__control-body">
<section class="form__input form__input--preview">
{% if field.name == "product_titel" and field.landelijke_link %}
<a href="{{ field.landelijke_link }}" target="_blank">
{% field_info field %}
</a>
{% else %}
{% field_info field %}
{% endif %}
</section>
</div>
</section>
{% endfor %}
{% endblock %}
22 changes: 22 additions & 0 deletions src/sdg/components/templates/components/fields/select.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends 'components/fields/base.html' %}
{% load utils fields %}

{% block header %}
<label class="form__field-label">
{{field.label|capfirst}}
<i class="fas fa-info-circle fa-xs dark" title="{{ field.help_text }}"></i>
</label>
{% endblock %}

{% block body %}
<div class="form__control">
<div class="form__control-body">
<fieldset class="form__group--nopad">
<div class="select">
{{ field }}
</div>
</fieldset>
{{ field.errors }}
</div>
</div>
{% endblock %}
Loading

0 comments on commit 82ea45d

Please sign in to comment.