Skip to content

Commit 542fa20

Browse files
committed
Updated to Statamic 6
1 parent 5400f35 commit 542fa20

16 files changed

Lines changed: 814 additions & 335 deletions

LICENSE

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) JustBetter
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
6+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
7+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
8+
persons to whom the Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
11+
Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
14+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
15+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
16+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
}
1212
},
1313
"require": {
14-
"statamic/cms": "^5.0",
15-
"php": "^8.3|^8.4",
14+
"statamic/cms": "^6.0",
15+
"php": "^8.4|^8.5",
1616
"league/csv": "^9.0"
1717
},
1818
"require-dev": {

lang/en/widgets.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
'asset-usage' => [
55
'title' => 'Asset Usage',
66
'heading' => 'Asset Usage Export',
7-
'description' => 'Export a report of which assets are used on which pages.',
7+
'description' => 'Export a report showing which assets are used on which pages.',
88
'containers_label' => 'Asset Containers',
99
'containers_instructions' => 'Select the asset containers you want to export usage for.',
1010
'no_containers' => 'No asset containers found.',
11-
'export_button' => 'Export to CSV',
11+
'export_button' => 'Export CSV',
1212
'export_unused_button' => 'Export Unused Assets',
1313
],
1414
'entry-usage' => [
1515
'title' => 'Entry Usage',
1616
'heading' => 'Entry Usage Export',
17-
'description' => 'Export a report of which entries from a collection are used on which pages.',
17+
'description' => 'Export a report showing which entries from a collection are used on which pages.',
1818
'collection_label' => 'Collection',
1919
'select_collection' => 'Select a collection...',
2020
'export_used_button' => 'Export Used Entries',
21-
'export_button' => 'Export to CSV',
21+
'export_button' => 'Export CSV',
2222
'export_unused_button' => 'Export Unused Entries',
2323
],
2424
];

lang/nl/widgets.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
'asset-usage' => [
55
'title' => 'Asset Gebruik',
66
'heading' => 'Asset Gebruik Export',
7-
'description' => 'Exporteer een rapport van welke assets gebruikt worden op welke pagina\'s.',
7+
'description' => 'Exporteer een rapport dat laat zien welke assets op welke pagina\'s worden gebruikt.',
88
'containers_label' => 'Asset Containers',
99
'containers_instructions' => 'Selecteer de asset containers waarvan je het gebruik wilt exporteren.',
1010
'no_containers' => 'Geen asset containers gevonden.',
11-
'export_button' => 'Exporteer naar CSV',
11+
'export_button' => 'Exporteer CSV',
1212
'export_unused_button' => 'Exporteer Ongebruikte Assets',
1313
],
1414
'entry-usage' => [
1515
'title' => 'Entry Gebruik',
1616
'heading' => 'Entry Gebruik Export',
17-
'description' => 'Exporteer een rapport van welke entries uit een collectie gebruikt worden op welke pagina\'s.',
17+
'description' => 'Exporteer een rapport dat laat zien welke entries uit een collectie op welke pagina\'s worden gebruikt.',
1818
'collection_label' => 'Collectie',
1919
'select_collection' => 'Selecteer een collectie...',
2020
'export_used_button' => 'Exporteer Gebruikte Entries',
21-
'export_button' => 'Exporteer naar CSV',
21+
'export_button' => 'Exporteer CSV',
2222
'export_unused_button' => 'Exporteer Ongebruikte Entries',
2323
],
2424
];

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
"dev": "vite",
55
"build": "vite build"
66
},
7+
"dependencies": {
8+
"@statamic/cms": "file:./vendor/statamic/cms/resources/dist-package",
9+
"vue": "^3.5.13"
10+
},
711
"devDependencies": {
8-
"@vitejs/plugin-vue2": "^2.2.0",
9-
"laravel-vite-plugin": "^0.7.2",
12+
"@vitejs/plugin-vue": "^5.2.1",
13+
"laravel-vite-plugin": "^1.2.0",
1014
"postcss": "^8.4.41",
1115
"tailwindcss": "^3.4.10",
12-
"vite": "^4.0.0"
13-
},
14-
"dependencies": {
15-
"vue": "^2.7.0"
16+
"vite": "^6.3.4"
1617
}
1718
}

resources/dist/build/assets/statamic-content-usage-CX8pKpzT.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/dist/build/assets/statamic-content-usage-c42ce534.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

resources/dist/build/assets/statamic-content-usage-4ed993c7.js renamed to resources/dist/build/assets/statamic-content-usage-l0sNRNKZ.js

File renamed without changes.

resources/dist/build/manifest.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{
22
"resources/css/statamic-content-usage.css": {
3-
"file": "assets/statamic-content-usage-c42ce534.js",
4-
"isEntry": true,
5-
"src": "resources/css/statamic-content-usage.css"
3+
"file": "assets/statamic-content-usage-l0sNRNKZ.js",
4+
"name": "statamic-content-usage",
5+
"src": "resources/css/statamic-content-usage.css",
6+
"isEntry": true
67
},
78
"resources/js/statamic-content-usage.js": {
8-
"file": "assets/statamic-content-usage-4ed993c7.js",
9-
"isEntry": true,
10-
"src": "resources/js/statamic-content-usage.js"
9+
"file": "assets/statamic-content-usage-CX8pKpzT.js",
10+
"name": "statamic-content-usage",
11+
"src": "resources/js/statamic-content-usage.js",
12+
"isEntry": true
1113
}
1214
}
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
<script setup>
2+
import { computed, ref } from 'vue';
3+
import { Button, Select, Text, Widget } from '@statamic/cms/ui';
4+
5+
const props = defineProps({
6+
title: {
7+
type: String,
8+
required: true,
9+
},
10+
description: {
11+
type: String,
12+
required: true,
13+
},
14+
containersLabel: {
15+
type: String,
16+
required: true,
17+
},
18+
containersInstructions: {
19+
type: String,
20+
required: true,
21+
},
22+
noContainersMessage: {
23+
type: String,
24+
required: true,
25+
},
26+
exportButtonLabel: {
27+
type: String,
28+
required: true,
29+
},
30+
exportUnusedButtonLabel: {
31+
type: String,
32+
required: true,
33+
},
34+
exportUrl: {
35+
type: String,
36+
required: true,
37+
},
38+
exportUnusedUrl: {
39+
type: String,
40+
required: true,
41+
},
42+
containers: {
43+
type: Array,
44+
required: true,
45+
},
46+
});
47+
48+
const selectedContainers = ref(props.containers.map((container) => container.handle));
49+
50+
const hasContainers = props.containers.length > 0;
51+
52+
const containerOptions = computed(() => props.containers.map((container) => ({
53+
value: container.handle,
54+
label: container.title,
55+
})));
56+
57+
const exportSelected = () => {
58+
if (!hasContainers) {
59+
return;
60+
}
61+
62+
const query = new URLSearchParams();
63+
selectedContainers.value.forEach((handle) => {
64+
query.append('containers[]', handle);
65+
});
66+
67+
window.location.assign(`${props.exportUrl}?${query.toString()}`);
68+
};
69+
70+
const exportUnused = () => {
71+
if (!hasContainers) {
72+
return;
73+
}
74+
75+
const query = new URLSearchParams();
76+
selectedContainers.value.forEach((handle) => {
77+
query.append('containers[]', handle);
78+
});
79+
80+
window.location.assign(`${props.exportUnusedUrl}?${query.toString()}`);
81+
};
82+
</script>
83+
84+
<template>
85+
<Widget :title="title">
86+
<div class="p-4 flex flex-col gap-4">
87+
<Text>
88+
{{ description }}
89+
</Text>
90+
91+
<div class="space-y-2">
92+
<Text class="font-medium">{{ containersLabel }}</Text>
93+
94+
<Text v-if="!hasContainers">
95+
{{ noContainersMessage }}
96+
</Text>
97+
98+
<template v-else>
99+
<Text>
100+
{{ containersInstructions }}
101+
</Text>
102+
103+
<Select
104+
v-model="selectedContainers"
105+
:options="containerOptions"
106+
multiple
107+
/>
108+
</template>
109+
</div>
110+
111+
<div class="flex flex-col gap-2 pt-1">
112+
<Button
113+
variant="primary"
114+
:disabled="!hasContainers"
115+
@click="exportSelected"
116+
>
117+
{{ exportButtonLabel }}
118+
</Button>
119+
120+
<Button
121+
variant="secondary"
122+
:disabled="!hasContainers"
123+
@click="exportUnused"
124+
>
125+
{{ exportUnusedButtonLabel }}
126+
</Button>
127+
</div>
128+
</div>
129+
</Widget>
130+
</template>

0 commit comments

Comments
 (0)