Applications: improved manager index
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import datetime
|
||||
from sqlalchemy import desc
|
||||
|
||||
from application import db
|
||||
from application.forms import CommentForm
|
||||
from application.models.users import *
|
||||
@@ -9,6 +11,7 @@ from flask.ext.security import login_required, roles_accepted
|
||||
from flask.ext.security.core import current_user
|
||||
|
||||
|
||||
|
||||
applications = Blueprint('applications', __name__)
|
||||
|
||||
@applications.route('/')
|
||||
@@ -16,7 +19,7 @@ applications = Blueprint('applications', __name__)
|
||||
def index():
|
||||
return render_template('applications/index.html',
|
||||
title='applications',
|
||||
applications=Application.query.all())
|
||||
applications=Application.query.order_by(desc('submission_date')).all())
|
||||
|
||||
@applications.route('/view/<int:id>')
|
||||
@login_required
|
||||
|
@@ -14,16 +14,14 @@
|
||||
<th>Status</th>
|
||||
<th class="content-align-center">Voted</th>
|
||||
<th class="content-align-center">Approvals</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for application in applications %}
|
||||
<tr class="{% if not application.is_reviewed() %}danger{% endif %}">
|
||||
<tr class="{% if not application.is_reviewed() %}danger{% endif %} table-row-link" link="{{url_for('applications.view', id=application.id)}}">
|
||||
<td class="relative content-align-center">{{ application.id }}</td>
|
||||
<td><a href="{{url_for('applications.view', id=application.id)}}" >
|
||||
<td>
|
||||
{{application.user.first_name}} {{application.user.last_name}}
|
||||
</a>
|
||||
</td>
|
||||
<td>{{application.city_country}}</td>
|
||||
<td>{{application.submission_date.strftime('%d %B, %Y')}}</td>
|
||||
@@ -54,11 +52,6 @@
|
||||
/
|
||||
{{application.approve + application.reject}}
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{url_for('applications.view', id=application.id)}}" >
|
||||
View <i class="fa fa-angle-double-right"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% if loop.last %}
|
||||
</tbody>
|
||||
@@ -73,3 +66,13 @@
|
||||
<hr/>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block footer_scripts %}
|
||||
<script type="text/javascript">
|
||||
$(".table-row-link").on("click", function() {
|
||||
window.location.href = $(this).attr('link');
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user