This commit is contained in:
Tibor Leupold 2022-10-11 13:55:13 -07:00
Родитель 50ce3162b9
Коммит 4507940a8e
5 изменённых файлов: 23 добавлений и 27 удалений

Просмотреть файл

@ -54,8 +54,6 @@ class BuyersGuideEditorialContentIndexPage(
items.
'''
import time
time.sleep(5)
items = self.get_paginated_items(page=request.GET.get('page'))
return shortcuts.render(
request=request,

Просмотреть файл

@ -174,7 +174,6 @@ class BuyersGuideEditorialContentIndexPageTest(test_base.WagtailpagesTestCase):
# But the load more element
self.assertNotEqual(soup.find_all(id='load-more'), [])
def test_items_route_shows_children_titles(self):
url = self.get_items_route_url()
children = []
@ -295,4 +294,3 @@ class BuyersGuideEditorialContentIndexPageTest(test_base.WagtailpagesTestCase):
related_articles,
[article2, article1, article3],
)

Просмотреть файл

@ -1,24 +1,24 @@
import 'htmx.org'
import "htmx.org";
function main(){
switchFromPaginationToLoadMore()
function main() {
switchFromPaginationToLoadMore();
htmx.onLoad(() => {
// Define what needs to happen whenever new content is added to the DOM.
// We need to configure this every time, because the button elements are destroyed
// and replace with a new element in the response.
setupLoadMoreButtonDisablingOnRequest()
})
setupLoadMoreButtonDisablingOnRequest();
});
}
function switchFromPaginationToLoadMore(){
const loadMore = document.getElementById('load-more')
const pagination = document.getElementById('pagination')
function switchFromPaginationToLoadMore() {
const loadMore = document.getElementById("load-more");
const pagination = document.getElementById("pagination");
if (loadMore && pagination) {
loadMore.classList.remove('tw-hidden')
pagination.classList.add('tw-hidden')
loadMore.classList.remove("tw-hidden");
pagination.classList.add("tw-hidden");
}
}
@ -26,16 +26,16 @@ function setupLoadMoreButtonDisablingOnRequest() {
// Disable the load more button when the request is triggered.
// This is a signal to the user an prevents duplicate triggering.
// We don't need to reactivate the button because it is replaced with the response.
const loadMore = document.getElementById('load-more')
const loadMore = document.getElementById("load-more");
if (!loadMore) {
return
return;
}
const loadMoreButton = loadMore.getElementsByTagName('button')[0]
loadMoreButton.addEventListener('htmx:beforeRequest', (event) => {
event.target.setAttribute('disabled', '')
})
const loadMoreButton = loadMore.getElementsByTagName("button")[0];
loadMoreButton.addEventListener("htmx:beforeRequest", (event) => {
event.target.setAttribute("disabled", "");
});
}
main()
main();

Просмотреть файл

@ -107,11 +107,11 @@ class Petition extends Component {
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
'event' : 'form_submission',
'form_name' : this.props.ctaName,
'form_location' : this.props.formLocation,
'form_type' : 'petition-form',
'form_id' : this.props.petitionId
event: "form_submission",
form_name: this.props.ctaName,
form_location: this.props.formLocation,
form_type: "petition-form",
form_id: this.props.petitionId,
});
}

Просмотреть файл

@ -38,7 +38,7 @@ test(`Foundation homepage`, async ({ page }, testInfo) => {
*
* NOTE: this requires a `new-db` run with the seed value set
* through RANDOM_SEED=530910203 in your .env file
*
*
* NOTE: This test has the .fixme flag as due to the
* recently added load-in animations for products,
* the PNI search test fails randomly.