Improve search on decitre button

This commit is contained in:
Gabriel Augendre 2019-06-08 17:02:32 +02:00
parent b15bee56aa
commit 794759a997
3 changed files with 11 additions and 7 deletions

View file

@ -1,4 +1,8 @@
document.addEventListener("DOMContentLoaded", function (event) { document.addEventListener("DOMContentLoaded", function (event) {
$(function () {
$('[data-toggle="tooltip"]').tooltip();
});
var isbnButton = document.querySelector('#id_isbn_button'); var isbnButton = document.querySelector('#id_isbn_button');
var isbn = document.querySelector('#id_isbn'); var isbn = document.querySelector('#id_isbn');
var title = document.querySelector('#id_title'); var title = document.querySelector('#id_title');

View file

@ -43,16 +43,16 @@
<div class="form-group"> <div class="form-group">
{% bootstrap_label content=form.isbn.label label_for=form.isbn.auto_id %} {% bootstrap_label content=form.isbn.label label_for=form.isbn.auto_id %}
<div class="input-group"> <div class="input-group">
<div class="input-group-prepend">
<button class="btn btn-primary" type="button" id="id_isbn_button" data-toggle="tooltip" data-placement="top" title="Chercher avec Decitre">
<i class="fas fa-search"></i> <i class="fas fa-spinner fa-spin" id="id_isbn_spinner" hidden></i>
</button>
</div>
<input name="{{ form.isbn.name }}" maxlength="20" <input name="{{ form.isbn.name }}" maxlength="20"
class="form-control" class="form-control"
placeholder="{{ form.isbn.label }}" placeholder="{{ form.isbn.label }}"
{% if form.isbn.value != None %} value="{{ form.isbn.value|stringformat:'s' }}"{% endif %} {% if form.isbn.value != None %} value="{{ form.isbn.value|stringformat:'s' }}"{% endif %}
required="" id="{{ form.isbn.auto_id }}" type="text"> required="" id="{{ form.isbn.auto_id }}" type="text">
<div class="input-group-append">
<button class="btn btn-outline-secondary" type="button" id="id_isbn_button">
Chercher sur Decitre <i class="fas fa-spinner fa-spin" id="id_isbn_spinner" hidden></i>
</button>
</div>
</div> </div>
<div class="invalid-feedback" id="id_isbn_invalid_feedback"> <div class="invalid-feedback" id="id_isbn_invalid_feedback">
</div> </div>

View file

@ -41,8 +41,6 @@
{% endblock %} {% endblock %}
</div> </div>
{% block end_js %}
{% endblock %}
<script src="https://code.jquery.com/jquery-3.3.1.min.js" <script src="https://code.jquery.com/jquery-3.3.1.min.js"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"
@ -51,5 +49,7 @@
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"
integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
{% block end_js %}
{% endblock %}
</body> </body>
</html> </html>