Skip to content

Commit

Permalink
Merge branch '5.x' into feature/upload-asset-folders
Browse files Browse the repository at this point in the history
# Conflicts:
#	resources/js/components/assets/Uploader.vue
  • Loading branch information
daun committed Oct 25, 2024
2 parents 121ebbf + 8ebbe61 commit 1292b6b
Show file tree
Hide file tree
Showing 63 changed files with 3,977 additions and 448 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Release Notes

## 5.34.0 (2024-10-24)

### What's new
- Add `password` option to `make:user` command [#11005](https://github.com/statamic/cms/issues/11005) by @joshuablum

### What's fixed
- Fix issues with the Files fieldtype in Dark Mode [#10999](https://github.com/statamic/cms/issues/10999) by @duncanmcclean



## 5.33.1 (2024-10-22)

### What's fixed
- Avoid error when marketplace client returns null [#10996](https://github.com/statamic/cms/issues/10996) by @jasonvarga



## 5.33.0 (2024-10-22)

### What's new
- Improve handling of scheduled entries [#10966](https://github.com/statamic/cms/issues/10966) by @jasonvarga
- Field conditions can be based on other data. Assets can use extension, dimensions, etc. [#10588](https://github.com/statamic/cms/issues/10588) by @daun
- Make email config data accessible in email templates [#10949](https://github.com/statamic/cms/issues/10949) by @Jade-GG
- Autoload event listeners and subscribers [#10911](https://github.com/statamic/cms/issues/10911) by @duncanmcclean
- Make sort modifier work with query builders [#10924](https://github.com/statamic/cms/issues/10924) by @aerni
- Allow sorting folders in asset browser [#10935](https://github.com/statamic/cms/issues/10935) by @duncanmcclean
- Vietnamese translations [#10989](https://github.com/statamic/cms/issues/10989) by @diepdo1810

### What's fixed
- Optimize display of long titles in edit forms [#10988](https://github.com/statamic/cms/issues/10988) by @daun
- Improve the dynamic upload folder help text [#10903](https://github.com/statamic/cms/issues/10903) by @jackmcdade
- Fix z-index issue when configuring Replicator fields [#10937](https://github.com/statamic/cms/issues/10937) by @duncanmcclean
- Avoid showing asset upload fixes when inappropriate [#10986](https://github.com/statamic/cms/issues/10986) by @jasonvarga
- Translate dictionaries [#10982](https://github.com/statamic/cms/issues/10982) by @andjsch
- Duplicate form data when duplicating the form [#10985](https://github.com/statamic/cms/issues/10985) by @ryanmitchell
- Prevent protected pages being cached [#10929](https://github.com/statamic/cms/issues/10929) by @duncanmcclean
- Remove mention of installing addons via CP from addon stub [#10975](https://github.com/statamic/cms/issues/10975) by @duncanmcclean
- French translations [#10977](https://github.com/statamic/cms/issues/10977) by @ebeauchamps



## 5.32.0 (2024-10-18)

### What's new
Expand Down
5 changes: 5 additions & 0 deletions resources/css/core/utilities.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
width: fit-content;
}

.break-overflowing-words {
word-break: break-word;
overflow-wrap: break-word;
}

.saving-overlay {
@apply absolute inset-0 z-200 flex items-center rounded;
background: rgba(255, 255, 255, .9);
Expand Down
2 changes: 2 additions & 0 deletions resources/css/vendors/codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@

.CodeMirror-widget {}

.CodeMirror-rtl pre { direction: ltr; }

.CodeMirror-code {
outline: none;
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/GlobalSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<div v-show="focused && (hasResults || hasFavorites)" class="global-search-results">

<div v-if="hasResults" v-for="(result, index) in results" class="global-search-result-item p-2 flex items-center" :class="{ 'active': current == index }" @click="hit" @mousemove="setActive(index)">
<div v-if="hasResults" v-for="(result, index) in results" class="global-search-result-item break-overflowing-words p-2 flex items-start" :class="{ 'active': current == index }" @click="hit" @mousemove="setActive(index)">
<svg-icon :name="`light/${getResultIcon(result)}`" class="icon"></svg-icon>
<div class="flex-1 rtl:mr-2 ltr:ml-2 title" v-html="result.title"></div>
<span class="global-search-result-badge" v-text="result.badge" />
Expand Down
5 changes: 5 additions & 0 deletions resources/js/components/assets/Editor/Editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
:name="publishContainer"
:blueprint="fieldset"
:values="values"
:extra-values="extraValues"
:meta="meta"
:errors="errors"
@updated="values = { ...$event, focus: values.focus }"
Expand Down Expand Up @@ -204,6 +205,7 @@ import FocalPointEditor from './FocalPointEditor.vue';
import PdfViewer from './PdfViewer.vue';
import PublishFields from '../../publish/Fields.vue';
import HasHiddenFields from '../../publish/HasHiddenFields';
import pick from 'underscore/modules/pick';
export default {
Expand Down Expand Up @@ -245,6 +247,7 @@ export default {
asset: null,
publishContainer: 'asset',
values: {},
extraValues: {},
meta: {},
fields: null,
fieldset: null,
Expand Down Expand Up @@ -347,6 +350,8 @@ export default {
.flatten(true)
.value();
this.extraValues = pick(this.asset, ['filename', 'basename', 'extension', 'path', 'mimeType', 'width', 'height', 'duration']);
this.loading = false;
});
},
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/assets/Upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<div class="ml-4 px-2 flex items-center gap-2" v-if="status === 'error'">
{{ error }}
<dropdown-list v-if="errorStatus === 422">
<dropdown-list v-if="errorStatus === 409">
<template #trigger>
<button class="ml-4 btn btn-xs" v-text="`${__('Fix')}...`" />
</template>
Expand Down
32 changes: 15 additions & 17 deletions resources/js/components/assets/Uploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ export default {
},
container: String,
path: String,
url: { type: String, default: () => cp_url('assets') }
url: { type: String, default: () => cp_url('assets') },
extraData: {
type: Object,
default: () => ({})
}
},
Expand All @@ -44,19 +48,6 @@ export default {
},
computed: {
extraData() {
return {
container: this.container,
folder: this.path,
_token: Statamic.$config.get('csrfToken')
};
}
},
mounted() {
this.$refs.nativeFileField.addEventListener('change', this.addNativeFileFieldSelections);
},
Expand Down Expand Up @@ -220,8 +211,15 @@ export default {
form.append('relativePath', file.relativePath);
}
for (let key in this.extraData) {
form.append(key, this.extraData[key]);
let parameters = {
...this.extraData,
container: this.container,
folder: this.path,
_token: Statamic.$config.get('csrfToken')
}
for (let key in parameters) {
form.append(key, parameters[key]);
}
for (let key in data) {
Expand Down Expand Up @@ -268,7 +266,7 @@ export default {
msg = __('Upload failed. The file might be larger than is allowed by your server.');
}
} else {
if (status === 422) {
if ([422, 409].includes(status)) {
msg = Object.values(response.errors)[0][0]; // Get first validation message.
}
}
Expand Down
10 changes: 5 additions & 5 deletions resources/js/components/entries/PublishForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
<div>
<breadcrumb v-if="breadcrumbs" :url="breadcrumbs[1].url" :title="breadcrumbs[1].text" />

<div class="flex items-center mb-6">
<h1 class="flex-1">
<div class="flex items-center">
<span v-if="! isCreating" class="little-dot rtl:ml-2 ltr:mr-2" :class="activeLocalization.status" v-tooltip="__(activeLocalization.status)" />
<span v-html="$options.filters.striptags(__(title))" />
<div class="flex items-baseline mb-6">
<h1 class="flex-1 self-start rtl:ml-4 ltr:mr-4">
<div class="flex items-baseline">
<span v-if="! isCreating" class="little-dot rtl:ml-2 ltr:mr-2 -top-1" :class="activeLocalization.status" v-tooltip="__(activeLocalization.status)" />
<span class="break-overflowing-words" v-html="$options.filters.striptags(__(title))" />
</div>
</h1>

Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/field-conditions/ValidatorMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default {
}

// Use validation to determine whether field should be shown.
let validator = new Validator(field, this.values, dottedFieldPath, this.$store, this.storeName);
let validator = new Validator(field, {...this.values, ...this.extraValues}, dottedFieldPath, this.$store, this.storeName);
let passes = validator.passesConditions();

// If the field is configured to always save, never omit value.
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/fields/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
v-text="__('Apply')"
></button>
</header>
<section class="py-4 px-3 md:px-8">
<section class="isolate py-4 px-3 md:px-8">
<div class="tabs-container">
<div class="publish-tabs tabs">
<button class="tab-button"
Expand Down
11 changes: 9 additions & 2 deletions resources/js/components/fieldtypes/FilesFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<uploader
ref="uploader"
:url="meta.uploadUrl"
:extra-data="{ config: configParameter }"
:container="config.container"
@updated="uploadsUpdated"
@upload-complete="uploadComplete"
Expand Down Expand Up @@ -37,7 +38,7 @@
<tr
v-for="(file, i) in value"
:key="file"
class="asset-row bg-white hover:bg-gray-100"
class="asset-row bg-white dark:bg-dark-600 hover:bg-gray-100"
>
<td class="flex items-center">
<div
Expand All @@ -53,7 +54,7 @@
<td class="p-0 w-8 rtl:text-left ltr:text-right align-middle">
<button
@click="remove(i)"
class="flex items-center p-2 w-full h-full text-gray-600 hover:text-gray-900"
class="flex items-center p-2 w-full h-full text-gray-600 dark:text-dark-150 hover:text-gray-950 dark:hover:text-dark-100"
>
<svg-icon name="micro/trash" class="w-6 h-6" />
</button>
Expand Down Expand Up @@ -87,6 +88,12 @@ export default {
}
},
computed: {
configParameter() {
return utf8btoa(JSON.stringify(this.config));
},
},
methods: {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div
v-if="hasPendingDynamicFolder"
class="py-3 px-4 text-sm w-full rounded-md border border-dashed text-gray-700 dark:text-dark-175 dark:border-dark-200"
v-html="__('statamic::fieldtypes.assets.dynamic_folder_pending', {field: `<code>${config.dynamic}</code>`})"
v-html="pendingText"
/>

<uploader
Expand Down Expand Up @@ -438,6 +438,12 @@ export default {
return ! this.hasPendingDynamicFolder;
},
pendingText() {
return this.config.dynamic === 'id'
? __('statamic::fieldtypes.assets.dynamic_folder_pending_save')
: __('statamic::fieldtypes.assets.dynamic_folder_pending_field', {field: `<code>${this.config.dynamic}</code>`});
}
},
events: {
Expand Down
6 changes: 6 additions & 0 deletions resources/js/components/publish/Container.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export default {
type: Object,
default: () => {}
},
extraValues: {
type: Object,
default: () => {}
},
meta: {
type: Object,
default: () => {}
Expand Down Expand Up @@ -78,6 +82,7 @@ export default {
const initial = {
blueprint: _.clone(this.blueprint),
values: _.clone(this.values),
extraValues: _.clone(this.extraValues),
meta: _.clone(this.meta),
localizedFields: _.clone(this.localizedFields),
site: this.site,
Expand All @@ -97,6 +102,7 @@ export default {
state: {
blueprint: initial.blueprint,
values: initial.values,
extraValues: initial.extraValues,
hiddenFields: {},
jsonSubmittingFields: [],
revealerFields: [],
Expand Down
4 changes: 4 additions & 0 deletions resources/js/components/publish/Fields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ export default {
return this.state.values;
},
extraValues() {
return this.state.extraValues || {};
},
meta() {
return this.state.meta;
},
Expand Down
10 changes: 5 additions & 5 deletions resources/js/components/terms/PublishForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<div>
<breadcrumb v-if="breadcrumbs" :url="breadcrumbs[1].url" :title="breadcrumbs[1].text" />

<div class="flex items-center mb-6">
<h1 class="flex-1">
<div class="flex items-center">
<div class="flex items-baseline mb-6">
<h1 class="flex-1 self-start rtl:ml-4 ltr:mr-4">
<div class="flex items-baseline">
<span v-if="! isCreating"
class="little-dot rtl:ml-2 ltr:mr-2"
class="little-dot rtl:ml-2 ltr:mr-2 -top-1"
:class="{ 'bg-green-600': published, 'bg-gray-600': !published }" />
<span v-html="$options.filters.striptags(title)" />
<span class="break-overflowing-words" v-html="$options.filters.striptags(title)" />
</div>
</h1>

Expand Down
15 changes: 14 additions & 1 deletion resources/js/tests/FieldConditionsValidator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ const Fields = new Vue({
data() {
return {
storeName: 'base',
values: {}
values: {},
extraValues: {},
}
},
methods: {
Expand All @@ -78,6 +79,9 @@ const Fields = new Vue({
}
Store.commit('publish/base/setValues', storeValues);
},
setExtraValues(values) {
this.extraValues = values;
},
setStoreValues(values) {
Store.commit('publish/base/setValues', values);
},
Expand Down Expand Up @@ -106,6 +110,7 @@ let showFieldIf = function (conditions=null, dottedFieldPath=null) {

afterEach(() => {
Fields.values = {};
Fields.extraValues = {};
Store.commit('publish/base/reset');
});

Expand Down Expand Up @@ -1010,3 +1015,11 @@ test('it properly omits nested revealer-hidden fields when multiple conditions a
// Though this third venue is hidden by a revealer, it's also disabled by a regular toggle condition, so it should actually be omitted...
expect(Store.state.publish.base.hiddenFields['nested.event_venue_three'].omitValue).toBe(true);
});

test('it can use extra values in conditions', () => {
Fields.setValues({});
Fields.setExtraValues({hello: 'world'});

expect(showFieldIf({hello: 'world'})).toBe(true);
expect(showFieldIf({hello: 'there'})).toBe(false);
});
Loading

0 comments on commit 1292b6b

Please sign in to comment.