|
1 | 1 | {% extends "bootstrap/base.html" %} |
| 2 | +{% from 'bootstrap/macro.html' import display_quotes as display with context %} |
2 | 3 |
|
3 | 4 | {% block styles %} |
4 | 5 | <link rel="stylesheet" href="/static/css/votes/upvote.css"> |
5 | 6 | {% endblock %} |
6 | 7 |
|
7 | 8 | {% block body %} |
8 | | -<script type="text/javascript"> |
9 | | - function report(id){ |
10 | | - // Get the modal |
11 | | - var modal = document.getElementById(`report_${id}`); |
12 | | - modal.style.display = "block"; |
13 | | - } |
14 | | - function reportClose(id){ |
15 | | - // Get the modal |
16 | | - var modal = document.getElementById(`report_${id}`); |
17 | | - modal.style.display = "none"; |
18 | | - } |
19 | | - function hide(id){ |
20 | | - // Get the modal |
21 | | - var modal = document.getElementById(`hide_${id}`); |
22 | | - modal.style.display = "block"; |
23 | | - } |
24 | | - function hideClose(id){ |
25 | | - // Get the modal |
26 | | - var modal = document.getElementById(`hide_${id}`); |
27 | | - modal.style.display = "none"; |
28 | | - } |
29 | | -</script> |
30 | 9 | <div class="container"> |
31 | 10 | <!-- flash relevant message when submit button is clicked --> |
32 | 11 | {% with messages = get_flashed_messages(with_categories=true) %} |
|
38 | 17 | {% endfor %} |
39 | 18 | {% endif %} |
40 | 19 | {% endwith %} |
41 | | - |
42 | | - {% for quote, votes in quotes %} |
43 | | - {% if loop.index0 == 0 and config['PLUG'] == True and metadata.plug != 'False' %} |
44 | | - <div class="card my-3"> |
45 | | - <div class="card-body"> |
46 | | - <div class="plug-body"> |
47 | | - <a href="https://plug.csh.rit.edu" title="Advertisements by CSH: Plug"> |
48 | | - <img style="width: 100%" src="https://plug.csh.rit.edu/data" |
49 | | - alt="Advertisements by CSH: Plug"> |
50 | | - </a> |
51 | | - </div> |
52 | | - </div> |
53 | | - </div> |
54 | | - {% endif %} |
55 | | - |
56 | | - <div class="card m-3"> |
57 | | - |
58 | | - <div class="card-body"> |
59 | | - "{{ quote.quote }}" <b>- {{ get_display_name(quote.speaker) }}</b> |
60 | | - <div id="votes-{{ quote.id }}" class="upvote upvote-meta-stackoverflow"> |
61 | | - <a class="upvote" id="upVote-{{ quote.id }}" onClick="makeVote({{ quote.id }}, 1)"> |
62 | | - </a> |
63 | | - <span class="count"> |
64 | | - {% if votes %} |
65 | | - {{ votes }} |
66 | | - {% else %} |
67 | | - 0 |
68 | | - {% endif %} |
69 | | - </span> |
70 | | - <a class="downvote" id="downVote-{{ quote.id }}" |
71 | | - onClick="makeVote({{ quote.id }}, -1)"> |
72 | | - </a> |
73 | | - </div> |
74 | | - </div> |
75 | | - <div class="card-footer"> |
76 | | - Submitted by <a href="https://profiles.csh.rit.edu/user/{{ quote.submitter }}">{{ get_display_name(quote.submitter) }}</a> on {{ quote.quote_time.strftime('%Y-%m-%d %H:%M:%S') }} |
77 | | - |
78 | | - <button type="button" class="btn btn-danger btn-sm float-right" onclick="report({{quote.id}})" id="report_button_{{quote.id}}">Report</button> |
79 | | - <div class="modal" id="report_{{quote.id}}"> |
80 | | - <div class="modal-dialog" role="document"> |
81 | | - <div class="modal-content"> |
82 | | - <div class="modal-header"> |
83 | | - <h5 class="modal-title">Report Quote</h5> |
84 | | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span |
85 | | - aria-hidden="true">×</span> |
86 | | - </button> |
87 | | - </div> |
88 | | - <div class="modal-body"> |
89 | | - <p>Are you sure you want to report this quote?</p> |
90 | | - </div> |
91 | | - <div class="modal-footer"> |
92 | | - <!-- TODO: Probably should not be using form and buttons and rather be using input. --> |
93 | | - <!-- <a class="btn btn-primary btn-sm" href="/report/{{quote.id}}" id="report::{{quote.id}}" type="button btn-danger">Yes</a> --> |
94 | | - <form method="POST" action="/report/{{quote.id}}" id="report::{{quote.id}}" method="POST"> |
95 | | - <button type="submit" class="btn btn-danger">Yes</button> |
96 | | - </form> |
97 | | - <button type="button" class="btn btn-success" onclck="reportClose({{quote.id}})" id="report_close_{{quote.id}}">No |
98 | | - </button> |
99 | | - </div> |
100 | | - </div> |
101 | | - </div> |
102 | | - </div> |
103 | | - {% if metadata['uid'] == quote.submitter or metadata['uid'] == quote.speaker or metadata['is_admin'] %} |
104 | | - <button type="button" class="btn btn-warning btn-sm float-right" onclick="hide({{quote.id}})" id="hide_button_{{quote.id}}">Hide</button> |
105 | | - <div class="modal" id="hide_{{quote.id}}"> |
106 | | - <div class="modal-dialog" role="document"> |
107 | | - <div class="modal-content"> |
108 | | - <div class="modal-header"> |
109 | | - <h5 class="modal-title">Hide Quote</h5> |
110 | | - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span |
111 | | - aria-hidden="true">×</span> |
112 | | - </button> |
113 | | - </div> |
114 | | - <div class="modal-body"> |
115 | | - <p>Are you sure you want to hide this quote?</p> |
116 | | - </div> |
117 | | - <div class="modal-footer"> |
118 | | - <!-- TODO: Probably should not be using form and buttons and rather be using input. --> |
119 | | - <!-- <a class="btn btn-primary btn-sm" href="/report/{{quote.id}}" id="report::{{quote.id}}" type="button btn-danger">Yes</a> --> |
120 | | - <form method="POST" action="/hide/{{quote.id}}" id="hide::{{quote.id}}" method="POST"> |
121 | | - <button type="submit" class="btn btn-danger">Yes</button> |
122 | | - </form> |
123 | | - <button type="button" class="btn btn-success" onclick="hideClose({{quote.id}})" id="hide_close_{{quote.id}}">No</button> |
124 | | - </div> |
125 | | - </div> |
126 | | - </div> |
127 | | - </div> |
128 | | - {% endif %} |
129 | | - |
130 | | - </div> |
131 | | - </div> |
132 | | - {% endfor %} |
| 20 | + {{ display( quotes ) }} |
133 | 21 | <button href="#moreQuotes" id="get_more" data-toggle="collapse" class="btn btn-default center-block">But wait, there's more!</button> |
134 | 22 | <br> |
135 | 23 | <div id="moreQuotes" class="collapse" aria-expanded="false"> |
|
0 commit comments