summaryrefslogtreecommitdiff
path: root/ishtar_common/templates/ishtar/forms/qrcode_for_search.html
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/templates/ishtar/forms/qrcode_for_search.html')
-rw-r--r--ishtar_common/templates/ishtar/forms/qrcode_for_search.html78
1 files changed, 78 insertions, 0 deletions
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">&times;</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>
+
+