Browse Source

Update commentform component

Daniel Supernault 7 years ago
parent
commit
03f4c23024
1 changed files with 8 additions and 4 deletions
  1. 8 4
      resources/assets/js/components/commentform.js

+ 8 - 4
resources/assets/js/components/commentform.js

@@ -1,6 +1,12 @@
 $(document).ready(function() {
 
-  $('.status-comment-focus').on('click', function(el) {
+  $('.status-card > .card-footer').each(function() {
+    $(this).addClass('d-none');
+  });
+
+  $(document).on('click', '.status-comment-focus', function(el) {
+    var form = $(this).parents().eq(2).find('.card-footer');
+    form.removeClass('d-none');
     var el = $(this).parents().eq(2).find('input[name="comment"]');
     el.focus();
   });
@@ -31,7 +37,7 @@ $(document).ready(function() {
 
       var comment = '<p class="mb-0"><span class="font-weight-bold pr-1"><bdi><a class="text-dark" href="' + profile + '">' + username + '</a></bdi></span><span class="comment-text">'+ reply + '</span><span class="float-right"><a href="' + permalink + '" class="text-dark small font-weight-bold">1s</a></span></p>';
 
-      comments.prepend(comment);
+      comments.append(comment);
       
       commentform.val('');
       commentform.blur();
@@ -41,7 +47,5 @@ $(document).ready(function() {
     .catch(function (res) {
       
     });
- 
   });
-
 });