From bdd1583543a9da38530b206101544dde72e7b465 Mon Sep 17 00:00:00 2001 From: Jim Laurie Date: Tue, 10 Apr 2018 14:46:36 +0200 Subject: [PATCH 1/6] Handle polymorphic in admin Only for collection: * poly side --- packages/strapi-bookshelf/package.json | 2 +- packages/strapi-knex/package.json | 2 +- .../src/components/EditRelations/index.js | 3 ++- .../admin/src/containers/EditPage/index.js | 3 ++- .../config/queries/mongoose.js | 22 ++++++++++--------- .../services/ContentManager.js | 2 +- .../models/User.settings.json | 10 ++++++++- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/packages/strapi-bookshelf/package.json b/packages/strapi-bookshelf/package.json index cd4b1b9473..055b12c625 100755 --- a/packages/strapi-bookshelf/package.json +++ b/packages/strapi-bookshelf/package.json @@ -55,4 +55,4 @@ "npm": ">= 5.3.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-knex/package.json b/packages/strapi-knex/package.json index c650cd122f..be44035ed6 100755 --- a/packages/strapi-knex/package.json +++ b/packages/strapi-knex/package.json @@ -46,4 +46,4 @@ "npm": ">= 5.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js b/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js index 7ea8f45bef..ff36b31e28 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/EditRelations/index.js @@ -30,8 +30,9 @@ function EditRelations(props) { {(message) =>

{message}

} {map(filterRelationsUpload(props.schema.relations), (relation, key) => { + if (relation.nature.toLowerCase().includes('morph') && relation[key]) return ''; - const Select = ['oneWay', 'oneToOne', 'manyToOne'].includes(relation.nature) && relation.dominant ? SelectOne : SelectMany; + const Select = ['oneWay', 'oneToOne', 'manyToOne', 'oneToManyMorph', 'oneToOneMorph'].includes(relation.nature) && relation.dominant ? SelectOne : SelectMany; return (