From e22858894e11c435dd236eb200178e6227ffbfd3 Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Wed, 11 Aug 2021 19:36:41 -0700 Subject: [PATCH] add radio input for sorting tags,features by name or numThemes --- rank_hugo_themes.py | 4 +- templates/base.html | 1 + templates/js/buildPage.js | 18 ++ templates/js/buildSelectionMenu.js | 168 +++++++++++------- .../js/buildTagAndFeatureSelectionInputs.js | 49 +++++ templates/js/getAvailableTagsAndFeatures.js | 21 ++- 6 files changed, 194 insertions(+), 67 deletions(-) create mode 100644 templates/js/buildTagAndFeatureSelectionInputs.js diff --git a/rank_hugo_themes.py b/rank_hugo_themes.py index a4a6ae3..4c66659 100755 --- a/rank_hugo_themes.py +++ b/rank_hugo_themes.py @@ -401,7 +401,7 @@ def update_features_list_for_each_hugo_themes(): theme_toml = toml.loads(match.sub(r'"\1"\n', content)) if 'features' in theme_toml: if len(theme_toml['features']) > 0: - theme_features = [feature.lower() for feature in theme_toml['features'] if len(feature) > 0] + theme_features = [feature.lower() for feature in theme_toml['features'] if len(feature) > 1] if theme.num_features != len(theme_features): theme.num_features = len(theme_features) if theme.num_features > 0: if theme.features_list != str(theme_features): theme.features_list = str(theme_features) @@ -447,7 +447,7 @@ def update_tags_list_for_each_hugo_themes(): if 'tags' in theme_toml: if len(theme_toml['tags']) > 0: corrected_tags = get_corrected_tags(theme_toml['tags']) - theme_tags = [tag.lower() for tag in corrected_tags if len(tag) > 0] + theme_tags = [tag.lower() for tag in corrected_tags if len(tag) > 1] if theme.num_tags != len(theme_tags): theme.num_tags = len(theme_tags) if theme.num_tags > 0: if theme.tags_list != str(theme_tags): theme.tags_list = str(theme_tags) diff --git a/templates/base.html b/templates/base.html index 1d646e3..3b1b2b2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -18,6 +18,7 @@