// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. module.exports = React.createClass({ setPicture: function(file) { if (file) { var reader = new FileReader(); var img = this.refs.image.getDOMNode(); reader.onload = function(e) { $(img).attr('src', e.target.result); }; reader.readAsDataURL(file); } }, componentWillReceiveProps: function(nextProps) { if (nextProps.picture) { this.setPicture(nextProps.picture); } }, render: function() { var clientError = null; if (this.props.client_error) { clientError =
; } var serverError = null; if (this.props.server_error) { serverError = ; } var img = null; if (this.props.picture) { img = (); } else { img = (); } var confirmButton; if (this.props.loadingPicture) { confirmButton = ; } else { var confirmButtonClass = 'btn btn-sm'; if (this.props.submitActive) { confirmButtonClass += ' btn-primary'; } else { confirmButtonClass += ' btn-inactive disabled'; } confirmButton = Save; } var helpText = 'Upload a profile picture in either JPG or PNG format, at least ' + config.ProfileWidth + 'px in width and ' + config.ProfileHeight + 'px height.' var self = this; return (