Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Update chat_application/templates/room.html
Browse filesAdd abort confirmation popup with feedback form and encouragement.
chat_application/templates/room.html
CHANGED
|
@@ -14,19 +14,20 @@
|
|
| 14 |
</div>
|
| 15 |
<h1 id="home-header">Chat Room</h1>
|
| 16 |
<div id="room-subsection">
|
| 17 |
-
<div class="topic-
|
| 18 |
<div class="topic-header-info">
|
| 19 |
<h2 id="room-code-display">Topic: <span class="topic-title">{{ topic_info.title }}</span></h2>
|
| 20 |
</div>
|
| 21 |
<div class="topic-header-buttons">
|
| 22 |
-
<button id="end-exp-btn">Chat Session
|
| 23 |
<button id="abort-exp-btn">Abort Experiment</button>
|
| 24 |
</div>
|
| 25 |
</div>
|
| 26 |
<div id="end-modal" class="modal">
|
| 27 |
<div class="modal-content">
|
| 28 |
-
<h3>Only Exit This Way
|
| 29 |
-
<p>This signals the end of the chat session of the experiment. You will be redirected to the post-survey.
|
|
|
|
| 30 |
<div class="modal-buttons">
|
| 31 |
<button class="modal-btn" id="endYesBtn">Continue</button>
|
| 32 |
<button class="modal-btn" id="endNoBtn">Cancel</button>
|
|
@@ -36,7 +37,19 @@
|
|
| 36 |
<div id="abort-modal" class="modal">
|
| 37 |
<div class="modal-content">
|
| 38 |
<h3>Are you sure you want to leave this experiment?</h3>
|
| 39 |
-
<p>This action is permanent. You will be redirected to the post-survey and will not be able to return to the chat room.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
<div class="modal-buttons">
|
| 41 |
<button class="modal-btn" id="abortYesBtn">Yes</button>
|
| 42 |
<button class="modal-btn" id="abortNoBtn">Cancel</button>
|
|
@@ -162,10 +175,15 @@
|
|
| 162 |
};
|
| 163 |
// Handler for the Abort Experiment confirmation pop-up
|
| 164 |
let modal = document.getElementById("abort-modal");
|
|
|
|
| 165 |
document.getElementById("abort-exp-btn").onclick = function () {
|
| 166 |
modal.style.display = "block";
|
| 167 |
};
|
| 168 |
-
document.getElementById("
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
modal.style.display = "none";
|
| 170 |
};
|
| 171 |
document.getElementById("abortYesBtn").onclick = function (e) {
|
|
@@ -175,7 +193,7 @@
|
|
| 175 |
fetch("/abort", { method: "POST" })
|
| 176 |
.then(() => {
|
| 177 |
window.open(endpoint, "_blank");
|
| 178 |
-
|
| 179 |
modal.style.display = "none";
|
| 180 |
textarea.disabled = true;
|
| 181 |
textarea.placeholder = "The chat has ended.";
|
|
@@ -183,9 +201,14 @@
|
|
| 183 |
document.getElementById("end-exp-btn").disabled = true;
|
| 184 |
document.getElementById("abort-exp-btn").disabled = true;
|
| 185 |
if (socketio) {
|
| 186 |
-
|
| 187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
};
|
|
|
|
| 189 |
// add auto scroll
|
| 190 |
function isNearBottom(container, threshold = 120) {
|
| 191 |
const distanceFromBottom = container.scrollHeight - (container.scrollTop + container.clientHeight);
|
|
|
|
| 14 |
</div>
|
| 15 |
<h1 id="home-header">Chat Room</h1>
|
| 16 |
<div id="room-subsection">
|
| 17 |
+
<div class="topic-heFader-row">
|
| 18 |
<div class="topic-header-info">
|
| 19 |
<h2 id="room-code-display">Topic: <span class="topic-title">{{ topic_info.title }}</span></h2>
|
| 20 |
</div>
|
| 21 |
<div class="topic-header-buttons">
|
| 22 |
+
<button id="end-exp-btn">End Chat Session</button>
|
| 23 |
<button id="abort-exp-btn">Abort Experiment</button>
|
| 24 |
</div>
|
| 25 |
</div>
|
| 26 |
<div id="end-modal" class="modal">
|
| 27 |
<div class="modal-content">
|
| 28 |
+
<h3>Only Exit This Way After 20 Minutes of Participation in the Chatroom.</h3>
|
| 29 |
+
<p>This signals the end of the chat session of the experiment. You will be redirected to the post-survey.</p>
|
| 30 |
+
<p>This button is only to be used at the end of your 20 minutes of participation in the chatroom. <strong>If you wish to exit the chat before finishing your 20 minutes, use the "Abort Experiment" button instead.</strong></p>
|
| 31 |
<div class="modal-buttons">
|
| 32 |
<button class="modal-btn" id="endYesBtn">Continue</button>
|
| 33 |
<button class="modal-btn" id="endNoBtn">Cancel</button>
|
|
|
|
| 37 |
<div id="abort-modal" class="modal">
|
| 38 |
<div class="modal-content">
|
| 39 |
<h3>Are you sure you want to leave this experiment?</h3>
|
| 40 |
+
<p>This action is permanent. You will be redirected to the post-survey and will not be able to return to the chat room.</p>
|
| 41 |
+
<p><strong>If you finished your 20 minutes in the chatroom, do NOT exit via this button. Use the "Chat Session Ends" button instead.</strong></p>
|
| 42 |
+
<div class="modal-buttons">
|
| 43 |
+
<button class="modal-btn" id="abortYesBtn-pre">Yes</button>
|
| 44 |
+
<button class="modal-btn" id="abortNoBtn-pre">Cancel</button>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
</div>
|
| 48 |
+
<div id="abort-modal-confirm" class="modal">
|
| 49 |
+
<div class="modal-content">
|
| 50 |
+
<h3>Confirmation</h3>
|
| 51 |
+
<p>By clicking yes, you will exit the experiment <strong>without</strong> completing the final survey.</p>
|
| 52 |
+
<p>p>We encourage you to message us about any concerns or <a href="https://umw.qualtrics.com/jfe/form/SV_08v26NssCOwZTP8{{ feedback_form_url_encoding }}" target="_blank">provide feedback here</a>.</p>
|
| 53 |
<div class="modal-buttons">
|
| 54 |
<button class="modal-btn" id="abortYesBtn">Yes</button>
|
| 55 |
<button class="modal-btn" id="abortNoBtn">Cancel</button>
|
|
|
|
| 175 |
};
|
| 176 |
// Handler for the Abort Experiment confirmation pop-up
|
| 177 |
let modal = document.getElementById("abort-modal");
|
| 178 |
+
let abortModalConfirm = document.getElementById("abort-modal-confirm");
|
| 179 |
document.getElementById("abort-exp-btn").onclick = function () {
|
| 180 |
modal.style.display = "block";
|
| 181 |
};
|
| 182 |
+
document.getElementById("abortYesBtn-pre").onclick = function () {
|
| 183 |
+
abortModalConfirm.style.display = "block";
|
| 184 |
+
modal.style.display = "none";
|
| 185 |
+
};
|
| 186 |
+
document.getElementById("abortNoBtn-pre").onclick = function () {
|
| 187 |
modal.style.display = "none";
|
| 188 |
};
|
| 189 |
document.getElementById("abortYesBtn").onclick = function (e) {
|
|
|
|
| 193 |
fetch("/abort", { method: "POST" })
|
| 194 |
.then(() => {
|
| 195 |
window.open(endpoint, "_blank");
|
| 196 |
+
});
|
| 197 |
modal.style.display = "none";
|
| 198 |
textarea.disabled = true;
|
| 199 |
textarea.placeholder = "The chat has ended.";
|
|
|
|
| 201 |
document.getElementById("end-exp-btn").disabled = true;
|
| 202 |
document.getElementById("abort-exp-btn").disabled = true;
|
| 203 |
if (socketio) {
|
| 204 |
+
socketio.close();
|
| 205 |
}
|
| 206 |
+
abortModalConfirm.style.display = "none";
|
| 207 |
+
};
|
| 208 |
+
document.getElementById("abortNoBtn").onclick = function () {
|
| 209 |
+
abortModalConfirm.style.display = "none";
|
| 210 |
};
|
| 211 |
+
|
| 212 |
// add auto scroll
|
| 213 |
function isNearBottom(container, threshold = 120) {
|
| 214 |
const distanceFromBottom = container.scrollHeight - (container.scrollTop + container.clientHeight);
|