Sha256: 4c37dcf1d79bdc914d8676029ef4cc7357e6daa3140d27b634bd170ece7ed3bc
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
let hidden_input = $("input[data-hidden-field-id='<%= j params[:hidden_field_id] %>']"); hidden_input.parents('.media_picker').find('.image').remove(); hidden_input.val(""); <% if @image.present? %> hidden_input.parents('.media_picker').append("<%=j render partial: 'spina/admin/images/image', object: @image, locals: {simple: true} %>"); hidden_input.val("<%= @image.id %>"); // Trix editor $('#<%= params[:trix_editor_id] %>').trigger('image-insert', '<%= main_app.url_for(@image.variant(resize: "800x800")) %>'); $.hideModal(); <% end %> <% if @images.present? %> let image_collection = $("<%= j render partial: 'spina/admin/image_collections/image_collection', locals: {images: @images} %>"); hidden_input.parents('.horizontal-form-content').find('.image-collection').html(image_collection); hidden_input.val("<%= @images.map(&:id).join(',') %>"); <% end %> $('.sortable-grid').sortable().bind('sortupdate', function(e) { position_array = []; $(e.target).find('li.image').each(function(index) { position_array.push($(this).data('image-id')); }); $(e.target).parents('.horizontal-form-content').find('.images-positions').val(position_array.join(",")); }); $('.sortable-grid').trigger('sortupdate'); $.hideModal();
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spina-1.0.3 | app/views/spina/admin/media_picker/select.js.erb |
spina-1.0.2 | app/views/spina/admin/media_picker/select.js.erb |
spina-1.0.1 | app/views/spina/admin/media_picker/select.js.erb |