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 ...@@ -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 #} {# Find if there are help supported or advanced field on this page #}
{% set help=false %} {% set help=false %}
...@@ -61,7 +82,8 @@ label : dialog label ...@@ -61,7 +82,8 @@ label : dialog label
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form id="frm_{{id}}"> <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> <colgroup>
<col class="col-md-3"/> <col class="col-md-3"/>
<col class="col-md-{{ 12-3-msgzone_width|default(5) }}"/> <col class="col-md-{{ 12-3-msgzone_width|default(5) }}"/>
...@@ -77,10 +99,16 @@ label : dialog label ...@@ -77,10 +99,16 @@ label : dialog label
</tr> </tr>
{% endif %} {% endif %}
{% for field in fields|default({})%} {% for field in fields|default({})%}
{{ partial("layout_partials/form_input_tr",field)}} {% 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 %} {% endfor %}
</tbody> </tbody>
</table> </table>
</div>
</form> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
......
...@@ -34,6 +34,25 @@ data_title : data-title to set on form ...@@ -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 #} {# Find if there are help supported or advanced field on this page #}
{% set help=false %} {% set help=false %}
...@@ -52,7 +71,8 @@ data_title : data-title to set on form ...@@ -52,7 +71,8 @@ data_title : data-title to set on form
{% endif %} {% endif %}
{% endfor %} {% endfor %}
<form id="{{id}}" class="form-inline" data-title="{{data_title|default('')}}"> <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> <colgroup>
<col class="col-md-3"/> <col class="col-md-3"/>
<col class="col-md-4"/> <col class="col-md-4"/>
...@@ -66,7 +86,12 @@ data_title : data-title to set on form ...@@ -66,7 +86,12 @@ data_title : data-title to set on form
</td> </td>
</tr> </tr>
{% for field in fields|default({})%} {% for field in fields|default({})%}
{{ partial("layout_partials/form_input_tr",field)}} {% 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 %} {% endfor %}
{% if apply_btn_id|default('') != '' %} {% if apply_btn_id|default('') != '' %}
<tr> <tr>
...@@ -75,4 +100,5 @@ data_title : data-title to set on form ...@@ -75,4 +100,5 @@ data_title : data-title to set on form
{% endif %} {% endif %}
</tbody> </tbody>
</table> </table>
</div>
</form> </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