Skip to content

Commit

Permalink
Removed 'Warning', replaced the content of the alert. Alert is only v…
Browse files Browse the repository at this point in the history
…isible for category where there is at least one unknown entry or entry implemented but empty
  • Loading branch information
ulyssear committed Oct 28, 2023
1 parent 1ec272d commit 39cf4c6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
16 changes: 9 additions & 7 deletions web/templates/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ <h1 class="col-12">{{ title }}</h1>
<h3 class="text-center">Concept</h3>
</div>
</div>
{% for lang in languages %}
{% for lang in languages %}
<div class="card">
<div class="card-body">
<h3 class="text-center">{{ lang.name }}'s Implementation</h3>
{% if lang.is_incomplete %}
<div class="alert alert-warning" role="alert">
<strong>Warning!</strong> This thesaurus is 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 %}
{% 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
20 changes: 15 additions & 5 deletions web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,23 @@ def concepts(request):

all_categories = []


for (category_key, category) in meta_structure.categories.items():
concepts_list = [concepts_data(key, name, languages) for (key, name) in category.items()]

all_categories.append({
category_entry = {
"key": category_key,
"concepts": concepts_list
})
"concepts": concepts_list,
"is_incomplete": [False, False]
}
for i in range(len(languages)):
for concept in concepts_list:
if languages[i].concept_unknown(concept["key"]) or \
(languages[i].concept_implemented(concept["key"]) and \
not languages[i].concept_code(concept["key"]) and \
not languages[i].concept_comment(concept["key"]) ):
category_entry["is_incomplete"][i] = True
break
all_categories.append(category_entry)
return render_concepts(request, languages, meta_structure, all_categories)


Expand All @@ -217,7 +227,6 @@ def render_concepts(request, languages, structure, all_categories):
"key": language.key,
"version": language.version,
"name": language.name,
"is_incomplete": language.is_incomplete(language.version, structure.key),
}
for language in languages
],
Expand Down Expand Up @@ -340,6 +349,7 @@ def concepts_data(key, name, languages):
"comment": format_comment_for_display(key, lang)
} for lang in languages ],
}



def render_errors(request, errors):
Expand Down

0 comments on commit 39cf4c6

Please sign in to comment.