diff --git a/library/csvparser/csvparser.py b/library/csvparser/csvparser.py index f09bfce..5fb9c96 100644 --- a/library/csvparser/csvparser.py +++ b/library/csvparser/csvparser.py @@ -26,9 +26,9 @@ def getpublications(): pubinfo = { "Title": row["Publication"], "Author": row["Author"], - "Type": row["Type"].lower(), + "Type": row["Type"].lower().title(), "Year": year, - "License": row["LicenseShort"].lower(), + "License": row["LicenseShort"].lower().title(), } publications[row["Id"]] = pubinfo return publications @@ -40,7 +40,7 @@ def gettypes(): csv_as_dict = csv.DictReader(libcsv) listoftypes = [] for row in csv_as_dict: - lowertype = row["Type"].lower() + lowertype = row["Type"].lower().title() if lowertype not in listoftypes: listoftypes.append(lowertype) return listoftypes @@ -67,9 +67,9 @@ def getlicenses(): csv_as_dict = csv.DictReader(libcsv) listoflicenses = [] for row in csv_as_dict: - license = row["LicenseShort"].lower() + license = row["LicenseShort"].lower().title() if not license: - license = "no license mentioned" + license = "No License Mentioned" if license not in listoflicenses: listoflicenses.append(license) return listoflicenses diff --git a/library/csvparser/varlib.csv b/library/csvparser/varlib.csv index 97dbc2f..49a542a 100644 --- a/library/csvparser/varlib.csv +++ b/library/csvparser/varlib.csv @@ -27,7 +27,7 @@ Id,Publication,Author,Year,Custodian,Fields,Type,Publishers,License,LicenseShort 33,"The immaterial labor union #7: immersive advertisement","Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια",,Varia,"labour, Advertisement, immersion, social media",Zine,Self-published,"Zine is published under Gnu free documentation license 1.3 unless otherwise specified ","GNU Free Documentation License",,, 34,"The immateriality labor union #10: immateriality","Lídia Pereira and Δεριζαματζορ Προμπλεμ ιναυστραλια",2017,Varia,"Labour, Immateriality",Zine,Self-published,"GNU Free Documentation License","GNU Free Documentation License",,, 35,"The immaterial labor union. Special Issue #1: Homebrew Server Club","Homebrew Server Club",2017,Varia,"Self-Hosting, Servers, DIY",Zine,Self-published,CC-BY-SA,"Creative commons",,, -36,"Pervasive labour union. Special issue #2: The Entreprecariat","Silvio Lorusso",2017,Varia,"Entreprecariat, Labour, Precarity",Zine,Self-published,,,,"Between April and May 2017 the Zine's name changed from Immaterial Labor Union to Pervasive Labour Union", +36,"Pervasive labour union. Special issue #2: The Entreprecariat","Silvio Lorusso",2017,Varia,"Entreprecariat, Labour, Precarity",Zine,Self-published,"No license mentioned","No license mentioned",,"Between April and May 2017 the Zine's name changed from Immaterial Labor Union to Pervasive Labour Union", 37,"'Pervasive labour union #13: Fed Up","Lídia Pereira",2019,Varia,"Labour, DIY, federation",Zine,Self-published,"GNU Free Documentation License 1.3, CC-0, Copyright (C) 2019, Julia Janssen, Peer Production License","GNU Free Documentation License",,, 38,"Each Page a Function","Raphaël Bastide",2019,Varia,"Automation, Drawing, Web to Print",Paperback,"LeMegot editions","No license mentioned","No license mentioned",,, 39,"In Beweging: Magazine van de Anarchistische Groep Nijmegen","Anarchistische Groep Nijmegen ",2018,Varia,"Anarchism, 1st of May, Nijmegen",Zine,Self-published,"No license mentioned","No license mentioned",,"Anarchistische Bieb de Zwarte Uil. library in Nijmegen open on saturday from 12:00 till 17:30", diff --git a/library/static/css/dropdown.css b/library/static/css/dropdown.css index be97b19..78512cb 100644 --- a/library/static/css/dropdown.css +++ b/library/static/css/dropdown.css @@ -1,12 +1,14 @@ /* Dropdown Button */ /* for sorting on Year, Type, License -.dropbtn { -} - -/* The container
- needed to position the dropdown content */ +*/ .filter { display: none; } + +.activebtn { + background-color: #62b264; +} + .show { display: block; } diff --git a/library/static/js/dropdown.js b/library/static/js/dropdown.js new file mode 100644 index 0000000..03614fc --- /dev/null +++ b/library/static/js/dropdown.js @@ -0,0 +1,56 @@ +// Filter section ===================== old school code divider ================ + +filterSelection("all", "None"); +function filterSelection(c, id) { + resetDropDownButtons(); + var i; + var button = document.getElementById(id); + if(button){ + button.innerText = c; + addClass(button, "activebtn"); + } + var allpublications = document.getElementsByClassName("filter"); + if (c == "all") { + for (i = 0; i < allpublications.length; i++) { + addClass(allpublications[i], "show"); + } + } + else { + for (i = 0; i < allpublications.length; i++) { + removeClass(allpublications[i], "show"); + if (allpublications[i].className.indexOf(c) > -1) { + addClass(allpublications[i], "show"); + } + } + } +} + +function resetDropDownButtons(){ + document.getElementById("License").innerText = "License"; + document.getElementById("PubType").innerText = "Type"; + document.getElementById("Year").innerText = "Year"; + allactivebuttons = document.getElementsByClassName("activebtn"); + for(var i = 0;allactivebuttons.length; i++) { + removeClass(allactivebuttons[i], "activebtn"); + } +} +function addClass(element, name) { + var i, arr1, arr2; + arr1 = element.className.split(" "); + arr2 = name.split(" "); + for (i = 0; i < arr2.length; i++) { + if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];} + } +} + +function removeClass(element, name) { + var i, arr1, arr2; + arr1 = element.className.split(" "); + arr2 = name.split(" "); + for (i = 0; i < arr2.length; i++) { + while (arr1.indexOf(arr2[i]) > -1) { + arr1.splice(arr1.indexOf(arr2[i]), 1); + } + } + element.className = arr1.join(" "); +} diff --git a/library/static/js/script.js b/library/static/js/script.js index b5a3a77..e286451 100644 --- a/library/static/js/script.js +++ b/library/static/js/script.js @@ -23,45 +23,5 @@ const cloud = document.querySelector('#cloud'); function update() { cloud.style.boxShadow = boxShadows(30); } -// Filter section ===================== old school code divider ================ -filterSelection("all") -function filterSelection(c) { - var i; - var allpublications = document.getElementsByClassName("filter"); - if (c == "all") { - for (i = 0; i < allpublications.length; i++) { - addClass(allpublications[i], "show"); - } - } - else { - for (i = 0; i < allpublications.length; i++) { - removeClass(allpublications[i], "show"); - if (allpublications[i].className.indexOf(c) > -1) { - addClass(allpublications[i], "show"); - } - } - } -} - -function addClass(element, name) { - var i, arr1, arr2; - arr1 = element.className.split(" "); - arr2 = name.split(" "); - for (i = 0; i < arr2.length; i++) { - if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];} - } -} - -function removeClass(element, name) { - var i, arr1, arr2; - arr1 = element.className.split(" "); - arr2 = name.split(" "); - for (i = 0; i < arr2.length; i++) { - while (arr1.indexOf(arr2[i]) > -1) { - arr1.splice(arr1.indexOf(arr2[i]), 1); - } - } - element.className = arr1.join(" "); -} window.addEventListener('load', update); diff --git a/library/templates/index.html b/library/templates/index.html index ea60f1d..e879dfe 100644 --- a/library/templates/index.html +++ b/library/templates/index.html @@ -11,5 +11,5 @@ {% endfor%}
- + {% endblock %} diff --git a/library/templates/menu.html b/library/templates/menu.html index c7257e2..6db8e24 100644 --- a/library/templates/menu.html +++ b/library/templates/menu.html @@ -2,26 +2,26 @@