From c01e7998ac800257f092275f6775049319d178b5 Mon Sep 17 00:00:00 2001 From: koksnuss Date: Sat, 9 May 2020 16:17:29 +0200 Subject: [PATCH] finish controlbar :) --- coinmanager/coinc/static/coinc/main.js | 99 +++++++++++++----- coinmanager/coinc/static/coinc/styles.css | 66 +++++++++--- .../coinc/templates/coinc/controlbar.html | 86 ++++++++------- .../coinc/templates/coinc/country.html | 2 + coinmanager/coinc/templates/footer.html | 1 - coinmanager/coinc/templates/header.html | 1 - coinmanager/db.sqlite3 | Bin 188416 -> 188416 bytes 7 files changed, 173 insertions(+), 82 deletions(-) diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index b8f07a3..b2f646e 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -37,11 +37,33 @@ $(document).ready(function() { exists: true } + + // + // Buttons + // + + // button #begin_edit + $('#begin_edit').click(function() { + $('nav.navbar').fadeIn('fast'); + $('button#begin_edit').fadeOut('fast'); + }); + + // button #finish_edit + $('#finish_edit').click(function() { + $('nav.navbar').fadeOut('fast'); + $('button#begin_edit').fadeIn('fast'); + }); + // button #advanced_options $('#show_advanced_options').click(function() { $('#advanced_options').slideToggle(); }); + + // + // Misc + // + // checkbox #exists $('input#exists').change(function() { @@ -49,7 +71,8 @@ $(document).ready(function() { // save settings settings['circulation'] = $('#circulation').val(); - let checkboxes = $('#found_now, #found, #buy_only, #checked, #ec') + settings['found_on'] = $('#found_on').val(); + let checkboxes = $('#found, #buy_only, #checked, #ec') .map(function() { return { [$(this).prop('id')]: $(this).prop('checked') @@ -60,80 +83,91 @@ $(document).ready(function() { } // disable settings - $('#circulation').val('Auflage'); $('#found, #buy_only, #checked, #ec').each(function() { - $(this).prop('checked', false); + $(this).prop('checked', false); }); - $('#found, #select_usernames, #circulation, #buy_only, #checked, #ec').each(function() { - $(this).prop('disabled', 'disabled'); + $('#found, #found_by, #found_on, #circulation, #buy_only, #checked, #ec').each(function() { + $(this).prop('disabled', 'disabled'); }); // checkbox #exists not checked } else { // restore settings - $('#circulation').val(settings['circulation']); + // $('#circulation').val(settings['circulation']); + // $('#found_on').val(settings['found_on']); $('#found_now, #found, #buy_only, #checked, #ec').each(function() { let setting = $(this).prop('id'); $(this).prop('checked', settings[setting]); }); // enable settings - $('#found, #select_usernames, #circulation, #buy_only, #checked, #ec').each(function() { + $('#found, #found_by, #found_on, #circulation, #buy_only, #checked, #ec').each(function() { $(this).prop('disabled', ''); }); } }); - // datepicker TODO make it nicer $.datepicker.setDefaults( $.datepicker.regional['de'] ); - $('input[name=datetime]').datepicker({ + $('input[name=found_on]').datepicker({ defaultDate: new Date(), dateFormat: 'dd.mm.yy' }); + // select username on change + $('nav.navbar select').on('change', function() { + let color = $('nav.navbar option[value=' + this.value + ']').attr('color'); + $('nav.navbar option[selected=selected]').removeAttr('selected'); + render_login(this.value, color); + }); + + + // + // Functions + // + + // manage user login function render_login(input_name, input_color) { - // manage user login let color = decodeURIComponent(input_color); let name = decodeURIComponent(input_name); new Cookie('coinc-name', name) render_login_color(color); - let option = $('div#controlbar option[value=' + name + ']'); + let option = $('nav.navbar option[value=' + name + ']'); if (option.length == 0) { - $('div#controlbar select').append($('