Replaced broken remaining calls to getDOMNode with React.findDOMNode

Этот коммит содержится в:
hmhealey
2015-09-02 15:56:13 -04:00
родитель c7cafb6ac7
Коммит a020391d93
11 изменённых файлов: 33 добавлений и 33 удалений

Просмотреть файл

@@ -15,7 +15,7 @@ export default class CommandList extends React.Component {
componentDidMount() {
var self = this;
if (this.refs.modal) {
$(this.refs.modal.getDOMNode()).on('show.bs.modal', function show(e) {
$(React.findDOMNode(this.refs.modal).on('show.bs.modal', function show(e) {
var button = e.relatedTarget;
self.setState({channel_id: $(button).attr('data-channelid')});
});

Просмотреть файл

@@ -19,7 +19,7 @@ export default class FileUpload extends React.Component {
}
handleChange() {
var element = $(this.refs.fileInput.getDOMNode());
var element = $(React.findDOMNode(this.refs.fileInput));
var files = element.prop('files');
var channelId = this.props.channelId || ChannelStore.getCurrentId();
@@ -149,7 +149,7 @@ export default class FileUpload extends React.Component {
}
componentDidMount() {
var inputDiv = this.refs.input.getDOMNode();
var inputDiv = React.findDOMNode(this.refs.input);
var self = this;
if (this.props.postType === 'post') {

Просмотреть файл

@@ -17,7 +17,7 @@ export default class FindTeam extends React.Component {
var state = { };
var email = this.refs.email.getDOMNode().value.trim().toLowerCase();
var email = React.findDOMNode(this.refs.email).value.trim().toLowerCase();
if (!email || !utils.isEmail(email)) {
state.email_error = 'Please enter a valid email address';
this.setState(state);

Просмотреть файл

@@ -37,7 +37,7 @@ export default class InviteMemberModal extends React.Component {
var notEmpty = false;
for (var i = 0; i < self.state.inviteIds.length; i++) {
var index = self.state.inviteIds[i];
if (self.refs['email' + index].getDOMNode().value.trim() !== '') {
if (React.findDOMNode(self.refs['email' + index]).value.trim() !== '') {
notEmpty = true;
break;
}
@@ -70,7 +70,7 @@ export default class InviteMemberModal extends React.Component {
for (var i = 0; i < count; i++) {
var index = inviteIds[i];
var invite = {};
invite.email = this.refs['email' + index].getDOMNode().value.trim();
invite.email = React.findDOMNode(this.refs['email' + index]).value.trim();
if (!invite.email || !utils.isEmail(invite.email)) {
emailErrors[index] = 'Please enter a valid email address';
valid = false;
@@ -79,7 +79,7 @@ export default class InviteMemberModal extends React.Component {
}
if (config.AllowInviteNames) {
invite.firstName = this.refs['first_name' + index].getDOMNode().value.trim();
invite.firstName = React.findDOMNode(this.refs['first_name' + index]).value.trim();
if (!invite.firstName && config.RequireInviteNames) {
firstNameErrors[index] = 'This is a required field';
valid = false;
@@ -87,7 +87,7 @@ export default class InviteMemberModal extends React.Component {
firstNameErrors[index] = '';
}
invite.lastName = this.refs['last_name' + index].getDOMNode().value.trim();
invite.lastName = React.findDOMNode(this.refs['last_name' + index]).value.trim();
if (!invite.lastName && config.RequireInviteNames) {
lastNameErrors[index] = 'This is a required field';
valid = false;
@@ -110,8 +110,8 @@ export default class InviteMemberModal extends React.Component {
Client.inviteMembers(data,
function success() {
$(this.refs.modal.getDOMNode()).attr('data-confirm', 'true');
$(this.refs.modal.getDOMNode()).modal('hide');
$(React.findDOMNode(this.refs.modal)).attr('data-confirm', 'true');
$(React.findDOMNode(this.refs.modal)).modal('hide');
}.bind(this),
function fail(err) {
if (err.message === 'This person is already on your team') {
@@ -125,8 +125,8 @@ export default class InviteMemberModal extends React.Component {
}
componentDidUpdate() {
$(this.refs.modalBody.getDOMNode()).css('max-height', $(window).height() - 200);
$(this.refs.modalBody.getDOMNode()).css('overflow-y', 'scroll');
$(React.findDOMNode(this.refs.modalBody)).css('max-height', $(window).height() - 200);
$(React.findDOMNode(this.refs.modalBody)).css('overflow-y', 'scroll');
}
addInviteFields() {
@@ -141,10 +141,10 @@ export default class InviteMemberModal extends React.Component {
for (var i = 0; i < inviteIds.length; i++) {
var index = inviteIds[i];
this.refs['email' + index].getDOMNode().value = '';
React.findDOMNode(this.refs['email' + index]).value = '';
if (config.AllowInviteNames) {
this.refs['first_name' + index].getDOMNode().value = '';
this.refs['last_name' + index].getDOMNode().value = '';
React.findDOMNode(this.refs['first_name' + index]).value = '';
React.findDOMNode(this.refs['last_name' + index]).value = '';
}
}

Просмотреть файл

@@ -29,12 +29,12 @@ export default class MoreChannels extends React.Component {
}
componentDidMount() {
ChannelStore.addMoreChangeListener(this.onListenerChange);
$(this.refs.modal.getDOMNode()).on('shown.bs.modal', function shown() {
$(React.findDOMNode(this.refs.modal)).on('shown.bs.modal', function shown() {
asyncClient.getMoreChannels(true);
});
var self = this;
$(this.refs.modal.getDOMNode()).on('show.bs.modal', function show(e) {
$(React.findDOMNode(this.refs.modal)).on('show.bs.modal', function show(e) {
var button = e.relatedTarget;
self.setState({channelType: $(button).attr('data-channeltype')});
});
@@ -52,7 +52,7 @@ export default class MoreChannels extends React.Component {
this.setState({joiningChannel: channelIndex});
client.joinChannel(channel.id,
function joinSuccess() {
$(this.refs.modal.getDOMNode()).modal('hide');
$(React.findDOMNode(this.refs.modal)).modal('hide');
asyncClient.getChannel(channel.id);
utils.switchChannel(channel);
this.setState({joiningChannel: -1});
@@ -65,7 +65,7 @@ export default class MoreChannels extends React.Component {
);
}
handleNewChannel() {
$(this.refs.modal.getDOMNode()).modal('hide');
$(React.findDOMNode(this.refs.modal)).modal('hide');
}
render() {
var serverError;

Просмотреть файл

@@ -16,7 +16,7 @@ export default class MoreDirectChannels extends React.Component {
componentDidMount() {
var self = this;
$(this.refs.modal.getDOMNode()).on('show.bs.modal', function showModal(e) {
$(React.findDOMNode(this.refs.modal)).on('show.bs.modal', function showModal(e) {
var button = e.relatedTarget;
self.setState({channels: $(button).data('channels')});
});
@@ -44,7 +44,7 @@ export default class MoreDirectChannels extends React.Component {
handleClick = function clickHandler(e) {
e.preventDefault();
utils.switchChannel(channel, channel.teammate_username);
$(self.refs.modal.getDOMNode()).modal('hide');
$(React.findDOMNode(self.refs.modal)).modal('hide');
};
} else {
// It's a direct message channel that doesn't exist yet so let's create it now
@@ -66,7 +66,7 @@ export default class MoreDirectChannels extends React.Component {
Client.createDirectChannel(channel, otherUserId,
function success(data) {
$(self.refs.modal.getDOMNode()).modal('hide');
$(React.findDOMNode(self.refs.modal)).modal('hide');
self.setState({loadingDMChannel: -1});
AsyncClient.getChannel(data.id);
utils.switchChannel(data);

Просмотреть файл

@@ -577,14 +577,14 @@ export default class PostList extends React.Component {
var order = this.state.postList.order;
var channelId = this.state.channel.id;
$(this.refs.loadmore.getDOMNode()).text('Retrieving more messages...');
$(React.findDOMNode(this.refs.loadmore)).text('Retrieving more messages...');
Client.getPostsPage(
channelId,
order.length,
Constants.POST_CHUNK_SIZE,
function success(data) {
$(this.refs.loadmore.getDOMNode()).text('Load more messages');
$(React.findDOMNode(this.refs.loadmore)).text('Load more messages');
this.gotMorePosts = true;
this.setState({numToDisplay: this.state.numToDisplay + Constants.POST_CHUNK_SIZE});
@@ -609,7 +609,7 @@ export default class PostList extends React.Component {
Client.getProfiles();
}.bind(this),
function fail(err) {
$(this.refs.loadmore.getDOMNode()).text('Load more messages');
$(React.findDOMNode(this.refs.loadmore)).text('Load more messages');
AsyncClient.dispatchError(err, 'getPosts');
}.bind(this)
);
@@ -667,4 +667,4 @@ export default class PostList extends React.Component {
</div>
);
}
}
}

Просмотреть файл

@@ -12,7 +12,7 @@ export default class SettingPicture extends React.Component {
if (file) {
var reader = new FileReader();
var img = this.refs.image.getDOMNode();
var img = React.findDOMNode(this.refs.image);
reader.onload = function load(e) {
$(img).attr('src', e.target.result);
};
@@ -128,4 +128,4 @@ SettingPicture.propTypes = {
submit: React.PropTypes.func,
title: React.PropTypes.string,
pictureChange: React.PropTypes.func
};
};

Просмотреть файл

@@ -33,7 +33,7 @@ export default class SettingsUpload extends React.Component {
doSubmit(e) {
e.preventDefault();
var inputnode = this.refs.uploadinput.getDOMNode();
var inputnode = React.findDOMNode(this.refs.uploadinput);
if (inputnode.files && inputnode.files[0]) {
this.props.submit(inputnode.files[0]);
} else {
@@ -98,4 +98,4 @@ SettingsUpload.propTypes = {
clientError: React.PropTypes.string,
serverError: React.PropTypes.string,
helpText: React.PropTypes.object
};
};

Просмотреть файл

@@ -44,11 +44,11 @@ export default class TeamMembers extends React.Component {
UserStore.addChangeListener(this.onChange);
var self = this;
$(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function show() {
$(React.findDOMNode(this.refs.modal)).on('hidden.bs.modal', function show() {
self.setState({render_members: false});
});
$(this.refs.modal.getDOMNode()).on('show.bs.modal', function hide() {
$(React.findDOMNOde(this.refs.modal)).on('show.bs.modal', function hide() {
self.setState({render_members: true});
});
}

Просмотреть файл

@@ -52,7 +52,7 @@ export default class SSOSignUpPage extends React.Component {
);
}
nameChange() {
this.setState({name: this.refs.teamname.getDOMNode().value.trim()});
this.setState({name: React.findDOMNode(this.refs.teamname).value.trim()});
}
render() {
var nameError = null;