From 5c8bcba2af4486fdcb791f4ddea03207db7ea81b Mon Sep 17 00:00:00 2001 From: Eric Newcomer Date: Fri, 3 Feb 2023 12:02:32 -0800 Subject: [PATCH 01/53] Fix login redirects from pjax calls --- package.json | 2 +- templates/contacts/contact_history.haml | 6 ++++-- templates/contacts/contact_read.haml | 18 ++++++++++++++++-- templates/smartmin/base.html | 22 ++++++++++------------ templates/spa_frame.haml | 11 +++++------ yarn.lock | 8 ++++---- 6 files changed, 40 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index c5d635c0584..6831f566071 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "colorette": "1.2.2", "fa-icons": "0.2.0", "highcharts": "5.0.6", - "intercooler": "1.1.2", + "intercooler": "1.2.3", "is-core-module": "2.4.0", "jquery": "2.1.0", "jquery-migrate": "1.4.1", diff --git a/templates/contacts/contact_history.haml b/templates/contacts/contact_history.haml index 2666363ccb0..7adda9e00cc 100644 --- a/templates/contacts/contact_history.haml +++ b/templates/contacts/contact_history.haml @@ -194,8 +194,10 @@ %tr{ ic-append-from:"/contact/history/{{contact.uuid}}/?after={{ next_after }}&before={{ next_before }}", ic-trigger-on:"scrolled-into-view", ic-target:"table.activity tbody.previous", - ic-indicator:"#indicator" } - + ic-indicator:"#indicator", + ic-on-success:"checkForPJAX" + } + -if not has_older and not recent_only and start_date -if start_date %tr.archive-note diff --git a/templates/contacts/contact_read.haml b/templates/contacts/contact_read.haml index 6f013223b54..08a9765d1fb 100644 --- a/templates/contacts/contact_read.haml +++ b/templates/contacts/contact_read.haml @@ -242,7 +242,10 @@ ic-trigger-on:"scrolled-into-view", ic-poll:"5s", ic-target:"table .recent", - ic-poll-repeats:"30" } + ic-poll-repeats:"30", + ic-on-success:"checkForPJAX" + + } %tbody.recent @@ -250,7 +253,9 @@ %tr{ ic-append-from:"/contact/history/{{contact.uuid}}/?before={{recent_start}}", ic-trigger-on:"scrolled-into-view", ic-target:"table .previous", - ic-indicator:"#indicator" } + ic-indicator:"#indicator", + ic-on-success:"checkForPJAX" + } %tbody.previous @@ -483,6 +488,15 @@ :javascript + function checkForPJAX(selection, data, status, xhr) { + if (data.indexOf(" -1) { + // we shouldnt have an html tag for pjax + document.location.reload(); + return false; + } + return true; + } + var startTime = null; function contactUpdated() { document.location.reload(); diff --git a/templates/smartmin/base.html b/templates/smartmin/base.html index 81670bdf9c5..46401f14afd 100644 --- a/templates/smartmin/base.html +++ b/templates/smartmin/base.html @@ -12,16 +12,8 @@ diff --git a/templates/msgs/broadcast_scheduled_spa.haml b/templates/msgs/broadcast_scheduled_spa.haml index 531fc40564c..5949c625760 100644 --- a/templates/msgs/broadcast_scheduled_spa.haml +++ b/templates/msgs/broadcast_scheduled_spa.haml @@ -7,7 +7,10 @@ -block action-buttons --block page-container +-block spa-title + {{title}} + +-block content .mt-4 %table.list.lined.w-full %tbody diff --git a/templates/smartmin/base.html b/templates/smartmin/base.html index 46401f14afd..7c5ae1becdf 100644 --- a/templates/smartmin/base.html +++ b/templates/smartmin/base.html @@ -8,115 +8,6 @@ {% block extra-script %} {{ block.super}} - - - {# embed refresh script if refresh is active #} {% if refresh %}