diff options
Diffstat (limited to 'static/famille.js')
| -rw-r--r-- | static/famille.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/static/famille.js b/static/famille.js index b460392..3bb9e51 100644 --- a/static/famille.js +++ b/static/famille.js @@ -24,5 +24,23 @@ $(document).ready(function(){ }); $('span.timeago').timeago(); var addr = $(location).attr('pathname'); - $("#"+addr.replace(/\//g,"")).addClass("active") + $("#"+addr.replace(/\//g,"")).addClass("active"); + + $(".edit").click(function(e){ + e.preventDefault(); + $(this).parents(".media-heading").siblings(".comment-content").hide(); + $(this).parents(".media-heading").siblings(".comment-source").show(); + }); + + $(".comment-source").submit(function(e){ + e.preventDefault(); + var comment_id = $(this).data("id"); + var form = $(this); + $.post("/comment/" + comment_id, {content: form.find("textarea").val()}, function(data) { + var comment_content = form.parents(".media-body").find(".comment-content"); + comment_content.html(data.content_cache); + comment_content.show(); + form.hide(); + }); + }); }); |
