Sha256: d45b2dc88b4a51c97c6e3a586ff33dba01cd93294b58d15c0eec407376e091ff
Contents?: true
Size: 1.61 KB
Versions: 22
Compression:
Stored size: 1.61 KB
Contents
/* click_editor */ (function($) { var methods = { init: function(annotations) { this.removeClass('hidden').click(methods.click); this.next('.in-place-form').hide().on('blur', ':input', methods.blur).on('change', methods.change); }, click: function(event) { var that=$(this); var annotations=that.data('rapid')['click-editor']; that.hjq('hide', annotations.hide, function() { that.next('.in-place-form').hjq('show', annotations.show, function() { $(this).find('textarea,input[type=text]').focus(); }); }); }, blur: function(event) { var $formlet = $(this).closest('.in-place-form'); var $span = $formlet.siblings('.in-place-edit') var annotations = $span.data('rapid')['click-editor']; $formlet.hjq('hide', annotations.hide); $span.hjq('show', annotations.show); }, change: function(event) { var formlet = $(this).closest('.in-place-form'); formlet.prev('.in-place-edit').text('saving...'); formlet.hjq_formlet('submit'); } }; $.fn.hjq_click_editor = function( method ) { if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on hjq_click_editor' ); } }; })( jQuery );
Version data entries
22 entries across 22 versions & 1 rubygems