Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changelog page to review all proposal changes #1648

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/cfp_review/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from models.permission import Permission
from sqlalchemy import func, exists, select
from sqlalchemy.orm import joinedload, undefer
from sqlalchemy_continuum.utils import version_class

from main import db, external_url
from .estimation import get_cfp_estimate
Expand Down Expand Up @@ -668,6 +669,17 @@ def message_proposer(proposal_id):
)


@cfp_review.route("/proposals/versions")
@admin_required
def proposal_versions():
size = int(request.args.get("size", "100"))
version_cls = version_class(Proposal)
versions = version_cls.query.order_by(version_cls.modified.desc())
paged_versions = db.paginate(versions, per_page=size, error_out=False)

return render_template("cfp_review/proposal_versions.html", versions=paged_versions)


@cfp_review.route("/proposals/<int:proposal_id>/versions")
@admin_required
def proposal_latest_version(proposal_id):
Expand Down
1 change: 1 addition & 0 deletions templates/cfp_review/_nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
{{ menuitem('Manual Review', ".proposals", proposal_counts['manual-review'], state='manual-review')}}
<li role="separator" class="divider"></li>
{{ menuitem('Summary', ".proposals_summary")}}
{{ menuitem('Changelog', ".proposal_versions" )}}
</ul>
</li>
<li class="dropdown">
Expand Down
50 changes: 50 additions & 0 deletions templates/cfp_review/proposal_versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{% from "_formhelpers.html" import render_field %}
{% extends "cfp_review/base.html" %}
{% block body %}
<table class="table table-condensed">
<tr>
<th>ID</th>
<th>Type</th>
<th>Title</th>
<th>Modified</th>
<th>User</th>
</tr>
{% for version in versions %}
<tr>
<td>{{ version.id }}-{{ version.transaction_id }}</td>
<td>{{ version.type }}</td>
<td>
<a href="{{ url_for('.proposal_version', proposal_id=version.id, txn_id=version.transaction_id) }}">
{{ version.title }}
</a>
</td>
<td>{{ version.modified.strftime("%Y-%m-%d %H:%M") }}</td>
<td>{{ version.user.name }} ({{ version.user.email }}</td>
</tr>
{% endfor %}
</table>

{% if versions.pages > 1 %}
<div>
{{ versions.first }} - {{ versions.last }} of {{ versions.total }}
</div>

<nav aria-label="Version navigation">
<ul class="pagination">
{% if versions.has_prev %}
<li class="page-item"><a class="page-link" href="{{url_for('.proposal_versions', page=versions.prev_num, size=versions.per_page )}}">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</a></li>
{% endif %}
<li class="page-item active"><a class="page-link" href="#">{{ versions.page }}</a></li>
{% if versions.has_next %}
<li class="page-item"><a class="page-link" href="{{url_for('.proposal_versions', page=versions.next_num, size=versions.per_page)}}">
<span aria-hidden="true">&raquo;</span>
<span class="sr-only">Next</span>
</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endblock %}