mirror of
https://github.com/strapi/strapi.git
synced 2025-09-21 14:31:16 +00:00
Update branch
Merge branch 'plugin/content-manager-dev' of github.com:strapi/strapi into plugin/content-manager-dev
This commit is contained in:
commit
9255f8098e
@ -6,11 +6,17 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
height: 3rem;
|
height: 3rem;
|
||||||
padding-left: 1rem;
|
padding-left: 15px;
|
||||||
padding-right: 1rem;
|
padding-right: 15px;
|
||||||
line-height: 3rem;
|
line-height: 3rem;
|
||||||
|
font-family: 'Lato';
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 300;
|
||||||
|
letter-spacing: 0.05rem;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
color: $strapi-gray-light;
|
color: $strapi-gray-light;
|
||||||
border-top: 1px solid $strapi-gray;
|
|
||||||
font-size: $font-size-xs;
|
select{
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,69 +4,71 @@
|
|||||||
.notification {
|
.notification {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
width: 28.6rem;
|
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
|
width: 300px;
|
||||||
|
min-height: 60px;
|
||||||
|
margin-bottom: 14px;
|
||||||
background: $white;
|
background: $white;
|
||||||
margin-bottom: 1.4rem;
|
border-radius: 2px;
|
||||||
transition: all 0.2s ease;
|
|
||||||
border-radius: 0.1rem;
|
|
||||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15);
|
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.15);
|
||||||
color: #333740;
|
color: #333740;
|
||||||
|
transition: all 0.15s ease;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notification:hover {
|
.notification:hover {
|
||||||
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.5);
|
cursor: pointer;
|
||||||
|
box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.notificationIcon {
|
.notificationIcon {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
width: 18%;
|
width: 60px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 2.4rem;
|
font-size: 2.4rem;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(50% - 1rem);
|
top: calc(50% - 10px); left: calc(50% - 10px);
|
||||||
left: calc(50% - 1rem);
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
padding-top: 4px;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
border: 1px solid $brand-success;
|
border: 1px solid $brand-success;
|
||||||
color: $brand-success;
|
color: $brand-success;
|
||||||
height: 2rem;
|
|
||||||
width: 2rem;
|
|
||||||
font-size: 1.2rem;
|
font-size: 1.2rem;
|
||||||
padding-top: .3rem;
|
|
||||||
padding-left: 0.1rem;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notificationContent {
|
.notificationContent {
|
||||||
display: block;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 220px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding-top: 1.5rem;
|
padding-right: 10px;
|
||||||
padding-bottom: 1.5rem;
|
|
||||||
padding-right: 1rem;
|
|
||||||
border-right: 1px solid rgba(255, 255, 255, 0.3);
|
border-right: 1px solid rgba(255, 255, 255, 0.3);
|
||||||
width: 70%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notificationTitle {
|
.notificationTitle {
|
||||||
font-weight: 500;
|
|
||||||
font-size: 1.4rem;
|
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
font-size: 1.4rem;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.8rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.notificationClose {
|
.notificationClose {
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.6;
|
||||||
position: relative;
|
position: relative;
|
||||||
display: block;
|
display: block;
|
||||||
cursor: pointer;
|
|
||||||
width: 12%;
|
width: 20px;
|
||||||
opacity: 0.6;
|
|
||||||
transition: opacity 0.1s ease;
|
|
||||||
font-size: 1.6rem;
|
font-size: 1.6rem;
|
||||||
color: #c2c4c7;
|
color: #BBC2BF;
|
||||||
|
transition: opacity 0.1s ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
@ -74,28 +76,39 @@
|
|||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: calc(50% - .9rem);
|
top: calc(50% - 6px);
|
||||||
left: calc(50% - 0.5rem);
|
height: 100%;
|
||||||
|
font-size: 1.4rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notificationSuccess{
|
||||||
|
background: linear-gradient(100deg , #FFFFFF 50%, rgba(39, 183, 15, .05)), $white;
|
||||||
|
}
|
||||||
|
|
||||||
.notificationWarning {
|
.notificationWarning {
|
||||||
|
background: linear-gradient(100deg , #FFFFFF 50%, rgba(250, 156, 0, .05)), $white;
|
||||||
|
|
||||||
.notificationIcon:before {
|
.notificationIcon:before {
|
||||||
|
padding-top: 4px;
|
||||||
border-color: $brand-warning;
|
border-color: $brand-warning;
|
||||||
color: $brand-warning;
|
color: $brand-warning;
|
||||||
padding-top: .4rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notificationError {
|
.notificationError {
|
||||||
|
background: linear-gradient(100deg , #FFFFFF 50%, rgba(255, 93, 0, .05)), $white;
|
||||||
|
|
||||||
.notificationIcon:before {
|
.notificationIcon:before {
|
||||||
|
padding-top: 4px;
|
||||||
border-color: $brand-danger;
|
border-color: $brand-danger;
|
||||||
color: $brand-danger;
|
color: $brand-danger;
|
||||||
padding-top: .4rem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.notificationInfo {
|
.notificationInfo {
|
||||||
|
background: linear-gradient(100deg , #FFFFFF 50%, rgba(28, 93, 231, .05)), $white;
|
||||||
|
|
||||||
.notificationIcon:before {
|
.notificationIcon:before {
|
||||||
border-color: $brand-primary;
|
border-color: $brand-primary;
|
||||||
color: $brand-primary;
|
color: $brand-primary;
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
.notificationsContainer { /* stylelint-disable */
|
.notificationsContainer { /* stylelint-disable */
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 7rem;
|
top: 72px;
|
||||||
right: 1rem;
|
right: 15px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
list-style: none;
|
list-style: none;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ export function showNotification(message, status) {
|
|||||||
((id) => {
|
((id) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
dispatch(hideNotification(id));
|
dispatch(hideNotification(id));
|
||||||
}, 5000);
|
}, 2500);
|
||||||
})(nextNotificationId);
|
})(nextNotificationId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -259,14 +259,12 @@ module.exports = function(strapi) {
|
|||||||
) || '';
|
) || '';
|
||||||
|
|
||||||
// Build associations key
|
// Build associations key
|
||||||
if (!_.isEmpty(verbose)) {
|
utilsModels.defineAssociations(
|
||||||
utilsModels.defineAssociations(
|
globalName,
|
||||||
globalName,
|
definition,
|
||||||
definition,
|
details,
|
||||||
details,
|
name
|
||||||
name
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (verbose) {
|
switch (verbose) {
|
||||||
case 'hasOne': {
|
case 'hasOne': {
|
||||||
|
@ -210,9 +210,9 @@ module.exports = function (strapi) {
|
|||||||
const verbose = _.get(utilsModels.getNature(details, name, undefined, model.toLowerCase()), 'verbose') || '';
|
const verbose = _.get(utilsModels.getNature(details, name, undefined, model.toLowerCase()), 'verbose') || '';
|
||||||
|
|
||||||
// Build associations key
|
// Build associations key
|
||||||
if (!_.isEmpty(verbose)) {
|
utilsModels.defineAssociations(model, definition, details, name);
|
||||||
utilsModels.defineAssociations(model, definition, details, name);
|
|
||||||
} else {
|
if (_.isEmpty(verbose)) {
|
||||||
definition.loadedModel[name].type = utils(mongoose).convertType(details.type);
|
definition.loadedModel[name].type = utils(mongoose).convertType(details.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ export function* editRecord() {
|
|||||||
|
|
||||||
yield put(recordEdited());
|
yield put(recordEdited());
|
||||||
window.Strapi.notification.success(
|
window.Strapi.notification.success(
|
||||||
`The entry has been successfully ${isCreating ? 'created' : 'updated'}.`
|
`Saved`
|
||||||
);
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
yield put(recordEditError());
|
yield put(recordEditError());
|
||||||
@ -83,7 +83,7 @@ export function* deleteRecord({ id, modelName }) {
|
|||||||
|
|
||||||
yield put(recordDeleted(id));
|
yield put(recordDeleted(id));
|
||||||
window.Strapi.notification.success(
|
window.Strapi.notification.success(
|
||||||
'The entry has been successfully deleted.'
|
'Deleted'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Redirect to the list page.
|
// Redirect to the list page.
|
||||||
|
@ -28,9 +28,22 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
create: async function (params) {
|
create: async function (params) {
|
||||||
return await this
|
const entry = await this
|
||||||
.forge()
|
.forge()
|
||||||
.save(params.values);
|
.save(Object.keys(params.values).reduce((acc, current) => {
|
||||||
|
if (this._attributes[current].type) {
|
||||||
|
acc[current] = params.values[current];
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, {}));
|
||||||
|
|
||||||
|
return module.exports.update.call(this, {
|
||||||
|
[this.primaryKey]: entry[this.primaryKey],
|
||||||
|
values: _.merge({
|
||||||
|
id: entry[this.primaryKey]
|
||||||
|
}, params.values)
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
update: async function (params) {
|
update: async function (params) {
|
||||||
@ -114,29 +127,21 @@ module.exports = {
|
|||||||
|
|
||||||
// Push the work into the flow process.
|
// Push the work into the flow process.
|
||||||
toAdd.forEach(value => {
|
toAdd.forEach(value => {
|
||||||
if (association.nature === 'manyToMany' && !_.isArray(params.values[this.primaryKey])) {
|
value[details.via] = params.values[this.primaryKey];
|
||||||
value[details.via] = (value[details.via] || []).concat([params.values[this.primaryKey]]);
|
|
||||||
} else {
|
|
||||||
value[details.via] = params.values[this.primaryKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
virtualFields.push(strapi.query(details.model || details.collection).addRelation({
|
virtualFields.push(strapi.query(details.model || details.collection).addRelation({
|
||||||
id: value[this.primaryKey] || value.id || value._id,
|
id: value[this.primaryKey] || value.id || value._id,
|
||||||
values: value,
|
values: association.nature === 'manyToMany' ? params.values : value,
|
||||||
foreignKey: current
|
foreignKey: current
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
toRemove.forEach(value => {
|
toRemove.forEach(value => {
|
||||||
if (association.nature === 'manyToMany' && !_.isArray(params.values[this.primaryKey])) {
|
value[details.via] = null;
|
||||||
value[details.via] = value[details.via].filter(x => x.toString() !== params.values[this.primaryKey].toString());
|
|
||||||
} else {
|
|
||||||
value[details.via] = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtualFields.push(strapi.query(details.model || details.collection).removeRelation({
|
virtualFields.push(strapi.query(details.model || details.collection).removeRelation({
|
||||||
id: value[this.primaryKey] || value.id || value._id,
|
id: value[this.primaryKey] || value.id || value._id,
|
||||||
values: value,
|
values: association.nature === 'manyToMany' ? params.values : value,
|
||||||
foreignKey: current
|
foreignKey: current
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@ -156,7 +161,7 @@ module.exports = {
|
|||||||
.forge({
|
.forge({
|
||||||
[this.primaryKey]: params[this.primaryKey]
|
[this.primaryKey]: params[this.primaryKey]
|
||||||
})
|
})
|
||||||
.save(params.values, {
|
.save(values, {
|
||||||
patch: true
|
patch: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -167,7 +172,7 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
delete: async function (params) {
|
delete: async function (params) {
|
||||||
return await params.model
|
return await this
|
||||||
.forge({
|
.forge({
|
||||||
[this.primaryKey]: params[this.primaryKey]
|
[this.primaryKey]: params[this.primaryKey]
|
||||||
})
|
})
|
||||||
@ -189,7 +194,7 @@ module.exports = {
|
|||||||
case 'manyToMany':
|
case 'manyToMany':
|
||||||
return this.forge({
|
return this.forge({
|
||||||
[this.primaryKey]: params[this.primaryKey]
|
[this.primaryKey]: params[this.primaryKey]
|
||||||
})[association.alias]().attach(params.values.id);
|
})[association.alias]().attach(params.values[this.primaryKey]);
|
||||||
default:
|
default:
|
||||||
// Resolve silently.
|
// Resolve silently.
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
@ -211,7 +216,7 @@ module.exports = {
|
|||||||
case 'manyToMany':
|
case 'manyToMany':
|
||||||
return this.forge({
|
return this.forge({
|
||||||
[this.primaryKey]: params[this.primaryKey]
|
[this.primaryKey]: params[this.primaryKey]
|
||||||
})[association.alias]().detach(params.values.id);
|
})[association.alias]().detach(params.values[this.primaryKey]);
|
||||||
default:
|
default:
|
||||||
// Resolve silently.
|
// Resolve silently.
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
@ -25,7 +25,6 @@ module.exports = {
|
|||||||
create: async function (params) {
|
create: async function (params) {
|
||||||
const entry = await this.create(Object.keys(params.values).reduce((acc, current) => {
|
const entry = await this.create(Object.keys(params.values).reduce((acc, current) => {
|
||||||
if (this._attributes[current].type) {
|
if (this._attributes[current].type) {
|
||||||
console.log(current);
|
|
||||||
acc[current] = params.values[current];
|
acc[current] = params.values[current];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user