mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-06 21:24:23 +08:00
refactor
This commit is contained in:
parent
f0a8275559
commit
015026926d
4 changed files with 6 additions and 12 deletions
|
@ -1,5 +1,5 @@
|
||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import PropTypes, { bool, number, string, func } from "prop-types";
|
import { bool, number, string, func, shape } from "prop-types";
|
||||||
import { Modal, Button, Alert, Glyphicon } from "react-bootstrap";
|
import { Modal, Button, Alert, Glyphicon } from "react-bootstrap";
|
||||||
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
|
import { FormattedMessage, FormattedHTMLMessage } from "react-intl";
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ class RemoveUserModal extends Component {
|
||||||
RemoveUserModal.propTypes = {
|
RemoveUserModal.propTypes = {
|
||||||
showModal: bool.isRequired,
|
showModal: bool.isRequired,
|
||||||
hideModal: func.isRequired,
|
hideModal: func.isRequired,
|
||||||
userToRemove: PropTypes.shape({
|
userToRemove: shape({
|
||||||
userName: string.isRequired,
|
userName: string.isRequired,
|
||||||
team_user_id: number.isRequired,
|
team_user_id: number.isRequired,
|
||||||
teamName: string.isRequired,
|
teamName: string.isRequired,
|
||||||
|
|
|
@ -37,10 +37,7 @@ class UpdateTeamDescriptionModal extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getValidationState() {
|
getValidationState() {
|
||||||
if (this.state.errorMessage.length > 0) {
|
return this.state.errorMessage.length > 0 ? "error" : null;
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDescription(el) {
|
handleDescription(el) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ const StyledHelpBlock = styled(HelpBlock)`
|
||||||
class UpdateTeamNameModal extends Component {
|
class UpdateTeamNameModal extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { errorMessage: "", name: props.team.name};
|
this.state = { errorMessage: "", name: props.team.name };
|
||||||
this.onCloseModal = this.onCloseModal.bind(this);
|
this.onCloseModal = this.onCloseModal.bind(this);
|
||||||
this.updateName = this.updateName.bind(this);
|
this.updateName = this.updateName.bind(this);
|
||||||
this.handleName = this.handleName.bind(this);
|
this.handleName = this.handleName.bind(this);
|
||||||
|
@ -37,10 +37,7 @@ class UpdateTeamNameModal extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
getValidationState() {
|
getValidationState() {
|
||||||
if (this.state.errorMessage.length > 0) {
|
return this.state.errorMessage.length > 0 ? "error" : null;
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleName(el) {
|
handleName(el) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ describe ClientApi::Teams::TeamsController, type: :controller do
|
||||||
|
|
||||||
before do
|
before do
|
||||||
@user_one = User.first
|
@user_one = User.first
|
||||||
@user_two = FactoryGirl.create(:user, email: 'sec_user@asdf.com')
|
@user_two = FactoryGirl.create :user, email: 'sec_user@asdf.com'
|
||||||
@team_one = FactoryGirl.create :team
|
@team_one = FactoryGirl.create :team
|
||||||
@team_two = FactoryGirl.create :team, name: 'Team two'
|
@team_two = FactoryGirl.create :team, name: 'Team two'
|
||||||
FactoryGirl.create :user_team, team: @team_one, user: @user_one, role: 2
|
FactoryGirl.create :user_team, team: @team_one, user: @user_one, role: 2
|
||||||
|
|
Loading…
Add table
Reference in a new issue