Merge pull request #374 from strapi/improve-user-edit-section

Improve UX when editing a role
This commit is contained in:
Jim LAURIE 2017-12-13 15:15:10 +01:00 committed by GitHub
commit 8cc616f6b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,14 @@ import styles from './styles.scss';
class Plugin extends React.Component { // eslint-disable-line react/prefer-stateless-function
state = { collapse: false };
componentDidMount() {
// Open the application's permissions section if there are APIs
if (this.props.name === 'application' && !isEmpty(get(this.props.plugin, 'controllers'))) {
this.props.changePluginSelected('application');
this.setState({ collapse: !this.state.collapse });
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.pluginSelected !== this.props.pluginSelected && nextProps.pluginSelected !== this.props.name) {
this.context.resetShouldDisplayPoliciesHint();