Skip to content

Commit

Permalink
Page section: fix multiple status buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
distantnative committed Jun 8, 2024
1 parent c58147b commit 38a3044
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions panel/src/components/Collection/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
>
<!-- Buttons -->
<k-button
v-for="(button, buttonIndex) in buttons"
:key="'button-' + buttonIndex"
v-for="button in buttons"
:key="JSON.stringify(button)"
v-bind="button"
/>

Expand Down
23 changes: 12 additions & 11 deletions panel/src/components/Sections/PagesSection.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { toRaw } from "vue";
import ModelsSection from "@/components/Sections/ModelsSection.vue";
export default {
Expand All @@ -9,20 +10,20 @@ export default {
},
items() {
return this.data.map((page) => {
const disabled = page.permissions.changeStatus === false;
const status = this.$helper.page.status(page.status, disabled);
status.click = () => this.$dialog(page.link + "/changeStatus");
page.flag = {
status: page.status,
disabled: disabled,
click: () => this.$dialog(page.link + "/changeStatus")
};
page = toRaw(page);
page.sortable = page.permissions.sort && this.options.sortable;
page.deletable = this.data.length > this.options.min;
page.column = this.column;
page.buttons = [status, ...(page.buttons ?? [])];
page.buttons = [
{
...this.$helper.page.status(
page.status,
page.permissions.changeStatus === false
),
click: () => this.$dialog(page.link + "/changeStatus")
},
...(page.buttons ?? [])
];
page.options = this.$dropdown(page.link, {
query: {
view: "list",
Expand Down

0 comments on commit 38a3044

Please sign in to comment.