mirror of
https://github.com/strapi/strapi.git
synced 2025-12-05 11:32:13 +00:00
Add IcoContainer component to content-manager
This commit is contained in:
parent
3504624c84
commit
69c99a8700
@ -4,9 +4,13 @@ import PropTypes from 'prop-types';
|
||||
import styles from './styles.scss';
|
||||
|
||||
function Ico(props) {
|
||||
const iProps = Object.assign({}, props);
|
||||
const propsToDelete = ['onClick', 'icoType'];
|
||||
propsToDelete.map((value) => delete iProps[value]);
|
||||
|
||||
return (
|
||||
<div className={styles.ico} onClick={(e) => handleClick(e, props.onClick)}>
|
||||
<i className={`fa fa-${props.icoType}`} id={props.id} role="button" aria-hidden="true"/>
|
||||
<div className={styles.ico} onClick={(e) => handleClick(e, props.onClick)} id={props.id}>
|
||||
<i className={`fa fa-${props.icoType}`} id={props.id} role="button" aria-hidden="true" {...iProps} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -14,7 +18,7 @@ function Ico(props) {
|
||||
const handleClick = (e, onClick) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
onClick();
|
||||
onClick(e);
|
||||
}
|
||||
|
||||
Ico.proptypes = {
|
||||
|
||||
@ -9,6 +9,8 @@ import PropTypes from 'prop-types';
|
||||
import moment from 'moment';
|
||||
import { isEmpty, isObject } from 'lodash';
|
||||
|
||||
import IcoContainer from 'components/IcoContainer';
|
||||
|
||||
import styles from './styles.scss';
|
||||
|
||||
class TableRow extends React.Component {
|
||||
@ -73,11 +75,9 @@ class TableRow extends React.Component {
|
||||
</td>
|
||||
));
|
||||
|
||||
// Add actions cell.
|
||||
cells.push(
|
||||
<td key='action' className={styles.actions}>
|
||||
<i className="fa fa-pencil" aria-hidden="true"></i>
|
||||
<i onClick={this.props.onDelete} id={this.props.record.id} className="fa fa-trash" aria-hidden="true"></i>
|
||||
<IcoContainer icons={[{ icoType: 'pencil' }, { id: this.props.record.id, icoType: 'trash', onClick: this.props.onDelete }]} />
|
||||
</td>
|
||||
);
|
||||
|
||||
|
||||
@ -69,7 +69,6 @@ export class List extends React.Component {
|
||||
componentDidMount() {
|
||||
// Init the view
|
||||
this.init(this.props);
|
||||
// this.init(this.props.match.params.slug);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps) {
|
||||
@ -77,7 +76,6 @@ export class List extends React.Component {
|
||||
|
||||
if (locationChanged) {
|
||||
this.init(nextProps);
|
||||
// this.init(nextProps.match.params.slug);
|
||||
}
|
||||
|
||||
if (!isEmpty(nextProps.location.search) && this.props.location.search !== nextProps.location.search) {
|
||||
@ -148,10 +146,8 @@ export class List extends React.Component {
|
||||
|
||||
toggleModalWarning = (e) => {
|
||||
if (!isUndefined(e)) {
|
||||
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
this.setState({
|
||||
target: e.target.id,
|
||||
});
|
||||
@ -164,6 +160,7 @@ export class List extends React.Component {
|
||||
if (!this.props.currentModelName || !this.props.schema) {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
// Detect current model structure from models list
|
||||
const currentModel = this.props.models[this.props.currentModelName];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user