diff --git a/app/assets/javascripts/step_comments.js b/app/assets/javascripts/step_comments.js index f9715dd40..4260a274f 100644 --- a/app/assets/javascripts/step_comments.js +++ b/app/assets/javascripts/step_comments.js @@ -16,6 +16,7 @@ beforeSend: animateSpinner(that, true), success: function(data){ $(that.children()[0]).html(data.html); + commentFormOnSubmitAction(); animateSpinner(that, false); }, complete: animateSpinner(that, false) @@ -24,15 +25,14 @@ } function refreshComments(child){ - var parent = chils.closest(".step-comment"); + var parent = child.closest(".step-comment"); var link = parent.attr("data-href"); - $.ajax({ method: 'GET', url: link, beforeSend: animateSpinner(parent, true), success: function(data){ - $(parent.children()[0]).html(data.html); + updateCommentHTML(parent, data); animateSpinner(parent, false); }, complete: animateSpinner(parent, false) @@ -42,15 +42,22 @@ function commentFormOnSubmitAction(){ $(".comment-form") .each(function() { - var obj = $(this); - debugger; - obj - .on('submit', function(){ - refreshComments(obj); - }); + bindCommentAjax($(this)); }); } + function bindCommentAjax(form){ + form + .ajaxSuccess( function(){ + refreshComments(form); + }); + } + + function updateCommentHTML(parent, data) { + var comment_form = $(parent.find(".comment-form")); + $(parent.children()[0]).html(data.html); + bindCommentAjax(comment_form); + } + initializeComments(); - commentFormOnSubmitAction(); })(); diff --git a/app/assets/stylesheets/my_modules.scss b/app/assets/stylesheets/my_modules.scss index 07dd950b8..89909c313 100644 --- a/app/assets/stylesheets/my_modules.scss +++ b/app/assets/stylesheets/my_modules.scss @@ -2,6 +2,8 @@ // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ +@import "colors"; + .description-label { word-wrap: break-word; } @@ -14,4 +16,19 @@ .btn-colorselector{ background-color: transparent !important; -} \ No newline at end of file +} + +.step-comment { + border: 1px solid $color-gallery; +} + +.equal { + display: flex; + flex-wrap: wrap; + width: 100%; + + & > div[class*='col-'] { + display: flex; + flex-direction: column; + } +} diff --git a/app/views/steps/_step.html.erb b/app/views/steps/_step.html.erb index 4413d387b..a66d4a1dd 100644 --- a/app/views/steps/_step.html.erb +++ b/app/views/steps/_step.html.erb @@ -30,8 +30,9 @@
-
+