Sha256: 03aeb69a7e6c3493dfead010a05d24803303833cfa7e3452b55d7646444f9260

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

$(document).ready(function() {

  $('.destroy_slide_style').on("click", function() {
   $(this).parent().remove();
  });

  // Handle adding new styles
  var styles_hash_index = 1;
  $('.add_slide_style').click(function() {
    $('#styles_list').append(generate_html_for_hash("new_slide_styles", styles_hash_index));
  });

  // Generates html for new paperclip styles form fields
  generate_html_for_hash = function(hash_name, index) {
    var html = '<li>';
    html += '<label for="' + hash_name + '_' + index + '_name">';
    html += 'Name</label>';
    html += '<input id="' + hash_name + '_' + index + '_name" name="' + hash_name + '[' + index + '][name]" type="text">';
    html += '<label for="' + hash_name + '_' + index + '_value">';
    html += 'Value</label>';
    html += '<input id="' + hash_name + '_' + index + '_value" name="' + hash_name + '[' + index + '][value]" type="text">';
    html += '<a href="#" alt="Destroy" class="destroy_style">&nbsp;x</a>';
    html += '</li>';

    index += 1;
    return html;
  };



});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_multi_slideshow-1.1.4 app/assets/javascripts/admin/slide_settings.js