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