Commit 56fa3440 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(mvc/template) add heading support, proposal for https://github.com/opnsense/core/pull/866

Example (from @fraenki):
<field>
        <label>Tuning Options</label>
        <type>header</type>
</field>

(cherry picked from commit 95522e09)
parent 746357a3
......@@ -34,6 +34,27 @@ label : dialog label
#}
{# close table and reopen for new header#}
{%- macro base_dialog_header(header_text) %}
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-striped table-condensed">
<colgroup>
<col class="col-md-3"/>
<col class="col-md-{{ 12-3-msgzone_width|default(5) }}"/>
<col class="col-md-{{ msgzone_width|default(5) }}"/>
</colgroup>
<thead>
<tr colspan="3">
<th><h2>{{header_text}}</h2></th>
</tr>
</thead>
<tbody>
{%- endmacro %}
{# Find if there are help supported or advanced field on this page #}
{% set help=false %}
......@@ -61,7 +82,8 @@ label : dialog label
</div>
<div class="modal-body">
<form id="frm_{{id}}">
<table class="table table-striped table-condensed table-responsive">
<div class="table-responsive">
<table class="table table-striped table-condensed">
<colgroup>
<col class="col-md-3"/>
<col class="col-md-{{ 12-3-msgzone_width|default(5) }}"/>
......@@ -77,10 +99,16 @@ label : dialog label
</tr>
{% endif %}
{% for field in fields|default({})%}
{% if field['type'] == 'header' %}
{# close table and start new one with header #}
{{ base_dialog_header(field['label']) }}
{% else %}
{{ partial("layout_partials/form_input_tr",field)}}
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
</form>
</div>
<div class="modal-footer">
......
......@@ -34,6 +34,25 @@ data_title : data-title to set on form
#}
{# close table and reopen for new header#}
{%- macro base_form_header(header_text) %}
</tbody>
</table>
</div>
<div class="table-responsive">
<table class="table table-striped table-condensed table-responsive">
<colgroup>
<col class="col-md-3"/>
<col class="col-md-4"/>
<col class="col-md-5"/>
</colgroup>
<thead>
<tr colspan="3">
<th><h2>{{header_text}}</h2></th>
</tr>
</thead>
<tbody>
{%- endmacro %}
{# Find if there are help supported or advanced field on this page #}
{% set help=false %}
......@@ -52,7 +71,8 @@ data_title : data-title to set on form
{% endif %}
{% endfor %}
<form id="{{id}}" class="form-inline" data-title="{{data_title|default('')}}">
<table class="table table-striped table-condensed table-responsive">
<div class="table-responsive">
<table class="table table-striped table-condensed">
<colgroup>
<col class="col-md-3"/>
<col class="col-md-4"/>
......@@ -66,7 +86,12 @@ data_title : data-title to set on form
</td>
</tr>
{% for field in fields|default({})%}
{% if field['type'] == 'header' %}
{# close table and start new one with header #}
{{ base_form_header(field['label']) }}
{% else %}
{{ partial("layout_partials/form_input_tr",field)}}
{% endif %}
{% endfor %}
{% if apply_btn_id|default('') != '' %}
<tr>
......@@ -75,4 +100,5 @@ data_title : data-title to set on form
{% endif %}
</tbody>
</table>
</div>
</form>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment