mirror of
https://github.com/strapi/strapi.git
synced 2025-08-31 12:23:05 +00:00
Fixes #3472
This commit is contained in:
parent
2537401ed9
commit
37ed213b6d
6
.gitignore
vendored
6
.gitignore
vendored
@ -125,3 +125,9 @@ packages/strapi-generate-new/files/public/
|
|||||||
############################
|
############################
|
||||||
|
|
||||||
# *.cache
|
# *.cache
|
||||||
|
|
||||||
|
############################
|
||||||
|
# Visual Studio Code
|
||||||
|
############################
|
||||||
|
|
||||||
|
front-workspace.code-workspace
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
"strapi-middleware-views": "3.0.0-beta.5",
|
"strapi-middleware-views": "3.0.0-beta.5",
|
||||||
"strapi-plugin-content-manager": "3.0.0-beta.5",
|
"strapi-plugin-content-manager": "3.0.0-beta.5",
|
||||||
"strapi-plugin-content-type-builder": "3.0.0-beta.5",
|
"strapi-plugin-content-type-builder": "3.0.0-beta.5",
|
||||||
"strapi-plugin-documentation": "3.0.0-beta.5",
|
|
||||||
"strapi-plugin-email": "3.0.0-beta.5",
|
"strapi-plugin-email": "3.0.0-beta.5",
|
||||||
"strapi-plugin-graphql": "3.0.0-beta.5",
|
"strapi-plugin-graphql": "3.0.0-beta.5",
|
||||||
"strapi-plugin-settings-manager": "3.0.0-beta.5",
|
"strapi-plugin-settings-manager": "3.0.0-beta.5",
|
||||||
|
@ -201,9 +201,7 @@ module.exports = {
|
|||||||
`environments.${env}.request.router.prefix`,
|
`environments.${env}.request.router.prefix`,
|
||||||
null
|
null
|
||||||
),
|
),
|
||||||
validations: {
|
validations: {},
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -1,64 +1,95 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Controller
|
* Controller
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { get, map, some } from 'lodash';
|
import { get, map, some } from 'lodash';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
import pluginId from '../../pluginId';
|
||||||
|
|
||||||
import InputCheckbox from '../InputCheckboxPlugin';
|
import InputCheckbox from '../InputCheckboxPlugin';
|
||||||
import styles from './styles.scss';
|
import styles from './styles.scss';
|
||||||
|
|
||||||
class Controller extends React.Component {
|
class Controller extends React.Component {
|
||||||
state = { inputSelected: '', checked: false };
|
state = { inputSelected: '' };
|
||||||
|
|
||||||
setNewInputSelected = (name) => {
|
setNewInputSelected = name => {
|
||||||
this.setState({ inputSelected: name, checked: false });
|
this.setState({ inputSelected: name });
|
||||||
}
|
};
|
||||||
|
|
||||||
handleChange = () => {
|
handleChange = () => {
|
||||||
this.setState({ checked: !this.state.checked });
|
this.context.selectAllActions(
|
||||||
this.context.selectAllActions(`${this.props.inputNamePath}.controllers.${this.props.name}`, !this.isAllActionsSelected());
|
`${this.props.inputNamePath}.controllers.${this.props.name}`,
|
||||||
}
|
!this.areAllActionsSelected()
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
isAllActionsSelected = () => !some(this.props.actions, ['enabled', false]);
|
hasSomeActionsSelected = () => {
|
||||||
|
const { actions } = this.props;
|
||||||
|
|
||||||
|
return Object.keys(actions).some(
|
||||||
|
action => actions[action].enabled === true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
areAllActionsSelected = () => {
|
||||||
|
const { actions } = this.props;
|
||||||
|
|
||||||
|
return Object.keys(actions).every(
|
||||||
|
action => actions[action].enabled === true
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const labelId = this.areAllActionsSelected() ? 'unselectAll' : 'selectAll';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.controller}>
|
<div className={styles.controller}>
|
||||||
<div className={styles.controllerHeader}>
|
<div className={styles.controllerHeader}>
|
||||||
<div>{this.props.name}</div>
|
<div>{this.props.name}</div>
|
||||||
<div className={styles.separator}></div>
|
<div className={styles.separator} />
|
||||||
<div>
|
<div>
|
||||||
<div className={cn(styles.inputCheckbox)}>
|
<div className={cn(styles.inputCheckbox)}>
|
||||||
<div className="form-check">
|
<div className="form-check">
|
||||||
<label className={cn('form-check-label', styles.label, this.state.checked ? styles.checked : '')} htmlFor={this.props.name}>
|
<label
|
||||||
|
className={cn(
|
||||||
|
'form-check-label',
|
||||||
|
styles.label,
|
||||||
|
this.areAllActionsSelected() && styles.checked,
|
||||||
|
!this.areAllActionsSelected() &&
|
||||||
|
this.hasSomeActionsSelected() &&
|
||||||
|
styles.someChecked
|
||||||
|
)}
|
||||||
|
htmlFor={this.props.name}
|
||||||
|
>
|
||||||
<input
|
<input
|
||||||
className="form-check-input"
|
className="form-check-input"
|
||||||
checked={this.state.checked}
|
checked={this.areAllActionsSelected()}
|
||||||
id={this.props.name}
|
id={this.props.name}
|
||||||
name={this.props.name}
|
name={this.props.name}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
/>
|
/>
|
||||||
<FormattedMessage id="users-permissions.Controller.selectAll" />
|
<FormattedMessage id={`${pluginId}.Controller.${labelId}`} />
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{map(Object.keys(this.props.actions).sort(), (actionKey) => (
|
{map(Object.keys(this.props.actions).sort(), actionKey => (
|
||||||
<InputCheckbox
|
<InputCheckbox
|
||||||
inputSelected={this.state.inputSelected}
|
inputSelected={this.state.inputSelected}
|
||||||
isOpen={this.props.isOpen}
|
isOpen={this.props.isOpen}
|
||||||
key={actionKey}
|
key={actionKey}
|
||||||
label={actionKey}
|
label={actionKey}
|
||||||
name={`${this.props.inputNamePath}.controllers.${this.props.name}.${actionKey}.enabled`}
|
name={`${this.props.inputNamePath}.controllers.${
|
||||||
|
this.props.name
|
||||||
|
}.${actionKey}.enabled`}
|
||||||
setNewInputSelected={this.setNewInputSelected}
|
setNewInputSelected={this.setNewInputSelected}
|
||||||
value={get(this.props.actions[actionKey], 'enabled')}
|
value={get(this.props.actions[actionKey], 'enabled')}
|
||||||
/>
|
/>
|
||||||
|
@ -11,6 +11,17 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.someChecked {
|
||||||
|
&:after {
|
||||||
|
content: '\f068';
|
||||||
|
position: absolute;
|
||||||
|
top: 0px; left: 3px;
|
||||||
|
font-size: 10px;
|
||||||
|
font-family: 'FontAwesome';
|
||||||
|
font-weight: 100;
|
||||||
|
color: #1C5DE7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.controller {
|
.controller {
|
||||||
padding: 1px 43px 0 28px;
|
padding: 1px 43px 0 28px;
|
||||||
@ -67,3 +78,4 @@
|
|||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
background-color: #F6F6F6;
|
background-color: #F6F6F6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Plugins
|
* Plugins
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
@ -17,7 +17,7 @@ import styles from './styles.scss';
|
|||||||
class Plugins extends React.Component {
|
class Plugins extends React.Component {
|
||||||
state = { pluginSelected: '' };
|
state = { pluginSelected: '' };
|
||||||
|
|
||||||
changePluginSelected = (name) => this.setState({ pluginSelected: name });
|
changePluginSelected = name => this.setState({ pluginSelected: name });
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
@ -31,8 +31,13 @@ class Plugins extends React.Component {
|
|||||||
<FormattedMessage id="users-permissions.Plugins.header.description" />
|
<FormattedMessage id="users-permissions.Plugins.header.description" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={cn(styles.pluginsContainer, !has(this.props.plugins, 'application') && styles.pluginsGradient)}>
|
<div
|
||||||
{map(Object.keys(this.props.plugins).sort(), (plugin) => (
|
className={cn(
|
||||||
|
styles.pluginsContainer,
|
||||||
|
!has(this.props.plugins, 'application') && styles.pluginsGradient
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{map(Object.keys(this.props.plugins).sort(), plugin => (
|
||||||
<Plugin
|
<Plugin
|
||||||
changePluginSelected={this.changePluginSelected}
|
changePluginSelected={this.changePluginSelected}
|
||||||
key={plugin}
|
key={plugin}
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
"BoundRoute.title": "Bound route to",
|
"BoundRoute.title": "Bound route to",
|
||||||
"Controller.input.label": "{label} ",
|
"Controller.input.label": "{label} ",
|
||||||
"Controller.selectAll": "Select all",
|
"Controller.selectAll": "Select all",
|
||||||
|
"Controller.unselectAll": "Unselect all",
|
||||||
"EditForm.inputSelect.description.role": "It will attach the new authenticated user to the selected role.",
|
"EditForm.inputSelect.description.role": "It will attach the new authenticated user to the selected role.",
|
||||||
"EditForm.inputSelect.durations.description": "Number of hours during which the user can't subscribe.",
|
"EditForm.inputSelect.durations.description": "Number of hours during which the user can't subscribe.",
|
||||||
"EditForm.inputSelect.durations.label": "Duration",
|
"EditForm.inputSelect.durations.label": "Duration",
|
||||||
@ -151,4 +152,4 @@
|
|||||||
"notification.success.submit": "Settings have been updated",
|
"notification.success.submit": "Settings have been updated",
|
||||||
"plugin.description.long": "Protect your API with a full authentication process based on JWT. This plugin comes also with an ACL strategy that allows you to manage the permissions between the groups of users.",
|
"plugin.description.long": "Protect your API with a full authentication process based on JWT. This plugin comes also with an ACL strategy that allows you to manage the permissions between the groups of users.",
|
||||||
"plugin.description.short": "Protect your API with a full authentication process based on JWT"
|
"plugin.description.short": "Protect your API with a full authentication process based on JWT"
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
"BoundRoute.title": "Route associée à",
|
"BoundRoute.title": "Route associée à",
|
||||||
"Controller.input.label": "{label} ",
|
"Controller.input.label": "{label} ",
|
||||||
"Controller.selectAll": "Tout cocher",
|
"Controller.selectAll": "Tout cocher",
|
||||||
|
"Controller.unselectAll": "Tout décocher",
|
||||||
"EditForm.inputSelect.description.role": "Choisissez le rôle qui sera lié aux utilisateurs lors de leur enregistrement.",
|
"EditForm.inputSelect.description.role": "Choisissez le rôle qui sera lié aux utilisateurs lors de leur enregistrement.",
|
||||||
"EditForm.inputSelect.durations.description": "Nombre d'heure pendant lesquelles un utilisateur ne peut pas s'inscrire.",
|
"EditForm.inputSelect.durations.description": "Nombre d'heure pendant lesquelles un utilisateur ne peut pas s'inscrire.",
|
||||||
"EditForm.inputSelect.durations.label": "Durée",
|
"EditForm.inputSelect.durations.label": "Durée",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user