Skip to content

Commit

Permalink
Merge pull request #6899 from getkirby/fix/6870-structure-field-remov…
Browse files Browse the repository at this point in the history
…e-dropdown

Structure field: fix label of remove dropdown item
  • Loading branch information
bastianallgeier authored Jan 13, 2025
2 parents c5ec448 + 0f2d318 commit 8745590
Showing 1 changed file with 34 additions and 40 deletions.
74 changes: 34 additions & 40 deletions panel/src/components/Forms/Field/StructureField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,6 @@ export default {
return (this.page - 1) * this.limit + 1;
},
/**
* Returns if new entries can be added
* @returns {bool}
*/
more() {
if (this.disabled === true) {
return false;
}
if (this.max && this.items.length >= this.max) {
return false;
}
return true;
},
hasFields() {
return this.$helper.object.length(this.fields) > 0;
},
Expand Down Expand Up @@ -241,6 +226,21 @@ export default {
return true;
},
/**
* Returns if new entries can be added
* @returns {bool}
*/
more() {
if (this.disabled === true) {
return false;
}
if (this.max && this.items.length >= this.max) {
return false;
}
return true;
},
/**
* Returns config for `k-pagination`
* @returns {Obect}
Expand Down Expand Up @@ -270,31 +270,25 @@ export default {
return [];
}
let options = [];
let more = this.duplicate && this.more;
options.push({
icon: "edit",
text: this.$t("edit"),
click: "edit"
});
options.push({
disabled: !more,
icon: "copy",
text: this.$t("duplicate"),
click: "duplicate"
});
options.push("-");
options.push({
icon: "trash",
text: more ? this.$t("delete") : null,
click: "remove"
});
return options;
return [
{
icon: "edit",
text: this.$t("edit"),
click: "edit"
},
{
disabled: !this.duplicate || !this.more,
icon: "copy",
text: this.$t("duplicate"),
click: "duplicate"
},
"-",
{
icon: "trash",
text: this.$t("delete"),
click: "remove"
}
];
},
/**
* Returns paginated slice of items/rows
Expand Down

0 comments on commit 8745590

Please sign in to comment.