app/views/spina/admin/photos/insert_photo_collection.js.erb in spina-0.9.0 vs app/views/spina/admin/photos/insert_photo_collection.js.erb in spina-0.10.0
- old
+ new
@@ -1,14 +1,17 @@
-var hidden_input = $("input[name='<%= j params[:page_part_id] %>[photo_tokens]']");
+var photo_token_inputs = [
+ "input[name='<%= j params[:page_part_id] %>[photo_collection_attributes][photo_tokens]']",
+ "input[name='<%= j params[:page_part_id] %>[photo_tokens]']"
+]
+var hidden_input = $(photo_token_inputs.join(", "))
<% if @photos.present? %>
var photo_collection = $("<%= j render partial: 'photo_collection', locals: {photos: @photos} %>");
hidden_input.parents('.horizontal-form-content').find('.photo-collection').html(photo_collection);
- hidden_input.parents('.horizontal-form-content').find('a .placeholder').addClass('pull-right');
hidden_input.val("<%= @photos.map(&:id).join(',') %>");
<% else %>
- hidden_input.parents('.horizontal-form-content').find('a .placeholder').removeClass('pull-right');
hidden_input.val("");
+ hidden_input.parents('.horizontal-form-content').find('.photo-collection').empty()
<% end %>
$('.sortable-grid').sortable().bind('sortupdate', function(e) {
position_array = [];
$(e.target).find('li.image').each(function(index) {