From 1f157935bf83d115b72b168105032f502bcc6e16 Mon Sep 17 00:00:00 2001 From: koksnuss Date: Sun, 10 May 2020 01:09:44 +0200 Subject: [PATCH] begin add coins :))) --- coinmanager/coinc/models.py | 14 +- coinmanager/coinc/static/coinc/main.js | 318 +++++++++++------- coinmanager/coinc/templates/coinc/coin.html | 2 +- .../coinc/templates/coinc/controlbar.html | 1 + .../coinc/templates/coinc/country.html | 2 +- coinmanager/coinc/templates/coinc/year.html | 2 +- coinmanager/coinc/urls.py | 3 +- coinmanager/coinc/views.py | 68 +++- coinmanager/db.sqlite3 | Bin 188416 -> 188416 bytes 9 files changed, 282 insertions(+), 128 deletions(-) diff --git a/coinmanager/coinc/models.py b/coinmanager/coinc/models.py index 411ec46..6d1e61a 100644 --- a/coinmanager/coinc/models.py +++ b/coinmanager/coinc/models.py @@ -49,7 +49,7 @@ class Country(Model): def __str__(self): - return f"{self.name} - {self.name_iso}, Mitglied seit {self.euro_member_since}" + return f"{self.name} - {self.name_iso}" @@ -85,20 +85,20 @@ class Coin(Model): found_on = DateField('Gefunden am', auto_now_add=True) - buy_only = BooleanField('Kursmünze', default=False) - circulation = PositiveIntegerField('Auflage', default=0) - comment = TextField('Kommentar', default='', blank=True) - - in_collector = BooleanField('Im Eurocollector 2002', default=False) + buy_only = BooleanField('Kursmünze', default=False) checked = BooleanField('Von Gigo geprüft und einsortiert', default=False) + in_collector = BooleanField('Im Eurocollector 2002', default=False) + exists = BooleanField('Existiert', default=True) fault_stamp = BooleanField('Fehlprägung', default=False) + comment = TextField('Kommentar', default='', blank=True) + def __str__(self): - return f"Wert: {self.value}, Jahr: {self.year}, Land: {self.country}, Prägerei {self.stamp}, Name {self.name}" + return f"{self.country} {self.year} {self.stamp} {self.value} {self.name}" diff --git a/coinmanager/coinc/static/coinc/main.js b/coinmanager/coinc/static/coinc/main.js index e071291..d3f0915 100644 --- a/coinmanager/coinc/static/coinc/main.js +++ b/coinmanager/coinc/static/coinc/main.js @@ -1,32 +1,25 @@ /* - Copyright (C) 2020 willipink.eu - Author Moritz Münch moritzmuench@mailbox.org + Copyright (C) 2020 willipink.eu + Author Moritz Münch moritzmuench@mailbox.org - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ import { Cookie } from './modules/cookie.mjs'; - -$(document).ready(function() { - - // - // Options - // - - let settings = { +let settings = { found: true, found_by: '', found_on: '', @@ -35,57 +28,193 @@ $(document).ready(function() { checked: false, ec: false, exists: true - } +} + +// +// Functions +// + +// return a datetime YYYY.MM.DD +function get_datetime() { + let datetime = new Date(); + return ('0' + datetime.getDate()).slice(-2) + '.' + + ('0' + (datetime.getMonth() + 1)).slice(-2) + '.' + + datetime.getFullYear(); +} - // - // Buttons - // +// manage user login +function render_login(input_name, input_color) { - // button #begin_edit - $('#begin_edit').click(function() { - $('nav.navbar').fadeIn('fast'); - $('button#begin_edit').fadeOut('fast'); - }); + let color = decodeURIComponent(input_color); + let name = decodeURIComponent(input_name); + new Cookie('coinc-name', name) - // button #finish_edit - $('#finish_edit').click(function() { - $('nav.navbar').fadeOut('fast'); - $('button#begin_edit').fadeIn('fast'); - }); + render_login_color(color); + let option = $('nav.navbar option[value=' + name + ']'); + if (option.length == 0) { + $('nav.navbar select').append($('