summaryrefslogtreecommitdiff
path: root/static/js/controllers/comments_controller.js
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-26 15:40:55 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-26 15:40:55 -0600
commit9e38502edec81c47a54641186d888f191ed999f0 (patch)
treeca24af8b32148d1792250fff1b9d41b5ceb78c7b /static/js/controllers/comments_controller.js
parentadb6f7e9e73716e58529d96540f204e5e0825179 (diff)
Add pagination handling
Diffstat (limited to 'static/js/controllers/comments_controller.js')
-rw-r--r--static/js/controllers/comments_controller.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/static/js/controllers/comments_controller.js b/static/js/controllers/comments_controller.js
index a21bd05..683f5ca 100644
--- a/static/js/controllers/comments_controller.js
+++ b/static/js/controllers/comments_controller.js
@@ -1,10 +1,12 @@
import { BaseController } from "./base_controller.js";
+import { Paginator } from "../paginator.js";
export class CommentsController extends BaseController {
constructor(replies_controller) {
super();
this.replies_controller = replies_controller;
this.comments_node = document.getElementById("comments-thread");
+ this.paginator = new Paginator(this.comments_server_host, "/api/comments", this.post);
this.renderForm();
this.renderComments();
}
@@ -28,6 +30,7 @@ export class CommentsController extends BaseController {
if(comments != null) {
this.comments_node.appendChild(comments);
this.replies_controller.init();
+ this.paginator.populatePageAnchors();
}
});
}
@@ -39,7 +42,10 @@ export class CommentsController extends BaseController {
}
async submit(event) {
- super.submit(event, `${this.comments_server_host}/api/comments?path=${this.post}`);
+ var form = new FormData(event.target);
+ form.append("domain", `${window.location.protocol}//${window.location.host}`);
+
+ super.submit(event, `${this.comments_server_host}/api/comments?path=${this.post}`, form);
}
}