diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/index.js
new file mode 100644
index 0000000000..5221ad498e
--- /dev/null
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/index.js
@@ -0,0 +1,141 @@
+/**
+ *
+ * AttributeForm
+ *
+ */
+
+import React from 'react';
+import PropTypes from 'prop-types';
+import { FormattedMessage } from 'react-intl';
+import { get } from 'lodash';
+// import { connect } from 'react-redux';
+// import { bindActionCreators, compose } from 'redux';
+
+import Input from 'components/InputsIndex';
+
+import pluginId from '../../pluginId';
+
+import BodyModal from '../../components/BodyModal';
+import ButtonModalPrimary from '../../components/ButtonModalPrimary';
+import ButtonModalSecondary from '../../components/ButtonModalSecondary';
+import FooterModal from '../../components/FooterModal';
+import HeaderModal from '../../components/HeaderModal';
+import HeaderModalNavContainer from '../../components/HeaderModalNavContainer';
+import HeaderNavLink from '../../components/HeaderNavLink';
+import WrapperModal from '../../components/WrapperModal';
+
+import supportedAttributes from './supportedAttributes.json';
+
+const NAVLINKS = [
+ { id: 'base' },
+ { id: 'advanced' },
+];
+
+class AttributeForm extends React.Component { // eslint-disable-line react/prefer-stateless-function
+ handleCancel = () => {
+ const { push } = this.props;
+
+ push({ search: '' });
+ }
+
+ handleGoTo = to => {
+ const { attributeType, push } = this.props;
+
+ push({
+ search: `modalType=attributeForm&attributeType=${attributeType}&settingType=${to}&actionType=create`,
+ });
+ }
+
+ handleToggle = () => {
+ const { push } = this.props;
+
+ push({ search: '' });
+ }
+
+ renderInput = (input, index) => {
+ console.log(input);
+
+ return (
+ {}}
+ />
+ )
+ }
+
+ renderNavLink = (link, index) => {
+ const { activeTab } = this.props;
+
+ return (
+
+ );
+ }
+
+ render() {
+ const { activeTab, attributeType, isOpen, onSubmit } = this.props;
+ const currentForm = get(supportedAttributes, [attributeType, activeTab, 'items'], []);
+
+ return (
+
+
+
+
+
+ string
+
+
+
+
+ {NAVLINKS.map(this.renderNavLink)}
+
+
+
+
+ );
+ }
+}
+
+AttributeForm.defaultProps = {
+ attributeType: 'string',
+ isOpen: false,
+ onSubmit: (e) => {
+ e.preventDefault();
+ },
+};
+
+AttributeForm.propTypes = {
+ attributeType: PropTypes.string,
+ isOpen: PropTypes.bool,
+ onSubmit: PropTypes.func,
+ push: PropTypes.func.isRequired,
+};
+
+export default AttributeForm;
+// function mapDispatchToProps(dispatch) {
+// return bindActionCreators(
+// {},
+// dispatch,
+// );
+// }
+
+// const withConnect = connect(null, mapDispatchToProps);
+
+// export default compose(
+// withConnect,
+// )(AttributeForm);
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/supportedAttributes.json b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/supportedAttributes.json
new file mode 100644
index 0000000000..c16b2d2e4b
--- /dev/null
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/supportedAttributes.json
@@ -0,0 +1,22 @@
+{
+ "string": {
+ "base": {
+ "items": [
+ {
+ "label": {
+ "id": "content-type-builder.form.attribute.item.string.name"
+ },
+ "name": "name",
+ "type": "string",
+ "value": "",
+ "validations": {
+ "required": true
+ }
+ }
+ ]
+ },
+ "advanced": {
+ "items": []
+ }
+ }
+}
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/tests/index.test.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/tests/index.test.js
new file mode 100644
index 0000000000..e149779f5b
--- /dev/null
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributeForm/tests/index.test.js
@@ -0,0 +1,23 @@
+import React from 'react';
+import { shallow } from 'enzyme';
+import mountWithIntl from 'testUtils/mountWithIntl';
+import formatMessagesWithPluginId from 'testUtils/formatMessages';
+
+
+// This part is needed if you need to test the lifecycle of a container that contains FormattedMessages
+
+import pluginId from '../../../pluginId';
+import pluginTradsEn from '../../../translations/en.json';
+
+import AttributeForm from '../index';
+
+const messages = formatMessagesWithPluginId(pluginId, pluginTradsEn);
+const renderComponent = (props = {}) => mountWithIntl(, messages);
+
+describe('', () => {
+ it('Expect to have unit tests specified', () => {
+ // shallow();
+
+ renderComponent({});
+ });
+});
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributesPickerModal/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributesPickerModal/index.js
index b02a664f8c..a655b5863d 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributesPickerModal/index.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/AttributesPickerModal/index.js
@@ -65,6 +65,12 @@ class AttributesPickerModal extends React.Component { // eslint-disable-line rea
document.removeEventListener('keydown', this.handleKeyDown);
}
+ handleClick = (type) => {
+ const { push } = this.props;
+
+ push({ search: `modalType=attributeForm&attributeType=${type}&settingType=base` });
+ }
+
/* istanbul ignore next */
handleKeyDown = (e) => {
/* istanbul ignore next */
@@ -120,6 +126,7 @@ class AttributesPickerModal extends React.Component { // eslint-disable-line rea
tabIndex={index}
isDisplayed={isDisplayed}
nodeToFocus={nodeToFocus}
+ onClick={this.handleClick}
{...attribute}
/>
);
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js
index 14f5439c5e..61af43d1ce 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/index.js
@@ -33,6 +33,7 @@ import LeftMenuLink from '../../components/LeftMenuLink';
import ListTitle from '../../components/ListTitle';
import Ul from '../../components/Ul';
+import AttributeForm from '../AttributeForm';
import AttributesModalPicker from '../AttributesPickerModal';
import CustomLink from './CustomLink';
@@ -103,6 +104,15 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr
push({ search: 'modalType=chooseAttributes' });
}
+ isUpdatingTemporaryContentType = () => {
+ const { models } = this.props;
+ const currentModel = models.find(model => model.name === this.getModelName()) || { isTemporary: true };
+
+ const { isTemporary } = currentModel;
+
+ return isTemporary;
+ }
+
shouldRedirect = () => {
const { models } = this.props;
@@ -143,7 +153,7 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr
location: { search },
models,
} = this.props;
-
+ console.log(this.isUpdatingTemporaryContentType());
if (this.shouldRedirect()) {
return ;
}
@@ -228,6 +238,12 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr
isOpen={getQueryParameters(search, 'modalType') === 'chooseAttributes'}
push={push}
/>
+
);
}