Sha256: 142a888384c1f7bebc049b713c6f567e28fa527fcb961c5f24525382916da016
Contents?: true
Size: 1.95 KB
Versions: 22
Compression:
Stored size: 1.95 KB
Contents
jQuery(function($) { $('.admin_entries').each(function() { if ($('#folders_sidebar_section .editable').length) { $('#index_table_entries tr').draggable({ helper: function() { var title = $('.title a', this).text(); return $('<div class="dragged_entry" />').text(title); }, cursorAt: { left: 5, top: 5 }, distance: 3, appendTo: '#wrapper' }); $('#folders_sidebar_section ul.folders > li').droppable({ tolerance: 'pointer', hoverClass: 'drop_over', accept: function(draggable) { var entryAccountId = $(draggable).find('.account a').data('id'); var folderAccountId = $(this).parents('.accounts > li').data('id'); return !entryAccountId || entryAccountId == folderAccountId || isAllFolder(this); }, activate: function() { $(this).addClass('drop_target'); }, deactivate: function() { $(this).removeClass('drop_target drop_over'); }, drop: function(event, ui) { var folderId = $(this).data('id'); var entryId = $(ui.draggable).attr('id').replace('entry_', ''); $.ajax({ url: '/admin/entries/' + entryId, method: 'put', dataType: 'json', data: { entry: { folder_id: folderId || '' } } }).done(function() { location.reload(); }); } }); $('#folders_sidebar_section') .append('<a href="#" class="edit_toggle edit" title="Bearbeiten"></a>') .append('<a href="#" class="edit_toggle done" title="Fertig"></a>'); $('#folders_sidebar_section .edit_toggle').on('click', function() { $('#folders_sidebar_section').toggleClass('editable'); }); } function isAllFolder(folder) { return $(folder).data('role') === 'all'; } }); });
Version data entries
22 entries across 22 versions & 1 rubygems
Version | Path |
---|---|
pageflow-0.0.2 | app/assets/javascripts/pageflow/admin/entries.js |
pageflow-0.0.1 | app/assets/javascripts/pageflow/admin/entries.js |