From 2e658de2192c20d78fbcdf702ab81f91904a51b9 Mon Sep 17 00:00:00 2001 From: koksnuss Date: Mon, 11 May 2020 01:33:27 +0200 Subject: [PATCH] finish first prototype --- coinmanager/coinc/static/coinc/main.js | 39 ++++++++++++++----------- coinmanager/db.sqlite3 | Bin 200704 -> 200704 bytes 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index b27ecb6..f61f55a 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -139,17 +139,16 @@ function render_response(td, set) { // save/update global settings function save_settings() { - settings['circulation'] = $('#circulation').val(); - let found_on = $('#found_on').val(); - if (found_on) { - settings['found_on'] = found_on; - } else { - settings['found_on'] = get_datetime(); - } + let found_by = $('#found_by option[selected=selected]').html(); - if (found_by) { - settings['found_by'] = found_by; - } + if (found_by) { settings['found_by'] = found_by; } + + let found_on = $('#found_on').val(); + settings['found_on'] = (found_on) ? found_on : get_datetime(); + + let circulation = $('#circulation').val(); + if (circulation) { settings['circulation'] = circulation; } + let checkboxes = $('#found, #buy_only, #checked, #ec, #exists').map(function() { return { [$(this).prop('id')]: $(this).prop('checked') } }).get(); @@ -190,9 +189,8 @@ $(document).ready(function() { let circulation = (settings['circulation'] == 'Auflage') ? 0 : settings['circulation']; // TODO it would be nicer if #circulation, #found_by and #found_on would have no value while #exists is checked. then this would also not be neccessary - if (settings['exists'] === false) { - circulation = 0; - } + if (settings['exists'] === false) { circulation = 0; } + let data = { csrfmiddlewaretoken: csrf_token, value: value, @@ -239,6 +237,7 @@ $(document).ready(function() { }); + // // Misc // @@ -256,6 +255,11 @@ $(document).ready(function() { // save settings save_settings(); + // remove values + $('#found_by, #found_on, #circulation').each(function() { + $(this).val(''); + }); + // disable settings $('#found, #buy_only, #checked, #ec').each(function() { $(this).prop('checked', false); @@ -267,9 +271,12 @@ $(document).ready(function() { // checkbox #exists not checked } else { + // restore values + $('#found_by').val(settings['found_by']); + $('#found_on').val(settings['found_on']); + $('#circulation').val(settings['circulation']); + // restore settings - // $('#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]); @@ -325,7 +332,6 @@ $(document).ready(function() { } }); - // detect ESC keypress $(document).keypress(function(event) { if (event.keyCode == 27) { // ESC is pressed @@ -334,7 +340,6 @@ $(document).ready(function() { } }); - // button #close_modal_add_user $('#close_modal_add_user').click(function() { hide_modal(); diff --git a/coinmanager/db.sqlite3 b/coinmanager/db.sqlite3 index 733dec8eea6a8993aadfc20361a0e0006d46516c..d766e8151a4a9671ae50b574b49060aeb5958ab3 100644 GIT binary patch delta 4272 zcmai$e{5S<703OO#(uWrbJD$NsD#PS9upd9ZQ>?r(5nx1-TbuUHb0sl zoyHJFuh|6JhBgWVDmKbCw1FlDYE+>z1S>#q8!WZya{4t)!r|=2<7M{T4crV_CpT*l@4lcki;Tbpsr{GEWHarYph5O+P z;J}?Q1tTy7`=JNAAOo$?1PS;Qd>n3q8v(%tBk~T8<1qH&Zrp}hY{O=3z-7zv6KLZy zyaB_w1pW)x;2-cecny9#JJTCE(f?}M5+|2G;xAunX%$&7vW{gi-=fwum~WQP zwIXXonnYHMtP*JyX%MLwSt*hbsS~Nad)_%S?-JUF{;Tsa0Z%*NuoLTX1%485K?7c* zYJC{K2KU0};M0(&G7G@F@CJMr9)mBz-7tz#jKF0$56jNN({LKTkDtdRHlYQ7f>+>Q zREtxyGv^{sML8PDBh1t^GdrbvCKV@C|6$c0SM4#?9#tGsJ%+j+q=% z?LpNZQ0;zZrmwE(~q0cLi;;y%^0mzmt7+Pj(QUChi*)zhPTb}T9P8QqNSjBSjq zfpW`8w|8$TY8Q8IW^7_?WMmngOB`YcH#3Yhqn(jrv@tdmgCzN*m9d_&j?uzsW~^nb zVKgyTGgdJg84Zkj#!5zlQOBq~^ZI*6ynkyJMi$qI)I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