Skip to content

Commit

Permalink
Replaced alert in each category with at least one entry unknown to si…
Browse files Browse the repository at this point in the history
…ngle alert for the language at the top of page
  • Loading branch information
ulyssear committed Oct 28, 2023
1 parent 871aa58 commit 914775d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
19 changes: 11 additions & 8 deletions web/templates/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ <h1 class="col-12">{{ title }}</h1>
the language column{{ languages | length | pluralize }} to correct any
information.
</p>
{% for lang in languages %}
{% if lang.is_incomplete %}
<div class="alert alert-link" role="alert">
{{ lang.name }} ({{ lang.version }})'s thesaurus is incomplete. Please help us improve by
<a href="https://github.com/codethesaurus/codethesaur.us/edit/main/web/thesauruses/{{ lang.key }}/{{ lang.version }}/{{ concept }}.json" rel="noopener">
adding or correcting information
</a>
for this language.
</div>
{% endif %}
{% endfor %}
</div>

{% for category in categories %}
Expand All @@ -38,14 +49,6 @@ <h3 class="text-center">Concept</h3>
<div class="card">
<div class="card-body">
<h3 class="text-center">{{ lang.name }}'s Implementation</h3>
{% with i=forloop.counter %}
{% if category.is_incomplete|slice:i|last %}
<div class="alert alert-warning" role="alert">
This category seems to be incomplete.
<a href="https://github.com/codethesaurus/codethesaur.us/edit/main/web/thesauruses/{{ lang.key }}/{{ lang.version }}/{{ concept }}.json" class="alert-link">Help us improve!</a>
</div>
{% endif %}
{% endwith %}
</div>
</div>
{% endfor %}
Expand Down
8 changes: 7 additions & 1 deletion web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def concepts(request):
category_entry = {
"key": category_key,
"concepts": concepts_list,
"is_incomplete": [False for _ in languages],
"is_incomplete": [False] * len(languages)
}
for i in range(len(languages)):
for concept in concepts_list:
Expand All @@ -205,6 +205,11 @@ def concepts(request):
category_entry["is_incomplete"][i] = True
break
all_categories.append(category_entry)

for lang in languages:
booleans = [category["is_incomplete"][languages.index(lang)] for category in all_categories]
lang._is_incomplete = any(booleans)

return render_concepts(request, languages, meta_structure, all_categories)


Expand All @@ -227,6 +232,7 @@ def render_concepts(request, languages, structure, all_categories):
"key": language.key,
"version": language.version,
"name": language.name,
"is_incomplete": language._is_incomplete,
}
for language in languages
],
Expand Down

0 comments on commit 914775d

Please sign in to comment.