@oxygen-cms/ui 1.9.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/CrudApi.js +39 -0
- package/src/PagesApi.js +2 -0
- package/src/PartialsApi.js +7 -0
- package/src/components/ContentResourceEdit.vue +964 -0
- package/src/components/{PageEdit.vue → PageEditWysiwyg.vue} +1 -1
- package/src/components/ResourceList.vue +8 -3
- package/src/components/VersionsDrawer.vue +386 -0
- package/src/components/content/PartialNodeView.vue +1 -1
- package/src/components/pages/CreatePageDropdown.vue +5 -5
- package/src/components/pages/PageActions.vue +67 -0
- package/src/components/pages/PageChooseParent.vue +170 -0
- package/src/components/pages/PageEdit.vue +149 -0
- package/src/components/pages/PageList.vue +1 -1
- package/src/components/{PageNestedRow.vue → pages/PageNestedRow.vue} +3 -3
- package/src/components/{PageStatusIcon.vue → pages/PageStatusIcon.vue} +1 -1
- package/src/components/{PageTable.vue → pages/PageTable.vue} +5 -5
- package/src/components/partials/CreatePartialDropdown.vue +1 -1
- package/src/components/{PartialActions.vue → partials/PartialActions.vue} +1 -1
- package/src/components/partials/PartialEdit.vue +49 -0
- package/src/components/{PartialList.vue → partials/PartialList.vue} +3 -3
- package/src/components/{PartialStatusIcon.vue → partials/PartialStatusIcon.vue} +1 -1
- package/src/components/{PartialTable.vue → partials/PartialTable.vue} +1 -1
- package/src/icons.js +11 -2
- package/src/modules/PagesPartials.js +11 -16
- package/src/components/PageActions.vue +0 -151
- /package/src/components/{PageNestedPagination.vue → pages/PageNestedPagination.vue} +0 -0
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="page-actions">
|
|
3
|
-
<b-button v-if="item.stage !== STAGE_PUBLISHED" rounded size="is-small" icon-left="globe-asia" class="mr-2" @click="publish">Publish</b-button>
|
|
4
|
-
|
|
5
|
-
<b-dropdown
|
|
6
|
-
ref="moveDropdown"
|
|
7
|
-
position="is-top-left"
|
|
8
|
-
append-to-body
|
|
9
|
-
aria-role="menu"
|
|
10
|
-
trap-focus
|
|
11
|
-
class="move-page-dropdown"
|
|
12
|
-
>
|
|
13
|
-
<template #trigger>
|
|
14
|
-
<b-button rounded size="is-small" icon-left="folder-open" class="mr-2">Move</b-button>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<b-dropdown-item
|
|
18
|
-
aria-role="menu-item"
|
|
19
|
-
custom
|
|
20
|
-
paddingless>
|
|
21
|
-
<div class="modal-card" style="width: auto; overflow: visible">
|
|
22
|
-
<header class="modal-card-head">
|
|
23
|
-
<p class="modal-card-title">Update the parent for "{{ item.title }}"</p>
|
|
24
|
-
</header>
|
|
25
|
-
<section class="modal-card-body" style="overflow: visible;">
|
|
26
|
-
<b-field>
|
|
27
|
-
<b-autocomplete
|
|
28
|
-
v-model.lazy="movePageSearchQuery"
|
|
29
|
-
:disabled="isLoading"
|
|
30
|
-
open-on-focus
|
|
31
|
-
:data="sortedPagesList"
|
|
32
|
-
placeholder="Search for pages..."
|
|
33
|
-
clearable
|
|
34
|
-
@select="setParentPage">
|
|
35
|
-
<template #default="props">
|
|
36
|
-
<span :style="getOptionStyle(props.option)">
|
|
37
|
-
{{ props.option.title }} - {{ props.option.slug }}
|
|
38
|
-
<span v-if="isCurrentParent(props.option)" style="opacity: 0.6;"> (current parent)</span>
|
|
39
|
-
</span>
|
|
40
|
-
</template>
|
|
41
|
-
<template #empty>No results found</template>
|
|
42
|
-
</b-autocomplete>
|
|
43
|
-
</b-field>
|
|
44
|
-
</section>
|
|
45
|
-
<footer class="modal-card-foot is-flex">
|
|
46
|
-
<div class="is-flex-grow-1"></div>
|
|
47
|
-
<b-button
|
|
48
|
-
label="Close"
|
|
49
|
-
@click="close"/>
|
|
50
|
-
</footer>
|
|
51
|
-
</div>
|
|
52
|
-
</b-dropdown-item>
|
|
53
|
-
</b-dropdown>
|
|
54
|
-
</div>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<script>
|
|
58
|
-
import PagesApi from "../PagesApi.js";
|
|
59
|
-
import {morphToNotification} from "../api.js";
|
|
60
|
-
|
|
61
|
-
export default {
|
|
62
|
-
name: "PageActions",
|
|
63
|
-
props: {
|
|
64
|
-
item: { type: Object, required: true }
|
|
65
|
-
},
|
|
66
|
-
created() {
|
|
67
|
-
this.isLoading = true;
|
|
68
|
-
this.fetchData()
|
|
69
|
-
},
|
|
70
|
-
data() {
|
|
71
|
-
return {
|
|
72
|
-
STAGE_PUBLISHED: PagesApi.STAGE_PUBLISHED,
|
|
73
|
-
pagesApi: new PagesApi(),
|
|
74
|
-
movePageSearchQuery: '',
|
|
75
|
-
isLoading: false,
|
|
76
|
-
pagesList: []
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
computed: {
|
|
80
|
-
sortedPagesList() {
|
|
81
|
-
// Sort with Home page (slug '/') at the top, then alphabetically by title
|
|
82
|
-
return [...this.pagesList].sort((a, b) => {
|
|
83
|
-
if (a.slug === '/') return -1;
|
|
84
|
-
if (b.slug === '/') return 1;
|
|
85
|
-
return a.title.localeCompare(b.title);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
watch: {
|
|
90
|
-
'movePageSearchQuery': 'fetchData'
|
|
91
|
-
},
|
|
92
|
-
methods: {
|
|
93
|
-
async fetchData() {
|
|
94
|
-
let data = await this.pagesApi.list({ inTrash: false, page: 1, q: this.movePageSearchQuery });
|
|
95
|
-
this.pagesList = data.items;
|
|
96
|
-
this.isLoading = false;
|
|
97
|
-
},
|
|
98
|
-
async publish() {
|
|
99
|
-
let item = await this.pagesApi.publish(this.item.id);
|
|
100
|
-
this.$emit('update', item);
|
|
101
|
-
},
|
|
102
|
-
async setParentPage(parentPage) {
|
|
103
|
-
// Don't allow moving to current parent
|
|
104
|
-
if (this.isCurrentParent(parentPage)) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
let data = await this.pagesApi.update({id: this.item.id, parent: parentPage.id, autoConvertToDraft: 'no', version: false});
|
|
108
|
-
this.$buefy.toast.open(morphToNotification(data));
|
|
109
|
-
this.$emit('reload');
|
|
110
|
-
},
|
|
111
|
-
close() {
|
|
112
|
-
this.$refs.moveDropdown.toggle();
|
|
113
|
-
},
|
|
114
|
-
isCurrentParent(page) {
|
|
115
|
-
if (!this.item.parent) return false;
|
|
116
|
-
// Handle both cases: parent as object or parent as ID
|
|
117
|
-
const parentId = typeof this.item.parent === 'object' ? this.item.parent.id : this.item.parent;
|
|
118
|
-
return page.id === parentId;
|
|
119
|
-
},
|
|
120
|
-
getOptionStyle(option) {
|
|
121
|
-
let style = '';
|
|
122
|
-
if (option.slug === '/') {
|
|
123
|
-
style += 'font-weight: bold;';
|
|
124
|
-
}
|
|
125
|
-
if (this.isCurrentParent(option)) {
|
|
126
|
-
style += ' opacity: 0.5; cursor: not-allowed;';
|
|
127
|
-
}
|
|
128
|
-
return style;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
</script>
|
|
133
|
-
|
|
134
|
-
<style scoped>
|
|
135
|
-
.modal-card-title {
|
|
136
|
-
flex-shrink: unset;
|
|
137
|
-
flex-grow: unset;
|
|
138
|
-
}
|
|
139
|
-
</style>
|
|
140
|
-
|
|
141
|
-
<style>
|
|
142
|
-
.move-page-dropdown .dropdown-content {
|
|
143
|
-
padding-top: 0;
|
|
144
|
-
padding-bottom: 0;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.move-page-dropdown .dropdown-menu {
|
|
148
|
-
overflow: visible !important;
|
|
149
|
-
min-width: 20rem;
|
|
150
|
-
}
|
|
151
|
-
</style>
|
|
File without changes
|