diff options
Diffstat (limited to 'ishtar_common/templates')
-rw-r--r-- | ishtar_common/templates/blocks/DataTables.html | 1 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/forms/qrcode_for_search.html | 78 | ||||
-rw-r--r-- | ishtar_common/templates/widgets/search_input.html | 11 |
3 files changed, 88 insertions, 2 deletions
diff --git a/ishtar_common/templates/blocks/DataTables.html b/ishtar_common/templates/blocks/DataTables.html index 6b24049a4..54ae5a630 100644 --- a/ishtar_common/templates/blocks/DataTables.html +++ b/ishtar_common/templates/blocks/DataTables.html @@ -271,6 +271,7 @@ jQuery(document).ready(function(){ return true; }); {% endif %} + get_search_parameters_from_url(); datatable_submit_search(true); }); diff --git a/ishtar_common/templates/ishtar/forms/qrcode_for_search.html b/ishtar_common/templates/ishtar/forms/qrcode_for_search.html new file mode 100644 index 000000000..255fd57ff --- /dev/null +++ b/ishtar_common/templates/ishtar/forms/qrcode_for_search.html @@ -0,0 +1,78 @@ +{% load i18n inline_formset table_form %} +<div class="modal-dialog modal-sm" id="save-qrcode-div"> + <div class="modal-content"> + <div class="modal-header"> + <h5>{% trans "QR Code for this search" %}</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="alert alert-info"> + <p>{% trans "Print the generated QR Code to make it available with a simple scan." %}</p> + </div> + <form enctype="multipart/form-data" + action="{% url 'search-qrcode' %}" method="post" id="save-qrcode-form"> + <div class="modal-body form-row-modal"> + {% csrf_token %} + <div class='form'> + {% bs_form form%} + </div> + {% if qr_code %} + <div class='text-center'> + <a href="{{qr_code}}" target="_blank"> + <img src="{{qr_code}}" class="img-thumbnail"> + </a> + </div> + {% endif %} + </div> + <div class="modal-footer"> + <div class="col-sm"> + {% if not qr_code %} + <button type="button" id="search-qrcode-submit" + name='validate' + value="validate" class="btn btn-success"> + {% trans "Generate" %} + </button> + {% endif %} + <button type="button" data-dismiss="modal" + aria-label="Close" class="btn btn-secondary"> + {% trans "Close" %} + </button> + </div> + </div> + </form> + </div> +</div> + +<script type='text/javascript'> + +var submit_gqr_form = function(){ + $.ajax({ + type: "POST", + url: "{% url 'search-qrcode' %}", + data: $("#save-qrcode-form").serialize(), + success: function(data){ + $("#save-qrcode-div").parent().html(data); + }, + dataType: 'html' + }); + return false; +} + +$(document).ready(function(){ + $("#id_query").prop("readonly", true); + var q_value = $("#id_search_vector").val(); + if (!q_value) q_value = '*'; + $("#id_query").val(q_value); + $("#id_current_url").val(window.location.href); + $("#search-qrcode-submit").click(submit_gqr_form); + $("#save-qrcode-form").submit(function(e){ + e.preventDefault(); + submit_gqr_form(); + return false; + }); +}); + +</script> + + diff --git a/ishtar_common/templates/widgets/search_input.html b/ishtar_common/templates/widgets/search_input.html index 0083db54b..114fea5a1 100644 --- a/ishtar_common/templates/widgets/search_input.html +++ b/ishtar_common/templates/widgets/search_input.html @@ -39,8 +39,15 @@ id="load-bookmark"> <i class="fa fa-bookmark" aria-hidden="true"></i> </span> - <div class="dropdown-menu" id="bookmark-list"> - </div> + <div class="dropdown-menu" id="bookmark-list"></div> + <a class="input-group-text input-link async-link disabled" + id="generate-qrcode" + data-target="#modal-dynamic-form" + data-modal-open="#modal-dynamic-form" + title="{% trans 'Generate a QR Code' %}" + href="{% url 'search-qrcode' %}"> + <i class="fa fa-qrcode" aria-hidden="true"></i> + </a> </span> </div> |