mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
Remove testing resources
This commit is contained in:
parent
6fec62edc6
commit
c4eed67bf3
@ -136,7 +136,4 @@ urlpatterns = [
|
|||||||
|
|
||||||
# Markdown
|
# Markdown
|
||||||
path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"),
|
path('render/markdown/', views.RenderMarkdownView.as_view(), name="render_markdown"),
|
||||||
|
|
||||||
# Testing
|
|
||||||
path('tom-select/', views.TomSelectView.as_view(), name="tom_select"),
|
|
||||||
]
|
]
|
||||||
|
@ -30,13 +30,6 @@ from .reports import run_report
|
|||||||
from .scripts import run_script
|
from .scripts import run_script
|
||||||
|
|
||||||
|
|
||||||
class TomSelectView(View):
|
|
||||||
|
|
||||||
def get(self, request):
|
|
||||||
return render(request, 'extras/tom_select.html', {
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Custom fields
|
# Custom fields
|
||||||
#
|
#
|
||||||
|
@ -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 %}
|
|
Loading…
Reference in New Issue
Block a user