Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Commit

Permalink
Show actions when they are standalone or when a resource is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianmihaila committed Sep 8, 2022
1 parent e5def79 commit 795942b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dist/js/tool.js

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions resources/js/components/DetailActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
@dropdown-link-click="handleClick"
></invisible-actions>

<action-button
class="mr-3"
v-for="action in visibleActions"
:key="action.uriKey"
:action="action"
@action-button-clicked="handleClick"
></action-button>
<template v-for="action in visibleActions">
<action-button
class="mr-3"
v-if="shouldShowActions || action.standalone"
:key="action.uriKey"
:action="action"
@action-button-clicked="handleClick"
></action-button>
</template>

<!-- Confirm Action Modal -->
<component
Expand Down Expand Up @@ -48,7 +50,7 @@ import DetachedAction from "../mixins/DetachedAction";
export default {
mixins: [DetachedAction],
props: ['resourceId', 'resourceName'],
props: ['shouldShowActions', 'resourceId', 'resourceName'],
methods: {
handleResponse(response) {
this.actionsList = _.filter(
Expand Down
18 changes: 10 additions & 8 deletions resources/js/components/IndexActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@
@dropdown-link-click="handleClick"
></invisible-actions>

<action-button
class="mr-3"
v-for="action in visibleActions"
:key="action.uriKey"
:action="action"
@action-button-clicked="handleClick"
></action-button>
<template v-for="action in visibleActions">
<action-button
class="mr-3"
v-if="shouldShowActions || action.standalone"
:key="action.uriKey"
:action="action"
@action-button-clicked="handleClick"
></action-button>
</template>

<!-- Confirm Action Modal -->
<component
Expand Down Expand Up @@ -49,7 +51,7 @@ export default {
components: { ActionLink },
mixins: [DetachedAction],
props: ['resourceName', 'selectedResources'],
props: ['shouldShowActions', 'resourceName', 'selectedResources'],
methods: {
handleResponse(response) {
this.actionsList = _.filter(
Expand Down
1 change: 1 addition & 0 deletions resources/js/nova-components/ResourceDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

<div class="ml-auto flex items-center">
<DetailActions
:should-show-actions="shouldShowActionSelector"
:resource-id="resource.id.value"
:resource-name="resourceName"
@actionExecuted="getResources"
Expand Down
1 change: 1 addition & 0 deletions resources/js/nova-components/ResourceTableToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<!-- Toolbar Items -->
<div class="h-9 ml-auto flex items-center pr-2 md:pr-3">
<IndexActions
:should-show-actions="shouldShowActionSelector"
:resource-name="resourceName"
:selected-resources="selectedResourcesForActionSelector"
@actionExecuted="getResources"
Expand Down

0 comments on commit 795942b

Please sign in to comment.