Sha256: f2625e2a4fcdb6f5cd70a4eda63825d264c57976b478c9e8af6c593ec97013d2

Contents?: true

Size: 1.7 KB

Versions: 32

Compression:

Stored size: 1.7 KB

Contents

var InteractiveLabel = React.createClass({displayName: "InteractiveLabel",
    getInitialState: function () {
        return {
            value: this.props.labelValue
        };
    },
    componentWillReceiveProps: function(nextProps) {
        this.setState({
            value: nextProps.labelValue
        });
    },
    onBlur: function(event) {
        this.onSubmit();

        return false;
    },
    onSubmit: function(event) {
        if(this.props.id != undefined) {
            $("#"+this.props.id).attr("v", this.state.value);
        }
        this.props.onValueChange(this.props.labelName, this.props.labelKey, this.state.value);

        if(event != undefined) {
            event.preventDefault();
        }

        return false;
    },
    handleChange: function(event) {
        this.setState({value: event.target.value});
    },
    render: function() {
        return (
            React.createElement("form", {onSubmit: this.onSubmit}, 
                this.props.id != undefined ?
                    React.createElement("input", {
                        id: this.props.id, 
                        className: "pointer", 
                        value: this.state.value, 
                        onKeyPress: this.props.onKeyPress, 
                        onChange: this.handleChange, 
                        onBlur: this.onBlur})
                    :
                    React.createElement("input", {
                        className: "pointer", 
                        value: this.state.value, 
                        onKeyPress: this.props.onKeyPress, 
                        onChange: this.handleChange, 
                        onBlur: this.onBlur})
                
            )
        )
    }
});

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
nutella_framework-0.7.3 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.7.2 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.7.1 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.7.0 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.21 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.20 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.19 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.18 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.17 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.16 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.15 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.13 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.12 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.11 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.10 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.9 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.8 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.7 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.6 framework_components/room-places-interface/js/react/dist/interactive-label.js
nutella_framework-0.6.5 framework_components/room-places-interface/js/react/dist/interactive-label.js