Browse Source

Implementation example update

* Adjusted for projects update
* Adjusted for new comments api endpoint now sending if an otp has to be used
projects
Domeniko Gentner 12 months ago
parent
commit
1071acfc4c
  1. 4
      __implementation_example/layouts/partials/comments.html
  2. 13
      __implementation_example/static/js/mysite.js

4
__implementation_example/layouts/partials/comments.html

@ -2,7 +2,7 @@
<!--suppress XmlDuplicatedId -->
<h1 class="is-uppercase has-text-white">comments</h1>
<div class="mb-5" id="labertasche-comment-section" data-remote="http://dev.localhost:1314/comments/example/new">
<div class="mb-5" id="labertasche-comment-section" data-remote="http://dev.localhost:1314/comments/default/new">
<div class="control is-expanded">
<input onkeypress="labertasche_validate_mail();"
onfocusout="labertasche_validate_mail();"
@ -11,6 +11,7 @@
class="input"
type="email"
placeholder="joedoe@example.com">
<label for="labertasche-mail"></label>
</div>
<div class="control is-expanded mt-3">
<textarea oninput="labertasche_text_counter();"
@ -19,6 +20,7 @@
rows="5"
maxlength="1000"
placeholder="40 minimum characters, type something nice..."></textarea>
<label for="labertasche-text"></label>
<p id="labertasche-text-helper"
class="help is-danger">Characters: <span id="labertasche-counter">0/1000</span></p>
</div>

13
__implementation_example/static/js/mysite.js

@ -49,6 +49,7 @@ function labertasche_modal_hide()
modal.classList.remove('is-active');
}
}
window.location.reload(true);
}
function labertasche_comment_not_found()
@ -93,7 +94,12 @@ function labertasche_post_callback(state)
}
if (state === "post-success"){
button.classList.remove("is-loading");
modal_text.innerText = "Your comment was entered, but you need to confirm it, before it becomes active. Please check your mail!"
if (state['sendotp']) {
modal_text.innerText = "Your comment was entered, but you need to confirm it, before it becomes active. Please check your mail!"
}
else{
modal_text.innerText = "Your comment was successfully entered."
}
modal.classList.add('is-active');
}
if (state === "post-fetch-exception" || state === "post-internal-server-error"){
@ -101,6 +107,11 @@ function labertasche_post_callback(state)
modal_text.innerText = "Your comment was not entered because there was an error, which was recorded and reported automatically.";
modal.classList.add('is-active');
}
if (state === "post-duplicate"){
button.classList.remove("is-loading");
modal_text.innerText = "This comment was already made.";
modal.classList.add('is-active');
}
if (state === "post-invalid-email"){
button.classList.remove("is-loading");
modal_text.innerText = "The email you have entered appears to be invalid. Please contact me if you think this was in error.";

Loading…
Cancel
Save