mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-04 00:19:36 +00:00
Renamed form/ templates folder to recommended snake_case style
This commit is contained in:
parent
12d4c2f4d9
commit
1559b669df
8 changed files with 4 additions and 4 deletions
79
templates/form/collection_types_layout.html.twig
Normal file
79
templates/form/collection_types_layout.html.twig
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
{% block project_bom_entry_collection_widget %}
|
||||
{% import 'components/collection_type.macro.html.twig' as collection %}
|
||||
<div {{ collection.controller(form, 'project.bom.delete.confirm', 3) }}>
|
||||
<table class="table table-striped table-bordered table-sm" {{ collection.target() }}>
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th> {# expand button #}
|
||||
<th>{% trans %}project.bom.quantity{% endtrans %}</th>
|
||||
<th>{% trans %}project.bom.part{% endtrans %}</th>
|
||||
<th>{% trans %}project.bom.name{% endtrans %}</th>
|
||||
<th></th> {# Remove button #}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for entry in form %}
|
||||
{{ form_widget(entry) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" class="btn btn-success mb-2" {{ collection.create_btn() }}>
|
||||
<i class="fas fa-plus-square fa-fw"></i>
|
||||
{% trans %}project.bom.add_entry{% endtrans %}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block project_bom_entry_widget %}
|
||||
{% set target_id = 'expand_row-' ~ form.vars.name %}
|
||||
|
||||
{% import 'components/collection_type.macro.html.twig' as collection %}
|
||||
<tr>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-outline-secondary" type="button" data-bs-toggle="collapse" data-bs-target="#{{ target_id }}">
|
||||
<i class="fa-solid fa-eye"></i>
|
||||
</button>
|
||||
</td>
|
||||
<td>
|
||||
{{ form_errors(form.quantity) }}
|
||||
{{ form_widget(form.quantity) }}
|
||||
</td>
|
||||
<td style="min-width: 250px;">
|
||||
{{ form_errors(form.part) }}
|
||||
{{ form_widget(form.part) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ form_errors(form.name) }}
|
||||
{{ form_widget(form.name) }}
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger lot_btn_delete" {{ collection.delete_btn() }}>
|
||||
<i class="fas fa-trash-alt fa-fw"></i>
|
||||
</button>
|
||||
{{ form_errors(form) }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="p-0 d-none"></tr>
|
||||
<tr class="p-0">
|
||||
<td colspan="5" class="accordion-body collapse" id="{{ target_id }}">
|
||||
<div class="">
|
||||
{{ form_row(form.mountnames) }}
|
||||
<div class="row mb-2">
|
||||
<label class="col-form-label col-sm-3">{% trans %}project.bom.price{% endtrans %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="input-group">
|
||||
{{ form_widget(form.price) }}
|
||||
{{ form_widget(form.priceCurrency) }}
|
||||
</div>
|
||||
{{ form_errors(form.price) }}
|
||||
{{ form_errors(form.priceCurrency) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ form_row(form.comment) }}
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endblock %}
|
||||
125
templates/form/extended_bootstrap_layout.html.twig
Normal file
125
templates/form/extended_bootstrap_layout.html.twig
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
{% extends 'bootstrap_5_horizontal_layout.html.twig' %}
|
||||
|
||||
{# Make form rows smaller #}
|
||||
{% block form_row -%}
|
||||
{%- set row_attr = row_attr|merge({"class": "mb-2"}) -%}
|
||||
{{- parent() -}}
|
||||
{%- endblock form_row %}
|
||||
|
||||
{% block file_widget -%}
|
||||
{%- set type = type|default('file') -%}
|
||||
{{- block('form_widget_simple') -}}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block form_label_class -%}
|
||||
col-sm-3
|
||||
{%- endblock form_label_class %}
|
||||
|
||||
{% block form_group_class -%}
|
||||
col-sm-9
|
||||
{%- endblock form_group_class %}
|
||||
|
||||
{% block si_unit_widget %}
|
||||
<div class="input-group {% if sm %}input-group-sm{% endif %}">
|
||||
{{ form_widget(form.value) }}
|
||||
{% if form.prefix is defined %}
|
||||
{{ form_widget(form.prefix, {'attr': {'class': '', 'style': 'max-width: 40px;'}}) }}
|
||||
{% endif %}
|
||||
{% if unit is not empty %}
|
||||
<label class="input-group-text">{{ unit }}</label>
|
||||
{% endif %}
|
||||
</div>
|
||||
{{ form_errors(form.value) }}
|
||||
{% endblock %}
|
||||
|
||||
{#######################################################################################
|
||||
#
|
||||
# Definitions for Tristate Checkbox Type (mostly based on bootstrap checkbox type)
|
||||
#
|
||||
#######################################################################################}
|
||||
|
||||
{% block tristate_label -%}
|
||||
{#- Do not display the label if widget is not defined in order to prevent double label rendering -#}
|
||||
{%- if widget is defined -%}
|
||||
{% set is_parent_custom = parent_label_class is defined and ('checkbox-custom' in parent_label_class or 'radio-custom' in parent_label_class) %}
|
||||
{% set is_custom = label_attr.class is defined and ('checkbox-custom' in label_attr.class or 'radio-custom' in label_attr.class) %}
|
||||
{%- if is_parent_custom or is_custom -%}
|
||||
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%}
|
||||
{%- else %}
|
||||
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' form-check-label')|trim}) -%}
|
||||
{%- endif %}
|
||||
{%- if not compound -%}
|
||||
{% set label_attr = label_attr|merge({'for': id}) %}
|
||||
{%- endif -%}
|
||||
{%- if required -%}
|
||||
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' required')|trim}) -%}
|
||||
{%- endif -%}
|
||||
{%- if parent_label_class is defined -%}
|
||||
{%- set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|replace({'checkbox-inline': '', 'radio-inline': '', 'checkbox-custom': '', 'radio-custom': ''})|trim}) -%}
|
||||
{%- endif -%}
|
||||
{%- if label is not same as(false) and label is empty -%}
|
||||
{%- if label_format is not empty -%}
|
||||
{%- set label = label_format|replace({
|
||||
'%name%': name,
|
||||
'%id%': id,
|
||||
}) -%}
|
||||
{%- else -%}
|
||||
{%- set label = name|humanize -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{{ widget|raw }}
|
||||
<label{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}>
|
||||
{{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans(label_translation_parameters, translation_domain)) -}}
|
||||
{{- form_errors(form) -}}
|
||||
</label>
|
||||
{%- endif -%}
|
||||
{%- endblock tristate_label %}
|
||||
|
||||
{%- block tr_parent -%}
|
||||
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %}{% if indeterminate %} indeterminate="indeterminate"{% endif %} />
|
||||
{%- endblock tr_parent -%}
|
||||
|
||||
{% block tristate_widget -%}
|
||||
{%- set parent_label_class = parent_label_class|default(label_attr.class|default('')) -%}
|
||||
{%- if 'checkbox-custom' in parent_label_class -%}
|
||||
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%}
|
||||
<div class="custom-control custom-checkbox{{ 'checkbox-inline' in parent_label_class ? ' form-check-inline' }}">
|
||||
{{- form_label(form, null, { widget: block('tr_parent') }) -}}
|
||||
</div>
|
||||
{%- else -%}
|
||||
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-check-input')|trim}) -%}
|
||||
<div class="form-check{{ 'checkbox-inline' in parent_label_class ? ' form-check-inline' }}">
|
||||
{{- form_label(form, null, { widget: block('tr_parent') }) -}}
|
||||
</div>
|
||||
{%- endif -%}
|
||||
{%- endblock tristate_widget %}
|
||||
|
||||
{%- block choice_widget_collapsed -%}
|
||||
{# Only add the BS5 form-select class if we dont use bootstrap-selectpicker #}
|
||||
{# {% if attr["data-controller"] is defined and attr["data-controller"] not in ["elements--selectpicker"] %}
|
||||
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-select')|trim}) -%}
|
||||
{% else %}
|
||||
{# If it is an selectpicker add form-control class to fill whole width
|
||||
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control')|trim}) -%}
|
||||
{% endif %}
|
||||
#}
|
||||
|
||||
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-select')|trim}) -%}
|
||||
|
||||
{# If no data-controller was explictly defined add data-controller=elements--select #}
|
||||
{% if attr["data-controller"] is not defined %}
|
||||
{%- set attr = attr|merge({"data-controller": "elements--select"}) -%}
|
||||
|
||||
{% if attr["data-empty-message"] is not defined %}
|
||||
{%- set attr = attr|merge({"data-empty-message": ("selectpicker.nothing_selected"|trans)}) -%}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{- block("choice_widget_collapsed", "bootstrap_base_layout.html.twig") -}}
|
||||
{%- endblock choice_widget_collapsed -%}
|
||||
|
||||
{% block part_select_widget %}
|
||||
{{ form_widget(form.autocomplete) }}
|
||||
{% endblock %}
|
||||
62
templates/form/filter_types_layout.html.twig
Normal file
62
templates/form/filter_types_layout.html.twig
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{% block number_constraint_widget %}
|
||||
<div class="input-group" {{ stimulus_controller('filters/number_constraint') }}>
|
||||
{{ form_widget(form.operator, {"attr": {
|
||||
"class": "form-select",
|
||||
"data-filters--number-constraint-target": "operator",
|
||||
"data-action": "change->filters--number-constraint#update"
|
||||
}}) }}
|
||||
{{ form_widget(form.value1) }}
|
||||
<span class="input-group-text d-none" {{ stimulus_target('filters/number_constraint', 'thingsToHide') }}>{% trans %}filter.number_constraint.AND{% endtrans %}</span>
|
||||
{{ form_widget(form.value2, {"attr": {"class": "d-none", "data-filters--number-constraint-target": "thingsToHide"}}) }}
|
||||
{% if form.vars["text_suffix"] %}
|
||||
<span class="input-group-text">{{ form.vars["text_suffix"] }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block text_constraint_widget %}
|
||||
<div class="input-group">
|
||||
{{ form_widget(form.operator, {"attr": {"class": "form-select"}}) }}
|
||||
{{ form_widget(form.value) }}
|
||||
{% if form.vars["text_suffix"] is defined and form.vars["text_suffix"] %}
|
||||
<span class="input-group-text">{{ form.vars["text_suffix"] }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block structural_entity_constraint_widget %}
|
||||
{{ block('text_constraint_widget') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block user_entity_constraint_widget %}
|
||||
{{ block('text_constraint_widget') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block date_time_constraint_widget %}
|
||||
{{ block('number_constraint_widget') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block tags_constraint_widget %}
|
||||
{{ block('text_constraint_widget') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block choice_constraint_widget %}
|
||||
{{ block('text_constraint_widget') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block parameter_constraint_widget %}
|
||||
{% import 'components/collection_type.macro.html.twig' as collection %}
|
||||
<tr {{ stimulus_controller('pages/parameters_autocomplete', {"url": path('typeahead_parameters', {"query": "__QUERY__", "type": "part"}) }) }} >
|
||||
<td class="col-sm-2">{{ form_widget(form.name, {"attr": {"data-pages--parameters-autocomplete-target": "name"}}) }}</td>
|
||||
<td {{ stimulus_controller('pages/latex_preview') }}>{{ form_widget(form.symbol, {"attr": {"data-pages--parameters-autocomplete-target": "symbol", "data-pages--latex-preview-target": "input"}}) }}<span {{ stimulus_target('pages/latex_preview', 'preview') }}></span></td>
|
||||
<td>{{ form_widget(form.value) }}</td>
|
||||
<td {{ stimulus_controller('pages/latex_preview') }}>{{ form_widget(form.unit, {"attr": {"data-pages--parameters-autocomplete-target": "unit", "data-pages--latex-preview-target": "input"}}) }}<span {{ stimulus_target('pages/latex_preview', 'preview') }}></span></td>
|
||||
<td>{{ form_widget(form.value_text) }}</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger btn-sm" {{ collection.delete_btn() }} title="{% trans %}orderdetail.delete{% endtrans %}">
|
||||
<i class="fas fa-trash-alt fa-fw"></i>
|
||||
</button>
|
||||
{{ form_errors(form) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endblock %}
|
||||
109
templates/form/permission_layout.html.twig
Normal file
109
templates/form/permission_layout.html.twig
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
{% block permission_row %}
|
||||
<tr>
|
||||
<td>
|
||||
{% if multi_checkbox %}
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input tristate permission-checkbox permission_multicheckbox" id="mulit_check_{{ form.vars.label }}">
|
||||
<label class="form-check-label" for="mulit_check_{{ form.vars.label }}">
|
||||
<b>{{ form.vars.label | trans }}</b>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<b>{{ form.vars.label | trans }}</b>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{# #}
|
||||
{{ form_errors(form) }}
|
||||
</td>
|
||||
<td>
|
||||
{% for op in form %}
|
||||
{{ form_widget(op) }}
|
||||
{{ form_errors(op) }}
|
||||
{% endfor %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endblock %}
|
||||
|
||||
{% block permission_group_row %}
|
||||
{{ form_errors(form) }}
|
||||
<table class="table table-bordered table-sm table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans %}permission.edit.permission{% endtrans %}</th>
|
||||
<th>{% trans %}permission.edit.value{% endtrans %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{% for perm in form %}
|
||||
{{ form_row(perm) }}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block permissions_row %}
|
||||
{{ form_errors(form) }}
|
||||
|
||||
<div class="row mb-2">
|
||||
{% if show_legend %}
|
||||
<div class="col">
|
||||
<label><b>{% trans %}permission.legend.title{% endtrans %}:</b></label>
|
||||
<div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="form-check-input permission-checkbox" disabled>
|
||||
<label class="form-check-label opacity-100">{% trans %}permission.legend.disallow{% endtrans %}</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input permission-checkbox" type="checkbox" checked disabled>
|
||||
<label class="form-check-label opacity-100">{% trans %}permission.legend.allow{% endtrans %}</label>
|
||||
</div>
|
||||
<div class="form-check form-check-inline">
|
||||
<input type="checkbox" class="tristate form-check-input permission-checkbox" indeterminate="indeterminate" value="indeterminate" disabled>
|
||||
<label class="form-check-label opacity-100">{% trans %}permission.legend.inherit{% endtrans %}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_presets %}
|
||||
<div class="col text-end">
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
{% trans %}permission.preset.button{% endtrans %}
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><button type="submit" name="permission_preset" value="read_only" class="dropdown-item" >{% trans %}permission.preset.read_only{% endtrans%} <br><small class="text-muted">{% trans %}permission.preset.read_only.desc{% endtrans%}</small></button></li>
|
||||
<li><button type="submit" name="permission_preset" value="editor" class="dropdown-item" >{% trans %}permission.preset.editor{% endtrans%} <br><small class="text-muted">{% trans %}permission.preset.editor.desc{% endtrans%}</small></button></li>
|
||||
<li><button type="submit" name="permission_preset" value="admin" class="dropdown-item" >{% trans %}permission.preset.admin{% endtrans%} <br><small class="text-muted">{% trans %}permission.preset.admin.desc{% endtrans%}</small></button></li>
|
||||
<li><hr class="dropdown-divider"></li>
|
||||
<li><button type="submit" name="permission_preset" value="all_inherit" class="dropdown-item" >{% trans %}permission.preset.all_inherit{% endtrans%}<br><small class="text-muted">{% trans %}permission.preset.all_inherit.desc{% endtrans%}</small></button></li>
|
||||
<li><button type="submit" name="permission_preset" value="all_forbid" class="dropdown-item" >{% trans %}permission.preset.all_forbid{% endtrans%}<br><small class="text-muted">{% trans %}permission.preset.all_forbid.desc{% endtrans%}</small></button></li>
|
||||
<li><button type="submit" name="permission_preset" value="all_allow" class="dropdown-item" >{% trans %}permission.preset.all_allow{% endtrans%}<br><small class="text-muted">{% trans %}permission.preset.all_allow.desc{% endtrans%}</small></button></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<ul class="nav nav-tabs">
|
||||
{% for group in form %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if loop.first %}active{% endif %}"
|
||||
data-bs-toggle="tab" role="tab" href="#group_row_{{ group.vars.name }}">{{ group.vars.label | trans }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-2">
|
||||
{% for group in form %}
|
||||
<div class="tab-pane {% if loop.first %}active{% endif %}" id="group_row_{{ group.vars.name }}">
|
||||
{{ form_row(group) }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue