Skip to content

Commit

Permalink
Merge pull request #1648 from emfcamp/version-review
Browse files Browse the repository at this point in the history
Changelog page to review all proposal changes
  • Loading branch information
jellybob authored May 25, 2024
2 parents 28bc534 + b82919b commit 35f0491
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
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 %}

0 comments on commit 35f0491

Please sign in to comment.