mirror of
https://gitlab.science.ru.nl/technicie/MarietjeDjango.git
synced 2025-12-10 10:32:22 +01:00
Merge artist and title searchbar into a single textbox.
This commit is contained in:
@ -32,8 +32,6 @@ def songs(request):
|
|||||||
|
|
||||||
queries = [Q(deleted=False)]
|
queries = [Q(deleted=False)]
|
||||||
queries.extend([Q(Q(artist__icontains=word) | Q(title__icontains=word)) for word in request.POST.get('all', '').split()])
|
queries.extend([Q(Q(artist__icontains=word) | Q(title__icontains=word)) for word in request.POST.get('all', '').split()])
|
||||||
queries.extend([Q(artist__icontains=word) for word in request.POST.get('artist', '').split()])
|
|
||||||
queries.extend([Q(title__icontains=word) for word in request.POST.get('title', '').split()])
|
|
||||||
queries.extend([Q(user__name__icontains=word) for word in request.POST.get('uploader', '').split()])
|
queries.extend([Q(user__name__icontains=word) for word in request.POST.get('uploader', '').split()])
|
||||||
|
|
||||||
filter_query = queries.pop()
|
filter_query = queries.pop()
|
||||||
|
|||||||
@ -41,7 +41,7 @@ $(function () {
|
|||||||
console.log('Page: ' + $(this).val());
|
console.log('Page: ' + $(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#search-all, #search-artist, #search-title, #search-uploader, .pagenum').change(function(){
|
$('#search-all, #search-uploader, .pagenum').change(function(){
|
||||||
getSongs();
|
getSongs();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -180,12 +180,10 @@ function refreshQueue()
|
|||||||
function getSongs()
|
function getSongs()
|
||||||
{
|
{
|
||||||
var all = $('#search-all').val();
|
var all = $('#search-all').val();
|
||||||
var artist = $('#search-artist').val();
|
|
||||||
var title = $('#search-title').val();
|
|
||||||
var uploader = $('#search-uploader').val();
|
var uploader = $('#search-uploader').val();
|
||||||
var page = $('.pagenum').val();
|
var page = $('.pagenum').val();
|
||||||
var pagesize = $('.pagesize').val();
|
var pagesize = $('.pagesize').val();
|
||||||
$.post('/api/songs', {all: all, artist: artist, title: title, uploader: uploader, page: page, pagesize: pagesize, csrfmiddlewaretoken: csrf_token}, function (result) {
|
$.post('/api/songs', {all: all, uploader: uploader, page: page, pagesize: pagesize, csrfmiddlewaretoken: csrf_token}, function (result) {
|
||||||
$('#request-table tbody').empty();
|
$('#request-table tbody').empty();
|
||||||
songs = result.data;
|
songs = result.data;
|
||||||
$.each(songs, function (id, song) {
|
$.each(songs, function (id, song) {
|
||||||
|
|||||||
@ -8,7 +8,6 @@
|
|||||||
<button id="request-button" class="btn btn-primary">Request</button>
|
<button id="request-button" class="btn btn-primary">Request</button>
|
||||||
<br><br>
|
<br><br>
|
||||||
<div id="request-container" class="hidden">
|
<div id="request-container" class="hidden">
|
||||||
<input id="search-all" class="search-input" type="text">
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table id="request-table" class="table table-striped">
|
<table id="request-table" class="table table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
@ -18,8 +17,7 @@
|
|||||||
<th>Uploader</th>
|
<th>Uploader</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><input id="search-artist" class="search-input" type="text"></th>
|
<th colspan="2"><input id="search-all" class="search-input" type="text"></th>
|
||||||
<th><input id="search-title" class="search-input" type="text"></th>
|
|
||||||
<th><input id="search-uploader" class="search-input" type="text"></th>
|
<th><input id="search-uploader" class="search-input" type="text"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
Reference in New Issue
Block a user