Changeset View
Standalone View
swh/web/templates/browse/releases.html
{% extends "./browse.html" %} | {% extends "./browse.html" %} | ||||
{% comment %} | {% comment %} | ||||
Copyright (C) 2017-2019 The Software Heritage developers | Copyright (C) 2017-2021 The Software Heritage developers | ||||
anlambert: 2017-2021 | |||||
See the AUTHORS file at the top-level directory of this distribution | See the AUTHORS file at the top-level directory of this distribution | ||||
License: GNU Affero General Public License version 3, or any later version | License: GNU Affero General Public License version 3, or any later version | ||||
See top-level LICENSE file for more information | See top-level LICENSE file for more information | ||||
{% endcomment %} | {% endcomment %} | ||||
{% load swh_templatetags %} | {% load swh_templatetags %} | ||||
{% block swh-browse-content %} | {% block swh-browse-content %} | ||||
{% if displayed_releases|length > 0 %} | |||||
<div class="table-responsive mt-3 mb-3"> | <div class="table-responsive mt-3 mb-3"> | ||||
<div class="form-group row float-right"> | |||||
{% include "includes/branch-search.html" %} | |||||
</div> | |||||
<table class="table swh-table swh-table-striped"> | <table class="table swh-table swh-table-striped"> | ||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<th><i class="{{ swh_object_icons.release }} mdi-fw" aria-hidden="true"></i>Name</th> | <th><i class="{{ swh_object_icons.release }} mdi-fw" aria-hidden="true"></i>Name</th> | ||||
<th>Target</th> | <th>Target</th> | ||||
<th>Message</th> | <th>Message</th> | ||||
<th>Date</th> | <th>Date</th> | ||||
Not Done Inline ActionsIn order to avoid duplicating that HTML code, you should put it in a dedicated HTML file in the templates/includes folder and include it in branches and releases templates with a {% include ... %} directive. You can make the code generic the following way: <div class="form-group row float-right"> <form class="form-horizontal d-none d-md-flex input-group" id="swh-snapshot-search-form"> <input class="form-control" placeholder="{{ search_placeholder }}" id="swh-snapshot-search-string" value="{{search_string}}" type="text" /> <div class="input-group-append"> <button class="btn btn-primary" type="submit" id="swh-snapshot-serach-button"> <i class="swh-search-icon mdi mdi-24px mdi-magnify" aria-hidden="true"></i> </button> </div> </form> </div> This will also enable to not duplicate the JavaScript submit handler but you need to rename the query parameter to name_include to work with both views. anlambert: In order to avoid duplicating that HTML code, you should put it in a dedicated HTML file in the… | |||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
{% if displayed_releases|length > 0 %} | |||||
{% for release in displayed_releases %} | {% for release in displayed_releases %} | ||||
<tr class="swh-release-entry swh-tr-hover-highlight"> | <tr class="swh-release-entry swh-tr-hover-highlight"> | ||||
<td class="swh-release-name"> | <td class="swh-release-name"> | ||||
<a href="{{ release.release_url }}"> | <a href="{{ release.release_url }}"> | ||||
{% if release.alias %} | {% if release.alias %} | ||||
<i class="{{ swh_object_icons.alias }} mdi-fw" aria-hidden="true"></i> | <i class="{{ swh_object_icons.alias }} mdi-fw" aria-hidden="true"></i> | ||||
{% else %} | {% else %} | ||||
<i class="{{ swh_object_icons.release }} mdi-fw" aria-hidden="true"></i> | <i class="{{ swh_object_icons.release }} mdi-fw" aria-hidden="true"></i> | ||||
{% endif %} | {% endif %} | ||||
{{ release.name }} | {{ release.name }} | ||||
</a> | </a> | ||||
</td> | </td> | ||||
<td class="swh-release-target"> | <td class="swh-release-target"> | ||||
<a href="{{ release.target_url }}"> | <a href="{{ release.target_url }}"> | ||||
<i class="{{ swh_object_icons|key_value:release.target_type }} mdi-fw" aria-hidden="true" title="{{ release.tooltip }}"></i>{{ release.target|slice:":7" }} | <i class="{{ swh_object_icons|key_value:release.target_type }} mdi-fw" aria-hidden="true" title="{{ release.tooltip }}"></i>{{ release.target|slice:":7" }} | ||||
</a> | </a> | ||||
</td> | </td> | ||||
<td class="swh-log-entry-message swh-release-message swh-table-cell-text-overflow" title="{{ release.message }}"> | <td class="swh-log-entry-message swh-release-message swh-table-cell-text-overflow" title="{{ release.message }}"> | ||||
{{ release.message }} | {{ release.message }} | ||||
</td> | </td> | ||||
<td class="swh-release-date"> | <td class="swh-release-date"> | ||||
{{ release.date }} | {{ release.date }} | ||||
</td> | </td> | ||||
</tr> | </tr> | ||||
{% endfor %} | {% endfor %} | ||||
{% else %} | |||||
<tr> | |||||
<td> | |||||
{% if search_string %} | |||||
No release names containing {{search_string}} have been found! | |||||
{% else %} | |||||
The list of releases is empty! | |||||
{% endif %} | |||||
</td> | |||||
Not Done Inline ActionsLot of indentation issues here. We should try to find a HTML formatter that works with django template. anlambert: Lot of indentation issues here. We should try to find a HTML formatter that works with django… | |||||
Done Inline ActionsThe problem was jija2-mode was adding some tab chars. I fixed it now jayeshv: The problem was jija2-mode was adding some tab chars. I fixed it now | |||||
Not Done Inline ActionsI am trying to find a good jinja2 formatter that we could use with pre-commit like the black tool for Python code, did not find a good candidate so far. anlambert: I am trying to find a good jinja2 formatter that we could use with `pre-commit` like the… | |||||
Done Inline Actionsjinja-2 mode in emacs works somewhat well. I am adding some conf to avoid TAB chars. jayeshv: jinja-2 mode in emacs works somewhat well. I am adding some conf to avoid TAB chars.
But this… | |||||
Not Done Inline Actionsjs-beautify seems a good candidate as it supports common template languages and can be finely tuned. anlambert: [[ https://github.com/beautify-web/js-beautify | js-beautify ]] seems a good candidate as it… | |||||
Not Done Inline Actionsjs-beautify could also be used to format js code in a consistent way but we need to adapt eslint rules for the both tool to play well, need to do more experiments on the subject. anlambert: js-beautify could also be used to format js code in a consistent way but we need to adapt… | |||||
</tr> | |||||
{% endif %} | |||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
</div> | </div> | ||||
{% else %} | |||||
<i>The list of releases is empty !</i> | |||||
{% endif %} | |||||
{% endblock %} | {% endblock %} | ||||
{% block swh-browse-after-content %} | {% block swh-browse-after-content %} | ||||
{% if prev_releases_url or next_releases_url %} | {% if prev_releases_url or next_releases_url %} | ||||
<ul class="pagination justify-content-center"> | <ul class="pagination justify-content-center"> | ||||
{% if prev_releases_url %} | {% if prev_releases_url %} | ||||
<li class="page-item"><a class="page-link" href="{{ prev_releases_url }}">Previous</a></li> | <li class="page-item"><a class="page-link" href="{{ prev_releases_url }}">Previous</a></li> | ||||
{% else %} | {% else %} | ||||
<li class="page-item disabled"><a class="page-link">Previous</a></li> | <li class="page-item disabled"><a class="page-link">Previous</a></li> | ||||
{% endif %} | {% endif %} | ||||
{% if next_releases_url %} | {% if next_releases_url %} | ||||
<li class="page-item"><a class="page-link" href="{{ next_releases_url }}">Next</a></li> | <li class="page-item"><a class="page-link" href="{{ next_releases_url }}">Next</a></li> | ||||
{% else %} | {% else %} | ||||
<li class="page-item disabled"><a class="page-link">Next</a></li> | <li class="page-item disabled"><a class="page-link">Next</a></li> | ||||
{% endif %} | {% endif %} | ||||
</ul> | </ul> | ||||
{% endif %} | {% endif %} | ||||
{% endblock %} | {% endblock %} |
2017-2021