Merge pull request 'Fixed menu translation' (#20) from fix/menu_translation into main
Reviewed-on: #20pull/21/head 0.4.1
commit
dd0998b96b
|
@ -39,15 +39,15 @@
|
|||
<div class="container">
|
||||
<div class="row">
|
||||
{% if navbar_position == 'top' %}
|
||||
<div class="col-md-12 mt-5 ml-2">
|
||||
{% main_menu max_levels=3 template="menu/custom_main_menu.html" %}
|
||||
</div>
|
||||
{% with size=12 %}
|
||||
{% include 'includes/menu_block.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
|
||||
{% if navbar_position == 'left' %}
|
||||
<div class="col-md-3 mt-5 ml-2">
|
||||
{% main_menu max_levels=3 template="menu/custom_main_menu.html" %}
|
||||
</div>
|
||||
{% with size=3 %}
|
||||
{% include 'includes/menu_block.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
<div class="col-md-9 mt-5 ml-2">
|
||||
{% for message in messages %}
|
||||
|
@ -58,9 +58,9 @@
|
|||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
{% if navbar_position == 'right' %}
|
||||
<div class="col-md-3 mt-5 ml-2">
|
||||
{% main_menu max_levels=3 template="menu/custom_main_menu.html" %}
|
||||
</div>
|
||||
{% with size=3 %}
|
||||
{% include 'includes/menu_block.html' %}
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{% load menu_tags %}
|
||||
{% load i18n %}
|
||||
|
||||
<div class="col-md-{{size}} mt-5 ml-2">
|
||||
{% main_menu max_levels=3 template="menu/custom_main_menu.html" use_specific=3%}
|
||||
</div>
|
|
@ -10,16 +10,32 @@
|
|||
<ul class="nav navbar-nav">
|
||||
|
||||
{% for item in menu_items %}
|
||||
<li class="{{ item.active_class }}">
|
||||
<a href="{{ item.href }}">{{ item.text }}</a>
|
||||
{% if item.has_children_in_menu %}
|
||||
<button class="btn btn-toggle" data-bs-target="#ddtoggle_{{ item.link_page.pk }}" data-bs-toggle="collapse"
|
||||
aria-expanded={% if item.active_class %}"true" {% else %} "false" {% endif %}
|
||||
aria-controls="#ddtoggle_{{ item.link_page.pk }}">
|
||||
<img src = "{% static 'images/icons/caret-down.svg' %}" alt="∨"/> </button>
|
||||
{% sub_menu item template="menu/custom_submenu.html" %}
|
||||
{% endif %}
|
||||
</li>
|
||||
|
||||
{% if item.link_page %}
|
||||
<li class="{{ item.active_class }}">
|
||||
<a href="{% pageurl item.link_page.localized %}">{{ item.link_page.localized }}</a>
|
||||
{% if item.has_children_in_menu %}
|
||||
<button class="btn btn-toggle" data-bs-target="#ddtoggle_{{ item.link_page.pk }}" data-bs-toggle="collapse"
|
||||
aria-expanded={% if item.active_class %}"true" {% else %} "false" {% endif %}
|
||||
aria-controls="#ddtoggle_{{ item.link_page.pk }}">
|
||||
<img src = "{% static 'images/icons/caret-down.svg' %}" alt="∨"/> </button>
|
||||
{% sub_menu item.link_page template="menu/custom_submenu.html" use_specific=3 %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="{{ item.active_class }}">
|
||||
<a href="{{item.href}}">{{item.text}}</a>
|
||||
{% if item.has_children_in_menu %}
|
||||
<button class="btn btn-toggle" data-bs-target="#ddtoggle_{{ item.link_page.pk }}" data-bs-toggle="collapse"
|
||||
aria-expanded={% if item.active_class %}"true" {% else %} "false" {% endif %}
|
||||
aria-controls="#ddtoggle_{{ item.link_page.pk }}">
|
||||
<img src = "{% static 'images/icons/caret-down.svg' %}" alt="∨"/> </button>
|
||||
{% sub_menu item.link_page template="menu/custom_submenu.html" use_specific=3 %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
<ul class={% if item.active_class %} "sub-menu collapse show fw-normal pb-1 small" {% else %} "sub-menu collapse fw-normal pb-1 small" {% endif %}
|
||||
id="ddtoggle_{{ item.link_page.pk }}">
|
||||
{% for sub_item in menu_items %}
|
||||
<li><a href="{{ sub_item.href }}" class="{{ sub_item.active_class }}">{{ sub_item.text }}</a></li>
|
||||
{% if sub_item.localized %}
|
||||
<li><a href="{{ sub_item.localized.url }}" class="{{ sub_item.active_class }}">{{sub_item.localized}}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ sub_item.href }}" class="{{ sub_item.active_class }}">{{sub_item.text}}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -20,9 +20,9 @@ services:
|
|||
environment:
|
||||
- RABBITMQ_DEFAULT_USER
|
||||
- RABBITMQ_DEFAULT_PASS
|
||||
ports:
|
||||
- "5672:5672" # We forward this port because it's useful for debugging
|
||||
- "15672:15672" # Here, we can access RabbitMQ management plugin
|
||||
# ports:
|
||||
# - "5672:5672" # We forward this port because it's useful for debugging
|
||||
# - "15672:15672" # Here, we can access RabbitMQ management plugin
|
||||
|
||||
smtp-server:
|
||||
image: mailhog/mailhog
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
from django import forms
|
||||
from dynamic_forms.widgets import (
|
||||
CheckboxSelectMultiple,
|
||||
CheckboxInput,
|
||||
RadioSelect
|
||||
)
|
||||
|
||||
|
||||
class MultipleFileInput(forms.ClearableFileInput):
|
||||
|
@ -27,11 +32,11 @@ class DynamicForm(forms.Form):
|
|||
"email": forms.EmailField(max_length=255, widget=forms.EmailInput(attrs={"class": "form-control"})),
|
||||
"number": forms.IntegerField(widget=forms.NumberInput(attrs={"class": "form-control"})),
|
||||
"url": forms.URLField(max_length=255, widget=forms.URLInput(attrs={"class": "form-control"})),
|
||||
"checkbox": forms.BooleanField(required=False, widget=forms.CheckboxInput(attrs={"class": "form-control"})),
|
||||
"checkboxes": forms.MultipleChoiceField(required=False, widget=forms.CheckboxSelectMultiple(attrs={"class": "form-control"})),
|
||||
"checkbox": forms.BooleanField(required=False, widget=CheckboxInput(attrs={"class": "form-check"})),
|
||||
"checkboxes": forms.MultipleChoiceField(required=False, widget=CheckboxSelectMultiple(attrs={"class": "form-check"})),
|
||||
"dropdown": forms.ChoiceField(widget=forms.Select(attrs={"class": "form-control"})),
|
||||
"multiselect": forms.MultipleChoiceField(widget=forms.SelectMultiple(attrs={"class": "form-control"})),
|
||||
"radio": forms.ChoiceField(widget=forms.RadioSelect(attrs={"class": "form-control"})),
|
||||
"radio": forms.ChoiceField(widget=RadioSelect(attrs={"class": "form-control"})),
|
||||
"date": forms.DateField(widget=forms.DateInput(attrs={"class": "form-control"})),
|
||||
"datetime": forms.DateTimeField(widget=forms.DateTimeInput(attrs={"class": "form-control"})),
|
||||
"hidden": forms.CharField(widget=forms.HiddenInput()),
|
||||
|
|
|
@ -77,7 +77,7 @@ class EmailFormSubmission(AbstractFormSubmission):
|
|||
template_name="form_mail",
|
||||
recipient=address,
|
||||
sender=from_address,
|
||||
context=data,
|
||||
context={"form_data": data},
|
||||
attachments=attachments
|
||||
)
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<h1>{{ page.title }}</h1>
|
||||
<p class="meta">{{ page.date }}</p>
|
||||
{% if form %}
|
||||
{{form.errors}}
|
||||
<div>{{ page.intro|richtext }}</div>
|
||||
<form enctype="multipart/form-data" action="{% pageurl page %}" method="POST">
|
||||
{% csrf_token %}
|
||||
|
@ -19,7 +20,9 @@
|
|||
<small id="emailHelp" class="form-text text-muted">
|
||||
{% trans field.help_text %}
|
||||
</small>
|
||||
|
||||
{% if field.error %}
|
||||
{{error}}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div class="text-end mt-3">
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="{{ widget.attrs.id }}"
|
||||
name="{{ widget.name }}">
|
||||
<label class="form-check-label" for="{{ widget.attrs.id }}">
|
||||
{{ widget.name }}
|
||||
</label>
|
||||
</div>
|
|
@ -0,0 +1,14 @@
|
|||
{% for group, options, index in widget.optgroups %}
|
||||
{% if group %}
|
||||
<label>{{ group }}</label>
|
||||
{% endif %}
|
||||
{% for option in options %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" value="{{ option.value }}" id="{{ option.attrs.id }}"
|
||||
name="{{ option.name }}">
|
||||
<label class="form-check-label" for="{{ option.attrs.id }}">
|
||||
{{ option.value }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
|
@ -0,0 +1,15 @@
|
|||
{% for group, options, index in widget.optgroups %}
|
||||
{% if group %}
|
||||
<label>{{ group }}</label>
|
||||
{% endif %}
|
||||
{% for option in options %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio"
|
||||
value="{{ option.value }}" id="{{ option.attrs.id }}"
|
||||
name="{{ option.name }}">
|
||||
<label class="form-check-label" for="{{ option.attrs.id }}">
|
||||
{{ option.value }}
|
||||
</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
|
@ -0,0 +1,13 @@
|
|||
from django import forms
|
||||
|
||||
|
||||
class CheckboxInput(forms.CheckboxInput):
|
||||
template_name = "widgets/checkbox.html"
|
||||
|
||||
|
||||
class CheckboxSelectMultiple(forms.CheckboxSelectMultiple):
|
||||
template_name = "widgets/checkbox_multiple.html"
|
||||
|
||||
|
||||
class RadioSelect(forms.RadioSelect):
|
||||
template_name = "widgets/radio_multiple.html"
|
Ładowanie…
Reference in New Issue