mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Add required text next to required fields
This commit is contained in:
parent
bb719ad844
commit
4433918d4c
@ -9,7 +9,6 @@ function updateOrder() {
|
||||
.map(x => x.dataset.id)
|
||||
.filter(x => x);
|
||||
|
||||
console.log(ids);
|
||||
document.querySelector("input[name='order']").value = ids.join(",");
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,30 @@
|
||||
{% endfor %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_label(field, label=None, label_visible=true) %}
|
||||
{% if field.type != 'HiddenField' %}
|
||||
{% if not label and label != "" %}{% set label=field.label.text %}{% endif %}
|
||||
{% if label %}
|
||||
<label for="{{ field.id }}" {% if not label_visible %}class="sr-only"{% endif %}>
|
||||
{{ label|safe }}
|
||||
</label>
|
||||
{% if field.flags.required and label_visible %}
|
||||
<span class="ml-1 text-danger">
|
||||
<small>
|
||||
<i class="fas fa-asterisk"></i>
|
||||
</small>
|
||||
</span>
|
||||
<span class="ml-3 text-muted">
|
||||
{{ _("Required") }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endmacro %}
|
||||
|
||||
{% macro render_field(field, label=None, label_visible=true, right_url=None, right_label=None, fieldclass=None, hint=None) -%}
|
||||
<div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}">
|
||||
{% if field.type != 'HiddenField' %}
|
||||
{% if not label and label != "" %}{% set label=field.label.text %}{% endif %}
|
||||
{% if label %}<label for="{{ field.id }}" {% if not label_visible %}class="sr-only"{% endif %}>{{ label|safe }}</label>{% endif %}
|
||||
{% endif %}
|
||||
{{ render_label(field, label, label_visible) }}
|
||||
{{ field(class_=fieldclass or 'form-control', **kwargs) }}
|
||||
{% if hint %}
|
||||
<small class="form-text text-muted">{{ hint | safe }}</small>
|
||||
@ -20,11 +38,7 @@
|
||||
|
||||
{% macro render_field_prefix(field, label=None, prefix="@", label_visible=true, right_url=None, right_label=None, fieldclass=None) -%}
|
||||
<div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}">
|
||||
{% if field.type != 'HiddenField' and label_visible %}
|
||||
{% if not label and label != "" %}{% set label=field.label.text %}{% endif %}
|
||||
{% if label %}<label for="{{ field.id }}">{{ label|safe }}</label>{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{ render_label(field, label, label_visible) }}
|
||||
<div class="input-group mb-3">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">{{ prefix }}</span>
|
||||
@ -38,11 +52,7 @@
|
||||
|
||||
{% macro render_field_prefix_button(field, label=None, prefix="@", label_visible=true, right_url=None, right_label=None, fieldclass=None, has_view=False, hint=None) -%}
|
||||
<div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}">
|
||||
{% if field.type != 'HiddenField' and label_visible %}
|
||||
{% if not label and label != "" %}{% set label=field.label.text %}{% endif %}
|
||||
{% if label %}<label for="{{ field.id }}">{{ label|safe }}</label>{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{ render_label(field, label, label_visible) }}
|
||||
<div class="input-group mb-1">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text" id="basic-addon1">{{ prefix }}</span>
|
||||
@ -104,10 +114,7 @@
|
||||
|
||||
{% macro render_multiselect_field(field, label=None, label_visible=true, right_url=None, right_label=None) -%}
|
||||
<div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}">
|
||||
{% if field.type != 'HiddenField' and label_visible %}
|
||||
{% if not label %}{% set label=field.label.text %}{% endif %}
|
||||
<label for="{{ field.id }}">{{ label|safe }}</label>
|
||||
{% endif %}
|
||||
{{ render_label(field, label, label_visible) }}
|
||||
<div class="multichoice_selector bulletselector form-control">
|
||||
<input type="text" placeholder="{{ _('Start typing to see suggestions') }}">
|
||||
<div class="clearboth"></div>
|
||||
@ -129,10 +136,7 @@
|
||||
|
||||
{% macro render_radio_field(field, hint=None, label=None, label_visible=true) -%}
|
||||
<div class="form-group {% if field.errors %}has-danger{% endif %} {{ kwargs.pop('class_', '') }}">
|
||||
{% if label_visible %}
|
||||
{% if not label and label != "" %}{% set label=field.label.text %}{% endif %}
|
||||
{% if label %}<label for="{{ field.id }}">{{ label|safe }}</label>{% endif %}
|
||||
{% endif %}
|
||||
{{ render_label(field, label, label_visible) }}
|
||||
{% for value, label, checked in field.iter_choices() %}
|
||||
<div class="form-check my-1">
|
||||
<label class="form-check-label">
|
||||
|
@ -132,6 +132,14 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label for="title">{{ _("Title") }}</label>
|
||||
<span class="ml-1 text-danger">
|
||||
<small>
|
||||
<i class="fas fa-asterisk"></i>
|
||||
</small>
|
||||
</span>
|
||||
<span class="ml-3 text-muted">
|
||||
{{ _("Required") }}
|
||||
</span>
|
||||
<input class="form-control" id="title" name="title" required="" type="text">
|
||||
</div>
|
||||
|
||||
|
@ -25,6 +25,14 @@ Remove {{ package.title }}
|
||||
|
||||
<div class="form-group">
|
||||
<label for="reason">{{ _("Reason") }}</label>
|
||||
<span class="ml-1 text-danger">
|
||||
<small>
|
||||
<i class="fas fa-asterisk"></i>
|
||||
</small>
|
||||
</span>
|
||||
<span class="ml-3 text-muted">
|
||||
{{ _("Required") }}
|
||||
</span>
|
||||
<input id="reason" class="form-control" type="text" name="reason" required minlength="5">
|
||||
<small class="form-text text-muted">
|
||||
{{ _("Reason for unapproval / deletion, this is shown in the audit log") }}
|
||||
|
@ -60,6 +60,14 @@
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
<div class="form-group">
|
||||
<label for="message">{{ _("Message") }}</label>
|
||||
<span class="ml-1 text-danger">
|
||||
<small>
|
||||
<i class="fas fa-asterisk"></i>
|
||||
</small>
|
||||
</span>
|
||||
<span class="ml-3 text-muted">
|
||||
{{ _("Required") }}
|
||||
</span>
|
||||
<input id="message" class="form-control" type="text" name="message" required minlength="5">
|
||||
<small class="form-text text-muted">
|
||||
{{ _("Message to display to banned user") }}
|
||||
|
Loading…
Reference in New Issue
Block a user