Sha256: 6b9aede64b683a84b635254d5e4afd02aeda0ce9600c37de2240e377f5301e22

Contents?: true

Size: 1.59 KB

Versions: 32

Compression:

Stored size: 1.59 KB

Contents

var InteractiveLabel = React.createClass({
    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 (
            <form onSubmit={this.onSubmit}>
                {this.props.id != undefined ?
                    <input
                        id={this.props.id}
                        className="pointer"
                        value={this.state.value}
                        onKeyPress={this.props.onKeyPress}
                        onChange={this.handleChange}
                        onBlur={this.onBlur}/>
                    :
                    <input
                        className="pointer"
                        value={this.state.value}
                        onKeyPress={this.props.onKeyPress}
                        onChange={this.handleChange}
                        onBlur={this.onBlur}/>
                }
            </form>
        )
    }
});

Version data entries

32 entries across 32 versions & 1 rubygems

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