Sha256: 59b4e81b43243a40b74770772fcd3913e164141eacc8b003dbbaa0bda617b211

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 Bytes

Contents

#= require admin/spree_backend

(($) ->
  $('form').on 'click', '.add_fields', ->
    time = new Date().getTime()
    regexp = new RegExp($(this).data('id'), 'g')
    $(this).before($(this).data('fields').replace(regexp, time))
    event.preventDefault()

  $('form').on 'click', '.remove', ->
    $(this).parent('.question').children(':hidden[id$=delete]').val(1)
    $(this).parent('.question').slideUp('slow')
    event.preventDefault()

  $('#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()

    $.scrollTo($('#questions .question:last'), 800)
    $('.question:last input:first').focus()

) jQuery

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree-faq-2.1.1 app/assets/javascripts/admin/spree_faq.js.coffee
spree-faq-2.0.1 app/assets/javascripts/admin/spree_faq.js.coffee
spree-faq-2.1.0 app/assets/javascripts/admin/spree_faq.js.coffee
spree-faq-2.0.0 app/assets/javascripts/admin/spree_faq.js.coffee