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