Skip to content

Commit

Permalink
Fix UI Inconsistencies between Advanced Many-to-Many and Many-to-Many…
Browse files Browse the repository at this point in the history
… data types (#440) (#478)
  • Loading branch information
skoch98 committed Apr 5, 2024
1 parent 8dcad54 commit a26c44f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 27 deletions.
1 change: 1 addition & 0 deletions public/js/pimcore/object/tags/abstractRelations.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pimcore.object.tags.abstractRelations = Class.create(pimcore.object.tags.abstrac
{
xtype: "button",
iconCls: "pimcore_icon_filter",
tooltip: t("filter"),
cls: "relations_grid_filter_btn",
handler: this.showFilterInput.bind(this)
}
Expand Down
5 changes: 4 additions & 1 deletion public/js/pimcore/object/tags/advancedManyToManyRelation.js
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ pimcore.object.tags.advancedManyToManyRelation = Class.create(pimcore.object.tag
toolbarItems.push({
xtype: "button",
iconCls: "pimcore_icon_delete",
tooltip: t("empty"),
handler: function () {
pimcore.helpers.deleteConfirm(t('all'), t('relations'), function () {
this.empty();
Expand All @@ -611,8 +612,9 @@ pimcore.object.tags.advancedManyToManyRelation = Class.create(pimcore.object.tag
if (this.fieldConfig.assetsAllowed && this.fieldConfig.noteditable == false) {
toolbarItems.push({
xtype: "button",
cls: "pimcore_inline_upload",
iconCls: "pimcore_icon_upload",
tooltip: t("upload"),
cls: "pimcore_inline_upload",
handler: this.uploadDialog.bind(this)
});
}
Expand All @@ -622,6 +624,7 @@ pimcore.object.tags.advancedManyToManyRelation = Class.create(pimcore.object.tag
{
xtype: "button",
iconCls: "pimcore_icon_search",
tooltip: t("search"),
handler: this.openSearchEditor.bind(this)
}
//,
Expand Down
13 changes: 7 additions & 6 deletions public/js/pimcore/object/tags/manyToManyObjectRelation.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ pimcore.object.tags.manyToManyObjectRelation = Class.create(pimcore.object.tags.
},

getCreateControl: function () {

var allowedClasses;
var i;

Expand Down Expand Up @@ -324,12 +323,14 @@ pimcore.object.tags.manyToManyObjectRelation = Class.create(pimcore.object.tags.
items.push({
cls: "pimcore_block_button_plus",
iconCls: "pimcore_icon_plus",
tooltip: t("add"),
handler: collectionMenu[0].handler
});
} else if (collectionMenu.length > 1) {
items.push({
cls: "pimcore_block_button_plus",
iconCls: "pimcore_icon_plus",
tooltip: t("add"),
menu: collectionMenu
});
} else {
Expand All @@ -340,10 +341,8 @@ pimcore.object.tags.manyToManyObjectRelation = Class.create(pimcore.object.tags.
}
}


return items[0];
}
,
},

getVisibleColumns: function () {
var visibleFields = this.visibleFields || [];
Expand Down Expand Up @@ -658,6 +657,7 @@ pimcore.object.tags.manyToManyObjectRelation = Class.create(pimcore.object.tags.
toolbarItems.push({
xtype: "button",
iconCls: "pimcore_icon_delete",
tooltip: t("empty"),
handler: function () {
pimcore.helpers.deleteConfirm(t('all'), t('relations'), function () {
this.empty();
Expand All @@ -666,15 +666,16 @@ pimcore.object.tags.manyToManyObjectRelation = Class.create(pimcore.object.tags.
});
}

toolbarItems = toolbarItems.concat(this.getCreateControl());

if(pimcore.helpers.hasSearchImplementation()) {
toolbarItems.push({
xtype: "button",
iconCls: "pimcore_icon_search",
tooltip: t("search"),
handler: this.openSearchEditor.bind(this)
});
}

toolbarItems = toolbarItems.concat(this.getCreateControl());
}

return toolbarItems;
Expand Down
24 changes: 14 additions & 10 deletions public/js/pimcore/object/tags/manyToManyRelation.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,8 @@ pimcore.object.tags.manyToManyRelation = Class.create(pimcore.object.tags.abstra
icon: "/bundles/pimcoreadmin/img/flat-color-icons/delete.svg",
handler: function (grid, rowIndex) {
let data = grid.getStore().getAt(rowIndex);
pimcore.helpers.deleteConfirm(t('relation'), data.data.path, function () {

pimcore.helpers.deleteConfirm(t('relation'), data.data.fullpath, function () {
grid.getStore().removeAt(rowIndex);
}.bind(this));
}.bind(this)
Expand Down Expand Up @@ -393,6 +394,7 @@ pimcore.object.tags.manyToManyRelation = Class.create(pimcore.object.tags.abstra
toolbarItems.push({
xtype: "button",
iconCls: "pimcore_icon_delete",
tooltip: t("empty"),
handler: function () {
pimcore.helpers.deleteConfirm(t('all'), t('relations'), function () {
this.empty();
Expand All @@ -401,25 +403,27 @@ pimcore.object.tags.manyToManyRelation = Class.create(pimcore.object.tags.abstra
});
}

if (this.fieldConfig.assetsAllowed) {
toolbarItems.push({
xtype: "button",
iconCls: "pimcore_icon_upload",
tooltip: t("upload"),
cls: "pimcore_inline_upload",
handler: this.uploadDialog.bind(this)
});
}

if(pimcore.helpers.hasSearchImplementation()) {
toolbarItems = toolbarItems.concat([
{
xtype: "button",
iconCls: "pimcore_icon_search",
tooltip: t("search"),
handler: this.openSearchEditor.bind(this)
}
]);
}

if (this.fieldConfig.assetsAllowed) {
toolbarItems.push({
xtype: "button",
cls: "pimcore_inline_upload",
iconCls: "pimcore_icon_upload",
handler: this.uploadDialog.bind(this)
});
}

return toolbarItems;
},

Expand Down
25 changes: 15 additions & 10 deletions public/js/pimcore/object/tags/manyToOneRelation.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,25 +215,29 @@ pimcore.object.tags.manyToOneRelation = Class.create(pimcore.object.tags.abstrac
var items = [this.component, {
xtype: "button",
iconCls: "pimcore_icon_open",
tooltip: t("open"),
style: "margin-left: 5px",
handler: this.openElement.bind(this)
}];

if (this.fieldConfig.allowToClearRelation) {
if (this.fieldConfig.assetInlineDownloadAllowed) {
items.push({
xtype: "button",
iconCls: "pimcore_icon_delete",
iconCls: "pimcore_icon_download",
tooltip: t("download"),
cls: "pimcore_inline_download",
style: "margin-left: 5px",
handler: this.empty.bind(this)
handler: this.downloadAsset.bind(this)
});
}

if(pimcore.helpers.hasSearchImplementation()) {
if (this.fieldConfig.allowToClearRelation) {
items.push({
xtype: "button",
iconCls: "pimcore_icon_search",
iconCls: "pimcore_icon_delete",
tooltip: t("empty"),
style: "margin-left: 5px",
handler: this.openSearchEditor.bind(this)
handler: this.empty.bind(this)
});
}

Expand All @@ -242,19 +246,20 @@ pimcore.object.tags.manyToOneRelation = Class.create(pimcore.object.tags.abstrac
items.push({
xtype: "button",
iconCls: "pimcore_icon_upload",
tooltip: t("upload"),
cls: "pimcore_inline_upload",
style: "margin-left: 5px",
handler: this.uploadDialog.bind(this)
});
}

if (this.fieldConfig.assetInlineDownloadAllowed) {
if(pimcore.helpers.hasSearchImplementation()) {
items.push({
xtype: "button",
iconCls: "pimcore_icon_download",
cls: "pimcore_inline_download",
iconCls: "pimcore_icon_search",
tooltip: t("search"),
style: "margin-left: 5px",
handler: this.downloadAsset.bind(this)
handler: this.openSearchEditor.bind(this)
});
}

Expand Down

0 comments on commit a26c44f

Please sign in to comment.