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 4 years ago
parent 5ac50ed667
commit 1071acfc4c
  1. 4
      __implementation_example/layouts/partials/comments.html
  2. 11
      __implementation_example/static/js/mysite.js

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

@ -49,6 +49,7 @@ function labertasche_modal_hide()
modal.classList.remove('is-active'); modal.classList.remove('is-active');
} }
} }
window.location.reload(true);
} }
function labertasche_comment_not_found() function labertasche_comment_not_found()
@ -93,7 +94,12 @@ function labertasche_post_callback(state)
} }
if (state === "post-success"){ if (state === "post-success"){
button.classList.remove("is-loading"); button.classList.remove("is-loading");
if (state['sendotp']) {
modal_text.innerText = "Your comment was entered, but you need to confirm it, before it becomes active. Please check your mail!" 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'); modal.classList.add('is-active');
} }
if (state === "post-fetch-exception" || state === "post-internal-server-error"){ 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_text.innerText = "Your comment was not entered because there was an error, which was recorded and reported automatically.";
modal.classList.add('is-active'); 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"){ if (state === "post-invalid-email"){
button.classList.remove("is-loading"); 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."; 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