mirror of
https://github.com/strapi/strapi.git
synced 2025-11-12 00:03:40 +00:00
back button path
This commit is contained in:
parent
c37f9e54df
commit
b74d080c1b
@ -3,6 +3,7 @@ const colors = {
|
||||
black: '#3b3b3b',
|
||||
brightGrey: '#f0f3f8',
|
||||
green: '#27b70f',
|
||||
grey: '#f7f8f8',
|
||||
greyOpacity: 'rgba(14, 22, 34, 0.02)',
|
||||
lightGrey: '#fafafa',
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ const ListWrapper = styled.div`
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.list-button {
|
||||
padding: 10px 30px 25px 30px;
|
||||
padding: 1rem 3rem 2.5rem 3rem;
|
||||
button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@ -6,6 +6,8 @@
|
||||
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { colors } from 'strapi-helper-plugin';
|
||||
|
||||
const StyedListRow = styled.tr`
|
||||
background-color: transparent;
|
||||
cursor: pointer;
|
||||
@ -15,8 +17,8 @@ const StyedListRow = styled.tr`
|
||||
img {
|
||||
width: 35px;
|
||||
}
|
||||
&:hover {
|
||||
background-color: #f7f8f8;
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
td:first-of-type {
|
||||
padding-left: 3rem;
|
||||
@ -31,8 +33,8 @@ const StyedListRow = styled.tr`
|
||||
td:last-child {
|
||||
text-align: right;
|
||||
}
|
||||
button {
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
background-color: ${colors.grey};
|
||||
}
|
||||
`;
|
||||
|
||||
|
||||
@ -108,7 +108,14 @@ export class GroupPage extends React.Component {
|
||||
deleteGroupAttribute(keys);
|
||||
};
|
||||
|
||||
handleGoBack = () => this.props.history.goBack();
|
||||
handleGoBack = () => {
|
||||
const {
|
||||
location: { pathname },
|
||||
} = this.props;
|
||||
const backPathname = pathname.substr(0, pathname.lastIndexOf('/'));
|
||||
|
||||
this.props.history.push(backPathname);
|
||||
};
|
||||
|
||||
isUpdatingTempFeature = () => {
|
||||
const { groups } = this.props;
|
||||
@ -203,6 +210,7 @@ GroupPage.propTypes = {
|
||||
}),
|
||||
location: PropTypes.shape({
|
||||
search: PropTypes.string.isRequired,
|
||||
pathname: PropTypes.string.isRequired,
|
||||
}),
|
||||
match: PropTypes.shape({
|
||||
params: PropTypes.shape({
|
||||
|
||||
@ -136,6 +136,17 @@ describe('CTB <GroupPage />', () => {
|
||||
expect(getFeatureName()).toEqual('tests');
|
||||
});
|
||||
});
|
||||
|
||||
describe('HandleGoBack', () => {
|
||||
it("should return the model's name field", () => {
|
||||
const { handleGoBack } = shallow(<GroupPage {...props} />).instance();
|
||||
handleGoBack();
|
||||
|
||||
expect(props.history.push).toHaveBeenCalledWith(
|
||||
'/plugins/content-type-builder/groups'
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('CTB <GroupPage />, mapDispatchToProps', () => {
|
||||
|
||||
@ -373,7 +373,14 @@ export class ModelPage extends React.Component {
|
||||
this.setState({ attrToDelete: null, showWarning: false });
|
||||
};
|
||||
|
||||
handleGoBack = () => this.props.history.goBack();
|
||||
handleGoBack = () => {
|
||||
const {
|
||||
location: { pathname },
|
||||
} = this.props;
|
||||
const backPathname = pathname.substr(0, pathname.lastIndexOf('/'));
|
||||
|
||||
this.props.history.push(backPathname);
|
||||
};
|
||||
|
||||
handleSubmit = (shouldContinue = false) => {
|
||||
const {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user