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

No dropdown for adding collection items if there's just one. #1853

Merged
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions assets/js/app/editor/Components/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>

<div
v-for="element in existingFields"
v-for="element in elements"
:key="element.hash"
class="collection-item"
>
Expand All @@ -37,9 +37,7 @@
</details>
</div>

<small>{{ labels.select_tooltip }}</small>

<div class="dropdown">
<div v-if="templates.length > 1" class="dropdown">
<button
id="dropdownMenuButton"
:disabled="!allowMore"
Expand All @@ -64,6 +62,16 @@
</a>
</div>
</div>
<button
v-else
type="button"
class="btn btn-secondary btn-small"
:data-template="templates[0].label"
@click="addCollectionItem($event)"
>
<i :class="[templates[0].icon, 'fas fa-fw']" />
{{ labels.add_collection_item }}
</button>
</div>
</template>

Expand Down
1 change: 0 additions & 1 deletion templates/_partials/fields/collection.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
'add_collection_item': 'collection.add_item'|trans({'%name%': field.definition.label}),
'expand_all': 'collection.expand_all'|trans,
'collapse_all': 'collection.collapse_all'|trans,
'select_tooltip': 'collection.select_tooltip'|trans,
'field_label': label,
} %}
{% set limit = field.definition.get('limit')|default(200) %}
Expand Down
6 changes: 0 additions & 6 deletions translations/messages.en.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -2361,11 +2361,5 @@
<target>Collapse all</target>
</segment>
</unit>
<unit id="wAltpsD" name="collection.select_tooltip">
<segment>
<source>collection.select_tooltip</source>
<target>Select type of field to add</target>
</segment>
</unit>
</file>
</xliff>