Skip to content

Commit

Permalink
project list page support for empty database / no projects
Browse files Browse the repository at this point in the history
  • Loading branch information
jesteria committed Apr 15, 2021
1 parent 003b263 commit a7d9bae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/marketplace/templates/marketplace/proj_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ <h4>Filter results</h4>
{% include 'marketplace/components/filter_checkbox.html' with field_name='projectstatus' field_value='completed' field_text='Completed' is_checked=checked_project_fields.completed %}
</fieldset>

{% if project_years %}
<fieldset class="mt-3" name="since">
<legend>Posted in or after</legend>
{# if we make form auto-submit on change, then these should perhaps be anchors. however, as currently implemented, radios perhaps make most sense. #}
{% for project_year, is_checked in project_years %}
{% include 'marketplace/components/filter_checkbox.html' with field_name='postedsince' field_value=project_year field_text=project_year field_type='radio' is_checked=is_checked %}
{% endfor %}
</fieldset>
{% endif %}

<button type="submit"
form="projlist"
Expand Down
2 changes: 1 addition & 1 deletion src/marketplace/views/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def project_list_view(request):
Min('creation_year'),
).values()
)
project_years = range(latest_year, (oldest_year - 1), -1)
project_years = range(latest_year, (oldest_year - 1), -1) if latest_year and oldest_year else ()

try:
filter_year = int(request.GET.get('postedsince', ''))
Expand Down

0 comments on commit a7d9bae

Please sign in to comment.