Skip to content

Commit f77a486

Browse files
authored
Merge pull request #51 from PennChopMicrobiomeProgram/47-move-summary-table-to-non-linked-page
Add unlinked summary/ page
2 parents 2614244 + e1df957 commit f77a486

File tree

3 files changed

+57
-46
lines changed

3 files changed

+57
-46
lines changed

app/app.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,15 @@ def submit(ticket_code):
215215
return redirect(url_for("submit", ticket_code=project.ticket_code))
216216

217217

218+
@app.route("/summary")
219+
def summary():
220+
return render_template(
221+
"summary.html",
222+
projects=db.session.query(Project).all(),
223+
submissions=db.session.query(Submission).all(),
224+
)
225+
226+
218227
@app.route("/", methods=["GET", "POST"])
219228
def index():
220229
if request.method == "POST":

app/templates/index.html

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,50 +19,4 @@ <h5 class="m-3">Please submit your project id below to get to the metadata submi
1919
<button type="submit" class="btn btn-success m-3">GO</button>
2020
</form>
2121
</div>
22-
23-
<br /><br />
24-
<table class="display" id="projects">
25-
<thead>
26-
<tr>
27-
<th>Ticket Code</th>
28-
<th>Name</th>
29-
<th>Contact Name</th>
30-
<th>Contact Email</th>
31-
</tr>
32-
</thead>
33-
<tbody>
34-
{% for project in projects %}
35-
<tr>
36-
<td><a href="{{ url_for('show_project', ticket_code=project.ticket_code) }}">{{ project.ticket_code }}</a></td>
37-
<td>{{ project.project_name }}</td>
38-
<td>{{ project.contact_name }}</td>
39-
<td>{{ project.contact_email }}</td>
40-
</tr>
41-
{% endfor %}
42-
</tbody>
43-
</table>
44-
45-
<script type="text/javascript">
46-
$(document).ready(function () {
47-
/* Initialize the DataTable */
48-
oTable = $('#projects').dataTable({
49-
"bSort": false,
50-
"iDisplayLength": 20,
51-
"bLengthChange": false,
52-
"sPaginationType": "full_numbers",
53-
"bStateSave": true,
54-
});
55-
56-
/* Move search box to bottom of summary area */
57-
$("#projects_filter").appendTo('#projects_summary');
58-
59-
/* Snap pagination info to grid */
60-
$("#projects_info").addClass("span-12");
61-
$("#projects_paginate").addClass("span-12 last")
62-
63-
/* Moving the search box breaks the state saving routine */
64-
/* Redraw manually */
65-
oTable.fnDraw();
66-
});
67-
</script>
6822
{% endblock %}

app/templates/summary.html

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{% extends 'base.html' %}
2+
3+
{% block body %}
4+
<table class="display" id="projects">
5+
<thead>
6+
<tr>
7+
<th>Ticket Code</th>
8+
<th>Name</th>
9+
<th>Contact Name</th>
10+
<th>Contact Email</th>
11+
</tr>
12+
</thead>
13+
<tbody>
14+
{% for project in projects %}
15+
<tr>
16+
<td><a href="{{ url_for('show_project', ticket_code=project.ticket_code) }}">{{ project.ticket_code }}</a></td>
17+
<td>{{ project.project_name }}</td>
18+
<td>{{ project.contact_name }}</td>
19+
<td>{{ project.contact_email }}</td>
20+
</tr>
21+
{% endfor %}
22+
</tbody>
23+
</table>
24+
25+
<script type="text/javascript">
26+
$(document).ready(function () {
27+
/* Initialize the DataTable */
28+
oTable = $('#projects').dataTable({
29+
"bSort": false,
30+
"iDisplayLength": 20,
31+
"bLengthChange": false,
32+
"sPaginationType": "full_numbers",
33+
"bStateSave": true,
34+
});
35+
36+
/* Move search box to bottom of summary area */
37+
$("#projects_filter").appendTo('#projects_summary');
38+
39+
/* Snap pagination info to grid */
40+
$("#projects_info").addClass("span-12");
41+
$("#projects_paginate").addClass("span-12 last")
42+
43+
/* Moving the search box breaks the state saving routine */
44+
/* Redraw manually */
45+
oTable.fnDraw();
46+
});
47+
</script>
48+
{% endblock %}

0 commit comments

Comments
 (0)