{I" class:ETI"ProcessedAsset;FI"logical_path;TI")nested_sortable/inline_operations.js;FI" pathname;TI"{/home/nyitrai/RubymineProjects/jquery_sortable_tree/app/assets/javascripts/nested_sortable/inline_operations.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+ÄÕSI" length;Ti I" digest;TI"%e7387bf6fb280418d7037ceebda4300e;FI" source;TI" (function() { $(function() { this.edit_node = function(event) { var edit_box, edit_done, edit_link, h4, sortable_tree, text, url; event.preventDefault(); sortable_tree = $(this).parents('ol.sortable_tree'); edit_link = $(this); h4 = $(this).parent(); $(this).hide(); url = $(this).attr('href'); text = $(this).text(); edit_box = $(""); edit_box.appendTo(h4.parent()); edit_box.focus(); edit_done = function() { var attributes, data, hide_input_box, title_field; hide_input_box = function() { edit_link.show(); return edit_box.remove(); }; if (edit_box.val().trim().length > 0) { data = {}; attributes = {}; title_field = 'title'; if (sortable_tree.data('title')) { title_field = sortable_tree.data('title'); } attributes[title_field] = edit_box.val(); data[sortable_tree.data('model')] = attributes; return $.ajax({ type: 'PUT', data: data, url: edit_link.attr('href'), success: function() { edit_link.text(edit_box.val()); return hide_input_box(); }, error: hide_input_box }); } else { return hide_input_box(); } }; edit_box.on('keypress', function(event) { if (event.which === 13) { return $(this).trigger('focusout'); } }); return edit_box.on('focusout', edit_done); }; $('ol.sortable_tree').siblings('form').on('ajax:success', function(event, data, status, xhr) { var list_item, sortable_tree; sortable_tree = $(this).siblings('ol.sortable_tree'); $(this).find('input[type=text]').val(''); list_item = $(this).siblings('ol.fake-node').find('li.node').clone(); list_item.find('h4 > a').text(data.name); list_item.find('a.delete, a.edit').attr('href', function(index, attr) { return attr.replace(':id', data.id); }); list_item.data('node-id', data.id); list_item.attr('data-node-id', data.id); return list_item.appendTo(sortable_tree); }); $('ol.sortable_tree').on('ajax:success', '.controls a.delete', function() { return $(this).parent().parent().remove(); }); return $('ol.sortable_tree').on('click', 'h4 > a.edit', this.edit_node); }); }).call(this); ;TI"dependency_digest;TI"%9413ff94b03be7e9ae819d32826de7b7;FI"required_paths;T[I"{/home/nyitrai/RubymineProjects/jquery_sortable_tree/app/assets/javascripts/nested_sortable/inline_operations.js.coffee;FI"dependency_paths;T[{I" path;TI"{/home/nyitrai/RubymineProjects/jquery_sortable_tree/app/assets/javascripts/nested_sortable/inline_operations.js.coffee;FI" mtime;TI"2014-07-27T15:51:00+02:00;TI" digest;TI"%afd1c5d5444c118c685ed97bfaeb7544;FI" _version;TI"%3e3098c8a5e9a7f3b984ba95ac600637;F