summaryrefslogtreecommitdiffstats
path: root/hyperkitty/static
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-01-31 23:37:09 +0100
committerAurélien Bompard <aurelien@bompard.org>2013-02-01 16:37:23 +0100
commit0e944bed0d2f1774c2da52184ac30ab95dd8a11c (patch)
tree09d7cc08c91181580bc809b1aba7108805e711a0 /hyperkitty/static
parent238d19f7e09bfa754f4b91622f1c34d08f2ef26d (diff)
downloadhyperkitty-0e944bed0d2f1774c2da52184ac30ab95dd8a11c.tar.gz
hyperkitty-0e944bed0d2f1774c2da52184ac30ab95dd8a11c.tar.xz
hyperkitty-0e944bed0d2f1774c2da52184ac30ab95dd8a11c.zip
Inline replies
Diffstat (limited to 'hyperkitty/static')
-rw-r--r--hyperkitty/static/css/hyperkitty.css36
-rw-r--r--hyperkitty/static/img/reply.pngbin0 -> 641 bytes
-rw-r--r--hyperkitty/static/js/hyperkitty.js66
-rw-r--r--hyperkitty/static/libs/bootstrap/bootstrap.css2
4 files changed, 93 insertions, 11 deletions
diff --git a/hyperkitty/static/css/hyperkitty.css b/hyperkitty/static/css/hyperkitty.css
index 0ce2c98..c12111c 100644
--- a/hyperkitty/static/css/hyperkitty.css
+++ b/hyperkitty/static/css/hyperkitty.css
@@ -853,3 +853,39 @@ ul.attachments-list li {
border-left: 2px solid rgb(55, 113, 200);
padding-left: 0.2em;
}
+
+
+/*
+ * Replies
+ */
+a.reply {
+ background: url("../img/reply.png") no-repeat left center;
+ padding-left: 20px;
+ margin-left: 2em;
+}
+.reply-form {
+ display: none;
+ padding-top: 1em;
+}
+.reply-form p {
+ margin: 0;
+}
+.reply-form textarea {
+ width: 95%;
+}
+.reply-form .buttons .submit {
+ margin-right: 2em;
+}
+.reply-result {
+ text-align: center;
+}
+.reply-result .alert {
+ display: inline-block;
+}
+.reply-result .alert-success {
+ margin-bottom: 0;
+}
+.reply-result .alert-error {
+ white-space: pre;
+ text-align: left;
+}
diff --git a/hyperkitty/static/img/reply.png b/hyperkitty/static/img/reply.png
new file mode 100644
index 0000000..7348aed
--- /dev/null
+++ b/hyperkitty/static/img/reply.png
Binary files differ
diff --git a/hyperkitty/static/js/hyperkitty.js b/hyperkitty/static/js/hyperkitty.js
index 1bb6719..7e297f4 100644
--- a/hyperkitty/static/js/hyperkitty.js
+++ b/hyperkitty/static/js/hyperkitty.js
@@ -20,17 +20,25 @@
*/
-
/*
- * Voting
+ * Generic
*/
-
-function vote(elem, value) {
- var form_data = $(elem).parent("form").serializeArray();
+function form_to_json(form) {
+ var form_data = form.serializeArray();
var data = {};
for (input in form_data) {
data[form_data[input].name] = form_data[input].value;
}
+ return data;
+}
+
+
+/*
+ * Voting
+ */
+
+function vote(elem, value) {
+ var data = form_to_json($(elem).parent("form"));
data['vote'] = value;
$.ajax({
type: "POST",
@@ -102,11 +110,7 @@ function setup_favorites() {
e.preventDefault();
var form = $(this).parents("form").first();
var action_field = form.find("input[name='action']");
- var form_data = form.serializeArray();
- var data = {};
- for (input in form_data) {
- data[form_data[input].name] = form_data[input].value;
- }
+ var data = form_to_json(form);
$.ajax({
type: "POST",
url: form.attr("action"),
@@ -131,6 +135,47 @@ function setup_favorites() {
}
+/*
+ * Replies
+ */
+
+function setup_replies() {
+ $("a.reply").click(function(e) {
+ e.preventDefault();
+ $(this).next().slideToggle();
+ });
+ $(".reply-form button[type='submit']").click(function(e) {
+ e.preventDefault();
+ var form = $(this).parents("form").first();
+ var data = form_to_json(form);
+ $.ajax({
+ type: "POST",
+ url: form.attr("action"),
+ //dataType: "json",
+ data: data,
+ success: function(response) {
+ form.parents(".reply-form").first().slideUp(function() {
+ form.find("textarea").val("");
+ });
+ $('<div class="reply-result"><div class="alert alert-success">'
+ + response + '</div></div>')
+ .appendTo(form.parents('.email_info').first())
+ .delay(2000).fadeOut('slow', function() { $(this).remove(); });
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ $('<div class="reply-result"><div class="alert alert-error">'
+ + '<button type="button" class="close" data-dismiss="alert">&times;</button> '
+ + jqXHR.responseText + '</div></div>')
+ .css("display", "none").insertBefore(form).slideDown();
+ }
+ });
+ });
+ $(".reply-form a.cancel").click(function(e) {
+ e.preventDefault();
+ $(this).parents(".reply-form").first().slideUp();
+ });
+}
+
/*
* Recent activity graph
@@ -230,4 +275,5 @@ $(document).ready(function() {
setup_quotes();
setup_months_list();
setup_favorites();
+ setup_replies();
});
diff --git a/hyperkitty/static/libs/bootstrap/bootstrap.css b/hyperkitty/static/libs/bootstrap/bootstrap.css
index 8ab3cef..4da7f6d 100644
--- a/hyperkitty/static/libs/bootstrap/bootstrap.css
+++ b/hyperkitty/static/libs/bootstrap/bootstrap.css
@@ -2249,7 +2249,7 @@ table th[class*="span"],
width: 14px;
height: 14px;
margin-top: 1px;
- *margin-right: .3em;
+ margin-right: .3em;
line-height: 14px;
vertical-align: text-top;
background-image: url("../img/glyphicons-halflings.png");