Remove testing resources

This commit is contained in:
Jeremy Stretch 2024-01-26 15:29:55 -05:00
parent 6fec62edc6
commit c4eed67bf3
3 changed files with 0 additions and 69 deletions

View File

@ -136,7 +136,4 @@ urlpatterns = [
# Markdown
path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"),
# Testing
path('tom-select/', views.TomSelectView.as_view(), name="tom_select"),
]

View File

@ -30,13 +30,6 @@ from .reports import run_report
from .scripts import run_script
class TomSelectView(View):
def get(self, request):
return render(request, 'extras/tom_select.html', {
})
#
# Custom fields
#

View File

@ -1,59 +0,0 @@
{% extends 'base/layout.html' %}
{% block content %}
<h3>Tom select</h3>
<select type="text" class="form-select" id="select-site" placeholder="Select a site..." autocomplete="off">
</select>
<script src="https://cdn.jsdelivr.net/npm/tom-select/dist/js/tom-select.complete.min.js"></script>
<script>
new TomSelect('#select-site',{
valueField: 'id',
labelField: 'name',
searchField: 'name',
copyClassesToDropdown: false,
dropdownParent: 'body',
controlInput: '<input>',
preload: 'focus',
// fetch remote data
load: function(query, callback) {
var url = '/api/dcim/sites/?q=' + encodeURIComponent(query);
fetch(url)
.then(response => response.json())
.then(json => {
callback(json.results);
}).catch(()=>{
callback();
});
},
// custom rendering functions for options and items
render: {
option: function(item, escape) {
return `<div class="py-2 d-flex">
<div>
<div class="mb-1">
<span class="h4">${ escape(item.name) }</span>
<span class="text-muted">${ escape(item.tenant.name) }</span>
</div>
<div class="description">${ escape(item.description) }</div>
</div>
</div>`;
},
item: function(item, escape) {
return `<div>
${ escape(item.name) }
</div>`;
}
},
});
</script>
{% endblock content %}