Sha256: 62939387cb2d085b0f5211ab33f2d131bea99e419f44f37483eb2f3a4d6e8449

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

<h3 class="fieldset name"><%= @fieldset.name %></h3>
<p class="fieldset description"><%= @fieldset.description %></p>

<script>
$(function() {

    $( "#enable-sorting" ).toggle( function() {
      // Enable sorting
      $( "#children" ).sortable('enable');
      $( "#children" ).addClass('sort');
      $( "#children" ).find('.admin').css('visibility','hidden');
      $("#enable-sorting").html('Save');
    }, function() {
      // Disable sorting, save results
      $( "#children" ).sortable('disable');
      $( "#children" ).removeClass('sort');
      $( "#children" ).find('.admin').css('visibility','visible');
      $("#enable-sorting").html('Change Ordering');
      $.post( "children/reorder",
              $('#children').nestedSortable('serialize')
            );
    });
    
    $( "#children" ).nestedSortable({
        forcePlaceholderSize: true,
        disableNesting: 'field',
        handle: 'div',
        helper: 'clone',
        items: 'li',
        opacity: .75,
        placeholder: 'placeholder',
        revert: 250,
        tabSize: 25,
        toleranceElement: 'div'
      }).sortable('disable');
});
</script>

<button type="button" id="enable-sorting">Change Ordering</button>

<div id="result"></div>

<ol id="children">
<%= render :partial => 'child', :locals => { :fieldset => @fieldset } %>
</ol>

<%= render :partial => "associate_child", :locals => {:fieldset => @fieldset} %>
<%= link_to 'Add Field', new_dynamic_fieldsets_field_path(:parent => @fieldset.id) %> | 
<%= link_to 'Add Fieldset', new_dynamic_fieldsets_fieldset_path(:parent => @fieldset.id) %> | 
<%= link_to 'Show Parent Fieldset', dynamic_fieldsets_fieldset_path(@fieldset) %> | 
<%= link_to 'Return to Manager', :controller => :fieldsets, :action => :roots %>

<br />

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dynamic_fieldsets-0.0.5 app/views/dynamic_fieldsets/fieldsets/children.html.erb
dynamic_fieldsets-0.0.4 app/views/dynamic_fieldsets/fieldsets/children.html.erb