diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/ContentHeader/styles.scss b/packages/strapi-plugin-content-type-builder/admin/src/components/ContentHeader/styles.scss
index 0fa7ace7f2..5420bc6976 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/components/ContentHeader/styles.scss
+++ b/packages/strapi-plugin-content-type-builder/admin/src/components/ContentHeader/styles.scss
@@ -52,6 +52,7 @@
}
.buttonContainer {
+ padding-top: .3rem;
> button:last-child {
margin-right: 0;
}
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js
index 4235246f41..f6626701cf 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/components/PopUpForm/index.js
@@ -74,8 +74,8 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
const modalFooter = this.props.noButtons ?
@@ -102,6 +102,7 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
}
PopUpForm.propTypes = {
+ buttonSubmitMessage: React.PropTypes.string.isRequired,
form: React.PropTypes.oneOfType([
React.PropTypes.array.isRequired,
React.PropTypes.object.isRequired,
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
index ce4c5185ed..4d89649821 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/Form/index.js
@@ -304,7 +304,7 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
const renderModalBody = includes(this.props.hash, '#choose') ? this.renderModalBodyChooseAttributes : false;
const noButtons = includes(this.props.hash, '#choose');
-
+ const buttonSubmitMessage = includes(this.props.hash.split('::')[1], 'contentType') ? 'form.button.save' : 'form.button.continue';
return (
);
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 29f4507c06..1e4305f9b7 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
@@ -59,6 +59,7 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr
// Refecth content type after editing it
if (prevProps.location.hash !== this.props.location.hash && this.props.didFetchModel) {
+ console.log('ok')
this.fetchModel();
}
}
@@ -187,7 +188,7 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr
render() {
// Url to redirects the user if he modifies the temporary content type name
const redirectRoute = replace(this.props.route.path, '/:modelName', '');
- const addButtons = size(get(this.props.modelPage.model, 'attributes')) > 0;
+ const addButtons = this.props.modelPage.showButtons;
const content = size(this.props.modelPage.model.attributes) === 0 ?
:
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/reducer.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/reducer.js
index b0b55f6f13..19ae786fa2 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/reducer.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/reducer.js
@@ -5,6 +5,7 @@
*/
import { fromJS, Map, List } from 'immutable';
+// import { findIndex, differenceWith, isEqual, filter } from 'lodash';
/* eslint-disable new-cap */
import {
ADD_ATTRIBUTE_TO_CONTENT_TYPE,
@@ -22,17 +23,24 @@ const initialState = fromJS({
attributes: List(),
}),
postContentTypeSuccess: false,
+ showButtons: false,
});
function modelPageReducer(state = initialState, action) {
switch (action.type) {
case ADD_ATTRIBUTE_TO_CONTENT_TYPE:
- return state.updateIn(['model', 'attributes'], (list) => list.push(action.newAttribute));
- case CANCEL_CHANGES:
- return state.set('model', state.get('initialModel'));
- case DELETE_ATTRIBUTE:
return state
+ .updateIn(['model', 'attributes'], (list) => list.push(action.newAttribute))
+ .set('showButtons', true);
+ case CANCEL_CHANGES:
+ return state
+ .set('showButtons', false)
+ .set('model', state.get('initialModel'));
+ case DELETE_ATTRIBUTE: {
+ return state
+ .set('showButtons', true)
.updateIn(['model', 'attributes'], (list) => list.splice(action.position, 1));
+ }
case MODEL_FETCH_SUCCEEDED:
return state
.set('model', Map(action.model.model))
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js
index 35ebe7dc7f..a894ced987 100644
--- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js
+++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ModelPage/sagas.js
@@ -9,27 +9,27 @@ import { temporaryContentTypePosted } from 'containers/App/actions';
import { storeData } from '../../utils/storeData';
-import { DELETE_ATTRIBUTE, MODEL_FETCH, SUBMIT } from './constants';
+import { MODEL_FETCH, SUBMIT } from './constants';
import { modelFetchSucceeded, postContentTypeSucceeded } from './actions';
import { makeSelectModel } from './selectors';
// Individual exports for testing
-export function* attributeDelete(action) {
- try {
- if (action.sendRequest) {
- const body = yield select(makeSelectModel());
- const requestUrl = `/content-type-builder/models/${action.modelName}`;
- const opts = {
- method: 'PUT',
- body,
- };
-
- yield call(request, requestUrl, opts);
- }
- } catch(error) {
- window.Strapi.notification.error('An error occured');
- }
-}
+// export function* attributeDelete(action) {
+// try {
+// if (action.sendRequest) {
+// const body = yield select(makeSelectModel());
+// const requestUrl = `/content-type-builder/models/${action.modelName}`;
+// const opts = {
+// method: 'PUT',
+// body,
+// };
+//
+// yield call(request, requestUrl, opts);
+// }
+// } catch(error) {
+// window.Strapi.notification.error('An error occured');
+// }
+// }
export function* fetchModel(action) {
try {
@@ -70,13 +70,13 @@ export function* submitChanges() {
export function* defaultSaga() {
const loadModelWatcher = yield fork(takeLatest, MODEL_FETCH, fetchModel);
- const deleteAttributeWatcher = yield fork(takeLatest, DELETE_ATTRIBUTE, attributeDelete);
+ // const deleteAttributeWatcher = yield fork(takeLatest, DELETE_ATTRIBUTE, attributeDelete);
const loadSubmitChanges = yield fork(takeLatest, SUBMIT, submitChanges);
yield take(LOCATION_CHANGE);
yield cancel(loadModelWatcher);
- yield cancel(deleteAttributeWatcher);
+ // yield cancel(deleteAttributeWatcher);
yield cancel(loadSubmitChanges);
}
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json b/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json
index ccffd0c69a..3473299ab9 100755
--- a/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json
+++ b/packages/strapi-plugin-content-type-builder/admin/src/translations/en.json
@@ -24,8 +24,9 @@
"form.attribute.item.uniqueField.description": "You won't be able to create an entry if there is an existing entry with identical content",
"form.button.cancel": "Cancel",
+ "form.button.continue": "Continue",
"form.button.save": "Save",
-
+
"form.contentType.item.connections": "Connection",
"form.contentType.item.name": "Name",
"form.contentType.item.description": "Description",
diff --git a/packages/strapi-plugin-content-type-builder/admin/src/translations/fr.json b/packages/strapi-plugin-content-type-builder/admin/src/translations/fr.json
index 245e358864..3aff89fb79 100755
--- a/packages/strapi-plugin-content-type-builder/admin/src/translations/fr.json
+++ b/packages/strapi-plugin-content-type-builder/admin/src/translations/fr.json
@@ -22,6 +22,10 @@
"form.attribute.item.requiredField.description": "Vous ne pourrez pas créer une entrée si ce champ est vide",
"form.attribute.item.uniqueField.description": "Vous ne pourrez pas créer une entrée s'il existe un champ similaire",
+ "form.button.cancel": "Annuler",
+ "form.button.continue": "Continue",
+ "form.button.save": "Sauvegarder",
+
"form.contentType.item.connections": "Connexion",
"form.contentType.item.name": "Nom",
"form.contentType.item.description": "Description",