updated tabulator + added auto focus
This commit is contained in:
parent
88ce2b9495
commit
82986f21f4
6
.idea/jsLibraryMappings.xml
Normal file
6
.idea/jsLibraryMappings.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="JavaScriptLibraryMappings">
|
||||||
|
<file url="file://$PROJECT_DIR$" libraries="{tabulator_bootstrap4}" />
|
||||||
|
</component>
|
||||||
|
</project>
|
11
cookbook/static/tabulator/tabulator.min.js
vendored
Normal file
11
cookbook/static/tabulator/tabulator.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3
cookbook/static/tabulator/tabulator_bootstrap4.min.css
vendored
Normal file
3
cookbook/static/tabulator/tabulator_bootstrap4.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -2,15 +2,13 @@
|
|||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load custom_tags %}
|
{% load custom_tags %}
|
||||||
|
{% load static %}
|
||||||
|
|
||||||
{% block title %}{% trans 'Edit Recipe' %}{% endblock %}
|
{% block title %}{% trans 'Edit Recipe' %}{% endblock %}
|
||||||
|
|
||||||
{% block extra_head %}
|
{% block extra_head %}
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/js/tabulator.min.js"
|
<script src="{% static 'tabulator/tabulator.min.js' %}"></script>
|
||||||
integrity="sha256-u2YCVBkzzkIuLh6bMHUmqv6uuuHLxGgc6XF+rCJUV5k=" crossorigin="anonymous"></script>
|
<link rel="stylesheet" href="{% static 'tabulator/tabulator_bootstrap4.min.css' %}"/>
|
||||||
<link rel="stylesheet"
|
|
||||||
href="https://cdnjs.cloudflare.com/ajax/libs/tabulator/4.4.3/css/bootstrap/tabulator_bootstrap4.min.css"
|
|
||||||
integrity="sha256-+AmauyGZPl0HNTBQ5AMZBxfzP+rzXJjraezMKpWwWSE=" crossorigin="anonymous"/>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -45,6 +43,23 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function selectText(node) {
|
||||||
|
|
||||||
|
if (document.body.createTextRange) {
|
||||||
|
const range = document.body.createTextRange();
|
||||||
|
range.moveToElementText(node);
|
||||||
|
range.select();
|
||||||
|
} else if (window.getSelection) {
|
||||||
|
const selection = window.getSelection();
|
||||||
|
const range = document.createRange();
|
||||||
|
range.selectNodeContents(node);
|
||||||
|
selection.removeAllRanges();
|
||||||
|
selection.addRange(range);
|
||||||
|
} else {
|
||||||
|
console.warn("Could not select text in node: Unsupported browser.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//converts multiselct in recipe edit to searchable multiselect
|
//converts multiselct in recipe edit to searchable multiselect
|
||||||
//shitty solution that needs to be redone at some point
|
//shitty solution that needs to be redone at some point
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
@ -91,7 +106,12 @@
|
|||||||
table.deleteRow(cur.id);
|
table.deleteRow(cur.id);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
},
|
||||||
|
cellClick: function (e, cell) {
|
||||||
|
input = cell.getElement().childNodes[0]
|
||||||
|
input.focus()
|
||||||
|
input.select()
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// load initial value
|
// load initial value
|
||||||
|
Loading…
Reference in New Issue
Block a user