Sha256: 72ffd18ea84044ce9166703bbcc076b2ece84cadd944a5883ba5848e46950662

Contents?: true

Size: 1.48 KB

Versions: 11

Compression:

Stored size: 1.48 KB

Contents

/* click_editor */
(function($) {
    var methods = {
        init: function(annotations) {
            this.removeClass('hidden').click(methods.click);
            this.next('.in-place-form').hide().on('blur', 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');
            formlet.addClass('hidden');
            formlet.prev('.in-place-edit').removeClass('hidden');
        },

        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

11 entries across 11 versions & 1 rubygems

Version Path
hobo_jquery-2.0.0.pre4 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-2.0.0.pre3 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-2.0.0.pre2 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-2.0.0.pre1 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre8 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre7 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre6 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre5 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre4 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre3 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js
hobo_jquery-1.4.0.pre2 vendor/assets/javascripts/hobo-jquery/hjq-click-editor.js