1
0
Fork 0
mirror of synced 2024-06-17 18:04:33 +12:00

Preserve query string between snapshot list views

This commit is contained in:
jdcaballerov 2020-12-14 12:11:44 -05:00
parent 254d2502fd
commit 7db6b0a8a6

View file

@ -108,8 +108,8 @@
{% endif %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
|
<a href="{% url 'admin:core_snapshot_changelist' %}"></a>
<a href="{% url 'admin:grid' %}"><span style="letter-spacing: -.4em">⣿⣿</span>&nbsp;&nbsp;</a>
<a> <span id="snapshotListView" style="cursor: pointer"></span> </a>
<a> <span id="snapshotGridView"style="letter-spacing: -.4em; cursor: pointer;">⣿⣿</span></a>
{% endblock %}
</div>
{% endif %}
@ -182,8 +182,27 @@
});
}
};
function redirectWithQuery(uri){
uri_query = uri + document.location.search;
window.location = uri_query;
};
function bindSnapshotViewsClick() {
$( document ).ready(function() {
$("#snapshotListView").click(function() {
redirectWithQuery("{% url 'admin:core_snapshot_changelist' %}");
});
$("#snapshotGridView").click(function() {
redirectWithQuery("{% url 'admin:grid' %}");
});
});
};
$(function () {
fix_actions();
bindSnapshotViewsClick();
});
})(django.jQuery);
</script>