diff options
Diffstat (limited to 'ishtar_common/templates/blocks')
5 files changed, 61 insertions, 7 deletions
diff --git a/ishtar_common/templates/blocks/CentimeterMeterWidget.html b/ishtar_common/templates/blocks/CentimeterMeterWidget.html new file mode 100644 index 000000000..00c1614b5 --- /dev/null +++ b/ishtar_common/templates/blocks/CentimeterMeterWidget.html @@ -0,0 +1,21 @@ +<div class="input-group"> + <input class="area_widget form-control" type="text"{{final_attrs|safe}}> + <div class="input-group-append"> + <div class="input-group-text"> + {{unit}} (<span id="meter_{{id}}">0</span> m) + </div> + </div> +</div> +<script type="text/javascript"><!--// + function evaluate_{{safe_id}}(){ + value = parseFloat($("#{{id}}").val()); + if(!isNaN(value)){ + value = value/100; + } else { + value = 0; + } + $("#meter_{{id}}").html(value); + } + $("#{{id}}").keyup(evaluate_{{safe_id}}); + $(document).ready(evaluate_{{safe_id}}()); +//--></script> diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index b5f669963..096650115 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -152,7 +152,7 @@ jQuery(document).ready(function(){ } }, "select": { - "style": {% if multiple_select %}'multi'{% else %}'single'{% endif %} + "style": {% if multiple_select or quick_actions %}'multi'{% else %}'single'{% endif %} }, {% if multiple_select or quick_actions %}"buttons": [ {% for url, title, icon, target in quick_actions %} @@ -170,7 +170,7 @@ jQuery(document).ready(function(){ } }, {% if not forloop.last %},{% endif %} - {% endfor %}{% if multiple_select %}{% if quick_actions%},{% endif %} + {% endfor %}{% if quick_actions%},{% endif %} { extend: 'selectAll', text: '<i class="fa fa-check-circle-o"></i>', @@ -181,7 +181,6 @@ jQuery(document).ready(function(){ text: '<i class="fa fa-times"></i>', titleAttr: "{% trans 'Deselect' %}" } - {% endif %} ], "dom": 'lBtip', {% else %} @@ -192,7 +191,12 @@ jQuery(document).ready(function(){ { "data": "link", "orderable": false },{% for col in extra_cols %} { "data": "{{col}}", "defaultContent": "-", "render": $.fn.dataTable.render.ellipsis( 70, true ) }{% if not forloop.last %},{% endif %}{% endfor %} - ] + ], + "initComplete": function(settings, json) { + var api = new $.fn.dataTable.Api(settings); + {% if not multiple_select %}dt_single_enable_disable_submit_button(null, api); + {% else %}dt_multi_enable_disable_submit_button(null, api);{% endif %} + } }; if (!debug) $.fn.dataTable.ext.errMode = 'none'; @@ -201,6 +205,14 @@ jQuery(document).ready(function(){ if (datatables_i18n) datatable_options['language'] = datatables_i18n; datatable_{{sname}} = jQuery("#grid_{{name}}").DataTable(datatable_options); + {% if not multiple_select %} + datatable_{{sname}}.on('select', dt_single_enable_disable_submit_button); + datatable_{{sname}}.on('deselect', dt_single_enable_disable_submit_button); + {% else %} + datatable_{{sname}}.on('select', dt_multi_enable_disable_submit_button); + datatable_{{sname}}.on('deselect', dt_multi_enable_disable_submit_button); + {% endif %} + {% if multiple %} jQuery("#add_button_{{name}}").click(function (){ var mygrid = jQuery("#grid_{{name}}"); diff --git a/ishtar_common/templates/blocks/GramKilogramWidget.html b/ishtar_common/templates/blocks/GramKilogramWidget.html new file mode 100644 index 000000000..27c066d13 --- /dev/null +++ b/ishtar_common/templates/blocks/GramKilogramWidget.html @@ -0,0 +1,21 @@ +<div class="input-group"> + <input class="area_widget form-control" type="text"{{final_attrs|safe}}> + <div class="input-group-append"> + <div class="input-group-text"> + {{unit}} (<span id="kg_{{id}}">0</span> kg) + </div> + </div> +</div> +<script type="text/javascript"><!--// + function evaluate_{{safe_id}}(){ + value = parseFloat($("#{{id}}").val()); + if(!isNaN(value)){ + value = value/1000; + } else { + value = 0; + } + $("#kg_{{id}}").html(value); + } + $("#{{id}}").keyup(evaluate_{{safe_id}}); + $(document).ready(evaluate_{{safe_id}}()); +//--></script> diff --git a/ishtar_common/templates/blocks/action_list.html b/ishtar_common/templates/blocks/action_list.html index 50a6554c4..384082ad4 100644 --- a/ishtar_common/templates/blocks/action_list.html +++ b/ishtar_common/templates/blocks/action_list.html @@ -1,12 +1,12 @@ <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" - aria-expanded="false">{{section_label}}</a> + aria-expanded="false">{{section_label|safe}}</a> <div class="dropdown-menu"> {% for label, url, has_children in sections %} <a class="dropdown-item{% if has_children%} font-weight-bold{%endif%}" href="{{url}}"> - {{ label }} + {{ label|safe }} </a>{% endfor %} </div> </li> diff --git a/ishtar_common/templates/blocks/bs_field_snippet.html b/ishtar_common/templates/blocks/bs_field_snippet.html index 830dd4cfa..f46b15209 100644 --- a/ishtar_common/templates/blocks/bs_field_snippet.html +++ b/ishtar_common/templates/blocks/bs_field_snippet.html @@ -1,5 +1,5 @@ {% load i18n %} - <div class="form-group {% if field.field.widget.attrs.cols %}col-lg-12{% else %}col-lg-6{% endif %}{% if field.errors %} is-invalid{% endif %}{% if field.field.required %} required{% endif %}" + <div class="form-group {% if field.field.widget.attrs.cols or force_large_col %}col-lg-12{% else %}col-lg-6{% endif %}{% if field.errors %} is-invalid{% endif %}{% if field.field.required %} required{% endif %}" data-alt-name="{{field.field.alt_name}}"> {% if field.label %}{{ field.label_tag }}{% endif %} {% if show_field_number and field.field.order_number %}<span class="badge badge-pill badge-success field-tip"> |
