Merge artist and title searchbar into a single textbox.

This commit is contained in:
Jim Driessen
2017-01-25 01:57:52 +01:00
parent e3b9ca66a5
commit 6982a7a95b
3 changed files with 3 additions and 9 deletions

View File

@ -32,8 +32,6 @@ def songs(request):
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(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()])
filter_query = queries.pop()

View File

@ -41,7 +41,7 @@ $(function () {
console.log('Page: ' + $(this).val());
});
$('#search-all, #search-artist, #search-title, #search-uploader, .pagenum').change(function(){
$('#search-all, #search-uploader, .pagenum').change(function(){
getSongs();
});
@ -180,12 +180,10 @@ function refreshQueue()
function getSongs()
{
var all = $('#search-all').val();
var artist = $('#search-artist').val();
var title = $('#search-title').val();
var uploader = $('#search-uploader').val();
var page = $('.pagenum').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();
songs = result.data;
$.each(songs, function (id, song) {

View File

@ -8,7 +8,6 @@
<button id="request-button" class="btn btn-primary">Request</button>
<br><br>
<div id="request-container" class="hidden">
<input id="search-all" class="search-input" type="text">
<div class="table-responsive">
<table id="request-table" class="table table-striped">
<thead>
@ -18,8 +17,7 @@
<th>Uploader</th>
</tr>
<tr>
<th><input id="search-artist" class="search-input" type="text"></th>
<th><input id="search-title" class="search-input" type="text"></th>
<th colspan="2"><input id="search-all" class="search-input" type="text"></th>
<th><input id="search-uploader" class="search-input" type="text"></th>
</tr>
</thead>