summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/default/js/comment.js20
-rw-r--r--themes/default/views/page.html.php1
-rw-r--r--themes/default/views/photo.html.php2
3 files changed, 22 insertions, 1 deletions
diff --git a/themes/default/js/comment.js b/themes/default/js/comment.js
new file mode 100644
index 00000000..5d2ed599
--- /dev/null
+++ b/themes/default/js/comment.js
@@ -0,0 +1,20 @@
+$("document").ready(function() {
+ ajaxify_comment_form();
+});
+
+function ajaxify_comment_form() {
+ $("#gCommentForm").ajaxForm({
+ target: "#gCommentForm",
+ complete: function(xhr, statusText) {
+ ajaxify_comment_form();
+ if (xhr.status == 201) {
+ $.get(xhr.getResponseHeader("Location"), function(data, textStatus) {
+ $("#gComment div.gBlockContent ul:first").append(data);
+ $("#gComment div.gBlockContent ul:first li:last").hide().slideDown();
+ }
+ );
+ $("#gCommentForm").clearForm();
+ }
+ }
+ });
+}
diff --git a/themes/default/views/page.html.php b/themes/default/views/page.html.php
index ac2a326b..75c9a1a9 100644
--- a/themes/default/views/page.html.php
+++ b/themes/default/views/page.html.php
@@ -14,6 +14,7 @@
<script src="<?= url::file("lib/jquery.js") ?>" type="text/javascript"></script>
<script src="<?= url::file("lib/jquery.form.js") ?>" type="text/javascript"></script>
<script src="<?= $theme->url("js/user.js") ?>" type="text/javascript"></script>
+ <script src="<?= $theme->url("js/comment.js") ?>" type="text/javascript"></script>
<? if ($user): ?>
<script src="<?= url::file("lib/jquery.jeditable.js") ?>" type="text/javascript"></script>
<? endif; ?>
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php
index 1d54fe7d..8b8f44d4 100644
--- a/themes/default/views/photo.html.php
+++ b/themes/default/views/photo.html.php
@@ -9,5 +9,5 @@
<h1><?= $item->title_edit ?></h1>
<div><?= $item->description_edit ?></div>
- <? comment::show_comments($item->id); ?>
+ <?= comment::block($theme, true); ?>
</div>