Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Pages😳 #71

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions quotefault/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def additional_quotes():

# Get all the quotes
quotes = get_quote_query(speaker = request.args.get('speaker'),
submitter = request.args.get('submitter')).all()
submitter = request.args.get('submitter')).paginate(int(request.args.get("page", default="1")), 20).items

for quote in quotes:
quote[0].quote_time=quote[0].quote_time.astimezone(pytz.timezone('America/New_York'))
Expand All @@ -252,7 +252,7 @@ def additional_quotes():

return render_template(
'bootstrap/additional_quotes.html',
quotes=quotes[20:],
quotes=quotes,
metadata=metadata,
user_votes=user_votes
)
Expand Down
14 changes: 9 additions & 5 deletions quotefault/static/js/load_more.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,28 @@ function buttonAjax(buttonElem, options, failOnly) {
}
}

var currentPage = 1;

$(function () {
$("#get_more").one("click", function (e) {
$("#get_more").click(function (e) {
//Prepare the url with the proper query strings
let urlParams = new URLSearchParams(window.location.search);
let speaker = urlParams.get('speaker');
let submitter = urlParams.get('submitter');
let urlStr = `/additional`;
let page = urlParams.get('page');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this ever get used?

let urlStr = `/additional?j`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is j here?

if(speaker){
urlStr+=`?speaker=${speaker}`;
urlStr+=`&speaker=${speaker}`;
}
if(submitter){
urlStr+=`?submitter=${submitter}`;
urlStr+=`&submitter=${submitter}`;
}
urlStr += "&page=" + (currentPage++);
buttonAjax($(this), {
url: urlStr,
method: 'GET',
success: function (data, textStatus, jqXHR) {
$("#moreQuotes").html(data)
$("#moreQuotes").append(data)
Comment on lines -54 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a bit unsure of how this looks in practice, could you send some redacted/dev screenshots? otherwise I should be able to throw up a local dev instance at some point soon

.collapse("show");
},
error: function (error) {
Expand Down
7 changes: 3 additions & 4 deletions quotefault/templates/bootstrap/storage.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
{% endif %}
{% endwith %}
{{ display( quotes ) }}
<button href="#moreQuotes" id="get_more" data-toggle="collapse" class="btn btn-default center-block">But wait, there's more!</button>
<br>
<div id="moreQuotes" class="collapse" aria-expanded="false">
<div id="moreQuotes" aria-expanded="false">
</div>
<br>
<button href="#moreQuotes" id="get_more" class="btn btn-default center-block">But wait, there's more!</button>
</div>
{% endblock %}

Expand All @@ -30,4 +30,3 @@
<script src="{{ url_for('static', filename='css/votes/upvote.js') }}"></script>
<script src="{{ url_for('static', filename='js/vote.js') }}"></script>
{% endblock %}