Sha256: 500cf81a75800dcea13e138630149dd8a958efbc0c5da46638dfd75237ada64b

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

/*
 * BestInPlace 3.0.0.alpha (2014)
 *
 * Depends:
 *	best_in_place.js
 *	jquery.ui.datepicker.js
 */
/*global BestInPlaceEditor */
BestInPlaceEditor.forms.date = {
    activateForm: function () {
        'use strict';
        var that = this,
            output = jQuery(document.createElement('form'))
                .addClass('form_in_place')
                .attr('action', 'javascript:void(0);')
                .attr('style', 'display:inline'),
            input_elt = jQuery(document.createElement('input'))
                .attr('type', 'text')
                .attr('name', this.attributeName)
                .attr('value', this.sanitizeValue(this.display_value));
                
        if (this.inner_class !== null) {
            input_elt.addClass(this.inner_class);
        }
        output.append(input_elt);

        this.element.html(output);
        this.setHtmlAttributes();
        this.element.find('input')[0].select();
        this.element.find("form").bind('submit', {editor: this}, BestInPlaceEditor.forms.input.submitHandler);
        this.element.find("input").bind('keyup', {editor: this}, BestInPlaceEditor.forms.input.keyupHandler);

        this.element.find('input')
            .datepicker({
                onClose: function () {
                    that.update();
                }
            })
            .datepicker('show');
    },

    getValue: function () {
        'use strict';
        return this.sanitizeValue(this.element.find("input").val());
    },

    submitHandler: function (event) {
        'use strict';
        event.data.editor.update();
    },

    keyupHandler: function (event) {
        'use strict';
        if (event.keyCode === 27) {
            event.data.editor.abort();
        }
    }
}

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
best_in_place-4.0.0 lib/assets/javascripts/best_in_place.jquery-ui.js
best_in_place-3.1.1 lib/assets/javascripts/best_in_place.jquery-ui.js
best_in_place-3.1.0 lib/assets/javascripts/best_in_place.jquery-ui.js
in_place_edit_with_datepicker-1.0.0 lib/assets/javascripts/best_in_place.jquery-ui.js
in_place_edit_with_datepicker-0.0.2 lib/assets/javascripts/best_in_place.jquery-ui.js
in_place_edit_with_datepicker-0.0.1 lib/assets/javascripts/best_in_place.jquery-ui.js
best_in_place-3.0.3 lib/assets/javascripts/best_in_place.jquery-ui.js
best_in_place-3.0.2 lib/assets/javascripts/best_in_place.jquery-ui.js