diff --git a/marietje/marietje/context_processors.py b/marietje/marietje/context_processors.py new file mode 100644 index 0000000..170dd78 --- /dev/null +++ b/marietje/marietje/context_processors.py @@ -0,0 +1,6 @@ +from django.conf import settings + + +def global_settings(request): + return {'issues_url': settings.ISSUES_URL, 'contact_email': settings.CONTACT_EMAIL, + 'merge_requests_url': settings.MERGE_REQUESTS_URL} diff --git a/marietje/marietje/settings.py b/marietje/marietje/settings.py index 577fa9e..402a1dd 100644 --- a/marietje/marietje/settings.py +++ b/marietje/marietje/settings.py @@ -66,6 +66,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'marietje.context_processors.global_settings', ], }, }, @@ -79,8 +80,12 @@ WSGI_APPLICATION = 'marietje.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'marietje', + 'USER': 'marietje', + 'PASSWORD': 'UYmINKUDXIfY1qudVhbr5UhJ61kVwZPA', + 'HOST': 'localhost', + 'PORT': '3306', } } @@ -150,3 +155,11 @@ MAX_MINUTES_IN_A_ROW = 20 # Time range (dependent on timezone specified) when MAX_MINUTES_IN_A_ROW is in effect. LIMIT_ALWAYS = False LIMIT_HOURS = (12, 16) + +CONTACT_EMAIL = 'marietje@science.ru.nl' + +STATS_TOP_COUNT = 50 +STATS_REQUEST_IGNORE_USER_IDS = (51, 515) + +ISSUES_URL = 'https://gitlab.science.ru.nl/Marietje/MarietjeDjango/issues' +MERGE_REQUESTS_URL = 'https://gitlab.science.ru.nl/Marietje/MarietjeDjango/merge_requests' diff --git a/marietje/marietje/static/css/custom.css b/marietje/marietje/static/css/custom.css index 0009f9b..f97451c 100644 --- a/marietje/marietje/static/css/custom.css +++ b/marietje/marietje/static/css/custom.css @@ -17,3 +17,7 @@ #queue-time-header { cursor: pointer; } + +footer { + text-align: center; +} diff --git a/marietje/marietje/static/js/queue.js b/marietje/marietje/static/js/queue.js index 88db7ce..3fcc9e9 100644 --- a/marietje/marietje/static/js/queue.js +++ b/marietje/marietje/static/js/queue.js @@ -48,39 +48,39 @@ $(function () { $('#cancel-request').click(function () { hideRequestTable(); }); - + $('.pagenum').change(function(){ getSongs(); }); - + $('#search-all, #search-uploader').change(function(){ $('.pagenum').val(1); getSongs(); }); $('.pagesize').change(function(){ - Cookies.set('pagesize', $(this).val()); + Cookies.set('pagesize', $(this).val(), { expires: 365 }); $('.pagenum').val(1); getSongs(); }); - + $('button.prev').click(function(){ var pageNumSelect = $('.pagenum'); pageNumSelect.val(Math.max(parseInt(pageNumSelect.val()) - 1, 1)); getSongs(); }); - + $('button.next').click(function(){ var pageNumSelect = $('.pagenum'); pageNumSelect.val(Math.min(parseInt(pageNumSelect.val()) + 1, pageNumSelect.children('option:last-child').val())); getSongs(); }); - + $('button.first').click(function(){ $('.pagenum').val(1); getSongs(); }); - + $('button.last').click(function(){ var pageNumSelect = $('.pagenum'); pageNumSelect.val(pageNumSelect.children('option:last-child').val()); @@ -126,7 +126,7 @@ $(function () { $('#queue-time-header').click(function(){ showTimeToPlay = !showTimeToPlay; $('#queue-time-header').text(showTimeToPlay ? 'Plays In' : 'Plays At'); - Cookies.set('showtimetoplay', showTimeToPlay ? '1' : '0'); + Cookies.set('showtimetoplay', showTimeToPlay ? '1' : '0', { expires: 365 }); }); getSongs(); }); @@ -279,6 +279,14 @@ function getSongs() } pageNumSelect.val(result.current_page); $('.pagesize').val(result.per_page); + $('button.first').prop('disabled', result.current_page == 1); + $('button.prev').prop('disabled', result.current_page == 1); + $('button.next').prop('disabled', result.current_page == result.last_page); + $('button.last').prop('disabled', result.current_page == result.last_page); + refreshingSongs = false; + if(requestViewOpen) { + window.scrollTo(0, 0); + } }); } diff --git a/marietje/marietje/templates/base.html b/marietje/marietje/templates/base.html index 23bab7e..6426d87 100644 --- a/marietje/marietje/templates/base.html +++ b/marietje/marietje/templates/base.html @@ -7,7 +7,7 @@