From 657bf995447f13efe74812cfd439d9a9642afd5f Mon Sep 17 00:00:00 2001 From: Hugo Santos Date: Fri, 13 Feb 2015 12:06:08 +0100 Subject: [PATCH] Fixed js add and remove questions --- app/assets/javascripts/spree/backend/spree_faq.js.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/spree/backend/spree_faq.js.coffee b/app/assets/javascripts/spree/backend/spree_faq.js.coffee index 520da32..84c74cd 100644 --- a/app/assets/javascripts/spree/backend/spree_faq.js.coffee +++ b/app/assets/javascripts/spree/backend/spree_faq.js.coffee @@ -1,6 +1,6 @@ #= require spree/backend -(($) -> +$(@).ready( -> $('form').on 'click', '.add_fields', -> time = new Date().getTime() regexp = new RegExp($(this).data('id'), 'g') @@ -15,9 +15,8 @@ $('#new_question_link').on 'click', -> $('#questions').append(new_question_html.replace(/NEW_RECORD/g, $('#questions .question').size())) $('#questions .question:last .remove').on 'click', -> - $(this).parent('.question').remove() + $(this).parents('.question').remove() - $.scrollTo($('#questions .question:last'), 800) $('.question:last input:first').focus() -) jQuery \ No newline at end of file +) \ No newline at end of file