summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2019-11-09 12:21:40 +0100
committeremkael <emkael@tlen.pl>2019-11-09 12:22:37 +0100
commit3d772272a7bf0d582eeaa527197a08545e3399ae (patch)
tree44e8ed0e0a7f03e83a7a0bbf2c65bccdce76de77
parent9917ceba63481a389d1b636bb95b443a5d475403 (diff)
Configurable age filter menubaza2.csv
Fixes #14
-rwxr-xr-xbin/rankings-tables-build.sh8
-rw-r--r--scripts/rankings-tables-compile.py6
-rw-r--r--templates/menu-age-new.html8
-rw-r--r--templates/menu-age-old.html6
-rw-r--r--templates/ranking.html8
5 files changed, 25 insertions, 11 deletions
diff --git a/bin/rankings-tables-build.sh b/bin/rankings-tables-build.sh
index 0d85972..d3806a7 100755
--- a/bin/rankings-tables-build.sh
+++ b/bin/rankings-tables-build.sh
@@ -2,9 +2,9 @@
CONFIG=$1
DIR=$2
cat $CONFIG |
- jq '.[] | .date, .url, .index, .name' |
- xargs -n4 |
- while read DATE URL INDEX NAME
+ jq '.[] | .date, .url, .index, .menu_age // "old", .name' |
+ xargs -n5 |
+ while read DATE URL INDEX AGEMENU NAME
do
- python scripts/rankings-tables-compile.py "$NAME" $INDEX $DIR/.menu.html $DATE > $DIR/$URL
+ python scripts/rankings-tables-compile.py "$NAME" $INDEX $DIR/.menu.html $DATE "$AGEMENU" > $DIR/$URL
done
diff --git a/scripts/rankings-tables-compile.py b/scripts/rankings-tables-compile.py
index 925404c..0270c54 100644
--- a/scripts/rankings-tables-compile.py
+++ b/scripts/rankings-tables-compile.py
@@ -21,6 +21,12 @@ style_href['href'] = '%s?%d' % ('_res/ranking.css', os.path.getmtime('http/_res/
rawlink = table.select('a#rawlink')[0]
rawlink['href'] = '%s/%s.csv' % (rawlink['href'], ranking_date)
+age_menu = sys.argv[5]
+age_menu_file = file('templates/menu-age-%s.html' % (age_menu))
+age_menu_placeholder = table.select('div[data-menu="age"]')[0]
+age_menu_placeholder.clear()
+age_menu_placeholder.append(bs4(age_menu_file, 'html.parser'))
+
menu_file = file(sys.argv[3])
menu = table.select('div.static-menu')[0]
menu.clear()
diff --git a/templates/menu-age-new.html b/templates/menu-age-new.html
new file mode 100644
index 0000000..a0d4eb7
--- /dev/null
+++ b/templates/menu-age-new.html
@@ -0,0 +1,8 @@
+<button type="button" class="btn btn-default" data-filter="age" data-value="M">M</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="JM">JM</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="JJ">JJ</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="JS">JS</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="">-</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="S">S</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="N">N</button>
+<button type="button" class="btn btn-default" data-clear="age">wszyscy</button>
diff --git a/templates/menu-age-old.html b/templates/menu-age-old.html
new file mode 100644
index 0000000..95172db
--- /dev/null
+++ b/templates/menu-age-old.html
@@ -0,0 +1,6 @@
+<button type="button" class="btn btn-default" data-filter="age" data-value="M">M</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="J">J</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="">-</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="S">S</button>
+<button type="button" class="btn btn-default" data-filter="age" data-value="N">N</button>
+<button type="button" class="btn btn-default" data-clear="age">wszyscy</button>
diff --git a/templates/ranking.html b/templates/ranking.html
index 77636f0..4364cb6 100644
--- a/templates/ranking.html
+++ b/templates/ranking.html
@@ -52,13 +52,7 @@
</div>
<div class="input-group" role="group">
<div class="input-group-addon">Kat. wiekowa</div>
- <div class="input-group-btn">
- <button type="button" class="btn btn-default" data-filter="age" data-value="M">M</button>
- <button type="button" class="btn btn-default" data-filter="age" data-value="J">J</button>
- <button type="button" class="btn btn-default" data-filter="age" data-value="">-</button>
- <button type="button" class="btn btn-default" data-filter="age" data-value="S">S</button>
- <button type="button" class="btn btn-default" data-filter="age" data-value="N">N</button>
- <button type="button" class="btn btn-default" data-clear="age">wszyscy</button>
+ <div class="input-group-btn" data-menu="age">
</div>
</div>
<div class="input-group" role="group">