Sha256: 532bbc8f94ceb33ce55d0f656c1ee9e5e2b0793ba4e2c30e24391c39aff21149

Contents?: true

Size: 937 Bytes

Versions: 19

Compression:

Stored size: 937 Bytes

Contents

var hidden_input = $("input[name='<%= j params[:page_part_id] %>[photo_tokens]']");

<% if @photos.present? %>
  var photo_collection = $("<%= j render partial: 'photo_collection', locals: {photos: @photos} %>");
  hidden_input.parents('td').find('.photo-collection').html(photo_collection);
  hidden_input.parents('td').find('a .placeholder').addClass('pull-right');
  hidden_input.val("<%= @photos.map(&:id).join(',') %>");
<% else %>
  hidden_input.parents('td').find('a .placeholder').removeClass('pull-right');
  hidden_input.val("");
<% end %>

$('.sortable-grid').sortable('destroy');
$('.sortable-grid').sortable().bind('sortupdate', function(e) {
  position_array = [];
  $(e.target).find('li.image').each(function(index) {
    position_array.push($(this).data('photo-id'));
  });
  $(e.target).parents('td').find('.photo-positions').val(position_array.join(","));
});
$('.sortable-grid').trigger('sortupdate');

$.hideModal();

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
spina-0.6.29 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.28 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.27 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.26 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.25 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.24 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.23 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.22 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.21 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.20 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.19 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.18 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.17 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.16 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.15 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.14 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.13 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.12 app/views/spina/admin/photos/insert_photo_collection.js.erb
spina-0.6.11 app/views/spina/admin/photos/insert_photo_collection.js.erb