Compare commits
No commits in common. "bf51819cbc7787434eb68d756c04a6ec183b3fc8" and "21ee1703022ffcb55aadd01a6cf0c39500705167" have entirely different histories.
bf51819cbc
...
21ee170302
|
|
@ -1,7 +1,6 @@
|
|||
from django.urls import path, include
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('search/', views.searchAPI),
|
||||
path('', include('sage_stream.api.urls')),
|
||||
path('', views.videoAPI),
|
||||
]
|
||||
|
|
@ -5,7 +5,7 @@ from core.models import Video
|
|||
from core.serializers import VideoSerializer
|
||||
|
||||
@api_view(['GET'])
|
||||
def searchAPI(request):
|
||||
def videoAPI(request):
|
||||
q = request.GET.get('q', '')
|
||||
l = request.GET.get('limit', '6')
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -51,7 +51,6 @@
|
|||
</li>
|
||||
</ul>
|
||||
<div class="float-right" style="width:100%">
|
||||
|
||||
<form class="form-inline ml-0 ml-md-3 float-right">
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control form-control-navbar"
|
||||
|
|
@ -59,9 +58,6 @@
|
|||
placeholder="Search"
|
||||
aria-label="Search"
|
||||
id="searchinput">
|
||||
<!--
|
||||
<div id="searchsuggestions"></div>
|
||||
-->
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-navbar" type="submit">
|
||||
<i class="fas fa-search"></i>
|
||||
|
|
@ -69,7 +65,6 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ INSTALLED_APPS = [
|
|||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'rest_framework',
|
||||
'sage_stream',
|
||||
#'sage_stream',
|
||||
'core'
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ urlpatterns = [
|
|||
path('auth/', include('django.contrib.auth.urls')),
|
||||
path('', include('core.urls')),
|
||||
path('api/', include('api.urls')),
|
||||
#path('api/', include('sage_stream.api.urls')),
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
|
|
|
|||
16
static/dist/js/searchsuggestions.js
vendored
16
static/dist/js/searchsuggestions.js
vendored
|
|
@ -1,27 +1,13 @@
|
|||
/*
|
||||
const searchinput = document.querySelector("#searchinput");
|
||||
const searchsuggestions = document.querySelector("#searchsuggestions");
|
||||
searchinput.addEventListener("input", (e) => {
|
||||
q(e.target.value);
|
||||
});
|
||||
async function q(s) {
|
||||
try {
|
||||
const response = await fetch("/api/?q=" + s);
|
||||
const response = await fetch("http://localhost:8000/api/?q=" + s);
|
||||
const result = await response.json();
|
||||
console.log("Success: " + JSON.stringify(result));
|
||||
setSuggestions(searchsuggestions, result);
|
||||
} catch(error) {
|
||||
console.log("Error: " + error);
|
||||
}
|
||||
}
|
||||
function setSuggestions(o, s) {
|
||||
const newSuggestions = [];
|
||||
for (const vid of s) {
|
||||
const newSugg = document.createElement("a");
|
||||
newSugg.setAttribute("href", "/view/" + vid.id);
|
||||
newSugg.insertAdjacentText("afterbegin", vid.name + " " + vid.id);
|
||||
newSuggestions.push(newSugg);
|
||||
}
|
||||
o.replaceChildren(...newSuggestions);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user