diff --git a/devices/views.py b/devices/views.py index ba31c4c2..b67ba534 100644 --- a/devices/views.py +++ b/devices/views.py @@ -684,7 +684,6 @@ class DeviceLend(PermissionRequiredMixin, FormView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['actionstring'] = "Mark device as lend" - context['form_scripts'] = "$('#id_owner').select2();" if "device" in self.request.POST: deviceid = self.request.POST["device"] if deviceid != "": @@ -860,7 +859,6 @@ def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) # Add in a QuerySet of all the books - context['form_scripts'] = "$('#id_owner').select2();" context["breadcrumbs"] = [ (reverse("device-list"), _("Devices")), (reverse("device-detail", kwargs={"pk": self.device.pk}), self.device.name), diff --git a/static/js/lagerregal.js b/static/js/lagerregal.js index 47ad2771..5d0af33a 100644 --- a/static/js/lagerregal.js +++ b/static/js/lagerregal.js @@ -71,4 +71,10 @@ } }); }); + + $(function() { + if (document.location.hash) { + $('[data-toggle="tab"][href="' + document.location.hash + '"]').tab('show') ; + } + }); })(); diff --git a/templates/devices/base_form.html b/templates/devices/base_form.html index ffe4b7c0..3ada74a8 100644 --- a/templates/devices/base_form.html +++ b/templates/devices/base_form.html @@ -78,5 +78,4 @@

{% trans "Help" %}

}).done(response); } }); - {% autoescape off %}{{ form_scripts }}{% endautoescape %} {% endblock %} diff --git a/templates/devices/detail/device_detail.html b/templates/devices/detail/device_detail.html index 48bb62ed..741894a8 100644 --- a/templates/devices/detail/device_detail.html +++ b/templates/devices/detail/device_detail.html @@ -429,22 +429,6 @@

{% trans "Installed software from backend providers" %}

{% block scriptend %} {% include "devices/detail/device_detail.js" with device_id=device.id provided_data=provided_data %} $(function() { - $("#id_ipaddresses").on("change", function(e) { - if ($(this).val()) { - $("#submitipaddress").removeClass("disabled"); - } else { - $("#submitipaddress").addClass("disabled"); - } - }); - - $("#id_tags").on("change", function(e) { - if ($(this).val()) { - $("#submittags").removeClass("disabled"); - } else { - $("#submittags").addClass("disabled"); - } - }); - $("#id_mailtemplate").change(function() { if ($(this).val() !== "") { $.ajax({ diff --git a/templates/devices/detail/device_ipaddress_card.html b/templates/devices/detail/device_ipaddress_card.html index 9107a757..12c63111 100644 --- a/templates/devices/detail/device_ipaddress_card.html +++ b/templates/devices/detail/device_ipaddress_card.html @@ -26,7 +26,7 @@ {% csrf_token %}
{{ ipaddressform.ipaddresses }}
-
diff --git a/templates/devices/detail/device_tags_card.html b/templates/devices/detail/device_tags_card.html index 073c6e62..0c355f92 100644 --- a/templates/devices/detail/device_tags_card.html +++ b/templates/devices/detail/device_tags_card.html @@ -17,7 +17,7 @@ {% csrf_token %}
{{ tagform.tags }}
-
diff --git a/templates/devicetypes/type_form.html b/templates/devicetypes/type_form.html index eb629e5a..15f3d37d 100644 --- a/templates/devicetypes/type_form.html +++ b/templates/devicetypes/type_form.html @@ -63,6 +63,4 @@ }); } }); - - {% autoescape off %}{{ form_scripts }}{% endautoescape %} {% endblock %} \ No newline at end of file diff --git a/templates/users/profile.html b/templates/users/profile.html index 0dc9b2b2..8f509833 100644 --- a/templates/users/profile.html +++ b/templates/users/profile.html @@ -262,7 +262,7 @@
{% trans "User doesn't own any IP-Addresses." %}
{% csrf_token %}
{{ ipaddressform.ipaddresses }}
-
@@ -309,28 +309,3 @@
{% trans "User hasn't edited anything." %}
{% include "snippets/modals/avatarView.html" with modalname="avatarModal" avatarpath=profileuser.avatar.url %} {% endif %} {% endblock %} - -{% block scriptend %} - $("#id_ipaddresses").on("change", function(e) { - if ($(this).val()) { - $("#submitipaddress").removeClass("disabled"); - } else { - $("#submitipaddress").addClass("disabled"); - } - }); - - $(function() { - var $affix = $(".affix-container"); - var $parent = $affix.parent(); - var resize = function() { - $affix.width($parent.width()); - }; - $(window).resize(resize); - resize(); - - var url = document.location.toString(); - if (url.match('#')) { - $('.nav-tabs a[href=#'+url.split('#')[1]+']').tab('show') ; - } - }); -{% endblock %}