Skip to content

Commit

Permalink
Merge branch 'main' into feature-user-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
boutell authored Aug 2, 2023
2 parents 00dc99a + dcbd893 commit 86708bd
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ for piece and page types, allowing "virtual piece types" on the back end that
deal with many content types to give better hints to the UI.
* Respect the `_aposAutopublish` property of a document if present, otherwise
fall back to module configuration.

* For convenience in custom editor components, pass the new prop `type`, the original type of the document being copied or edited.
* For better results in custom editor components, pass the prop `copyOfId`, which implies
the custom editor should fetch the original itself by its means of choice.
Expand All @@ -35,6 +34,7 @@ to props of their choosing.
* Adds support for admin UI language configuration in the `@apostrophecms/i18n` module. The new options allow control over the default admin UI language and configures the list of languages, that any individual logged in user can choose from. See the [documentation](https://v3.docs.apostrophecms.org/reference/modules/i18n.html) for more details.
* Adds `adminLocale` User field to allow users to set their preferred admin UI language, but only when the `@apostrophecms/i18n` is configured accordingly (see above).
* Adds `@apostrophecms/settings` module and a "Personal Settings" feature. See the [documentation](https://v3.docs.apostrophecms.org/reference/modules/settings.html) for more details.
* Adds `$and` operator on `addContextOperation` `if` property in order to check multiple fields before showing or hiding a context operation.

### Fixes

Expand Down
10 changes: 10 additions & 0 deletions lib/check-if-conditions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export default function checkIfConditions(doc, conditions) {
return checkOrConditions(doc, value);
}

if (key === '$and') {
return checkAndConditions(doc, value);
}

const isNotEqualCondition = typeof value === 'object' &&
!Array.isArray(value) &&
value !== null &&
Expand All @@ -24,6 +28,12 @@ function checkOrConditions(doc, conditions) {
});
}

function checkAndConditions(doc, conditions) {
return conditions.every((condition) => {
return checkIfConditions(doc, condition);
});
}

function getNestedPropValue(doc, key) {
if (key.includes('.')) {
const keys = key.split('.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,6 @@ export default {
};
}
},
currentFields() {
if (this.currentTab) {
const tabFields = this.tabs.find((item) => {
return item.name === this.currentTab;
});
return this.filterOutParkedFields(tabFields.fields);
} else {
return [];
}
},
saveLabel() {
if (this.restoreOnly) {
return 'apostrophe:restore';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
class="apos-modal-tabs__tab"
v-for="tab in tabs"
:key="tab.name"
v-show="tab.isVisible"
v-show="tab.isVisible !== false"
>
<button
:id="tab.name" class="apos-modal-tabs__btn"
:aria-selected="tab.name === currentTab ? true : false"
:aria-selected="tab.name === current ? true : false"
@click="selectTab"
>
{{ $t(tab.label) }}
Expand Down Expand Up @@ -43,9 +43,6 @@ export default {
},
emits: [ 'select-tab' ],
computed: {
currentTab() {
return this.current || this.tabs.find(tab => tab.isVisible).name;
},
tabErrors() {
const errors = {};
for (const key in this.errors) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default {
return tabs;
},
firstVisibleTabName() {
const { name = null } = this.tabs.find(tab => tab.isVisible === true) || {};
const { name = null } = this.tabs.find(tab => tab.isVisible === true) || this.tabs[0] || {};

return name;
}
Expand Down

0 comments on commit 86708bd

Please sign in to comment.