Sha256: c724532c0d16ca9f925f83654b44f95e9758a8a27524219de835146f9ca18271

Contents?: true

Size: 1.26 KB

Versions: 7

Compression:

Stored size: 1.26 KB

Contents

$(document).ready(function() {

  $(document).on('click', 'span[data-formily-new-response]', function(e){
    var self = $(this);
    var data = self.data('formilyNewResponse');
    var url = self.data('href');

    if(self.parents('table:first').data('formilyFlag')) {
      data.flag = true;
    }

    $.ajax({
      url: url,
      type: 'POST',
      data: data,
      success: function(){
        $(document).trigger('formily_update_table', data);
      },
      error: function(resp){
        console.error(resp.responseJSON.msg);
        alert(resp.responseJSON.msg);
      }
    });

    e.preventDefault();
  });

  $(document).on('click', 'span[data-formily-delete-response-id]', function(e){
    var self = $(this);
    var id = self.data('formilyDeleteResponseId');
    var data = self.data('formilyResponse');

    if(confirm('Are you sure you want to delete the form submission?')){
      $.ajax({
        url: FormilyRoutes.response_delete_path(id),
        data: data,
        type: 'DELETE',
        success: function(){
          $(document).trigger('formily_update_table', data);
        },
        error: function(resp){
          console.error(resp.responseJSON.msg);
          alert(resp.responseJSON.msg);
        }
      });
    }
    e.preventDefault();
  });
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
formily-0.0.5.6.5 app/assets/javascripts/formily/base/form_response.js
formily-0.0.5.6.4 app/assets/javascripts/formily/base/form_response.js
formily-0.0.5.6.3 app/assets/javascripts/formily/base/form_response.js
formily-0.0.5.6.2 app/assets/javascripts/formily/base/form_response.js
formily-0.0.5.6.1 app/assets/javascripts/formily/base/form_response.js
formily-0.0.5.6.0 app/assets/javascripts/formily/base/form_response.js
formily-0.0.5.5.9 app/assets/javascripts/formily/base/form_response.js