Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate default_state for collection in favour of variant #1988

Merged
merged 1 commit into from
Oct 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions assets/js/app/editor/Components/Collection.vue
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
</div>

<div v-for="element in elements" :key="element.hash" class="collection-item">
<details :open="state === 'expanded'" class="card">
<details :open="variant === 'expanded'" class="card">
<summary class="d-block">
<div class="card-header d-flex align-items-center">
<!-- Initial title. This is replaced by dynamic title in JS below. -->
@@ -105,7 +105,7 @@ export default {
type: Number,
required: true,
},
state: {
variant: {
type: String,
required: true,
},
2 changes: 1 addition & 1 deletion config/bolt/contenttypes.yaml
Original file line number Diff line number Diff line change
@@ -266,7 +266,7 @@ showcases:
type: collection
group: Collections
label: This is my Collection
default_state: expanded
variant: expanded
fields:
set:
type: set
6 changes: 5 additions & 1 deletion templates/_partials/fields/collection.html.twig
Original file line number Diff line number Diff line change
@@ -20,13 +20,17 @@
{% set templated_fields %}{{ macro.generate_collection_fields(field, field.templates, record, true) }}{% endset %}
{% endif %}

{% if variant == 'normal' %}
{% set variant = field.definition.get('default_state')|default('collapsed') %}
{% endif %}

<editor-collection
:existing-fields='{{ existing_fields }}'
:templates='{{ templated_fields }}'
:labels='{{ labels | json_encode }}'
:limit='{{ limit | json_encode }}'
:name="{{ field.name | json_encode }}"
:state="{{ field.definition.get('default_state')|default('collapsed')|json_encode }}"
:variant="{{ variant|json_encode }}"
></editor-collection>

{% endblock %}