diff options
Diffstat (limited to 'static')
| -rw-r--r-- | static/famille.js | 20 | ||||
| -rw-r--r-- | static/main.css | 15 |
2 files changed, 33 insertions, 2 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(); + }); + }); }); diff --git a/static/main.css b/static/main.css index 5ae7b30..88598a7 100644 --- a/static/main.css +++ b/static/main.css @@ -13,6 +13,19 @@ font-size: 14px; } +.media-body .edit { + display: none; + margin-right: 1em; +} + +.media-body:hover .edit { + display: initial; +} + +.comment-source { + display: none; +} + article > header { margin-bottom: 2em; } @@ -44,4 +57,4 @@ p.kadoscope{ .media-left img{ width: 64px; -}
\ No newline at end of file +} |
