You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is "BelongsToMany" relationship between the Product and Company Resource classes. The problem is that It shows me 2 edit button for "Companies Index component" on "Product detail" page like in screenshot below:
I inspected the elements:
Both of the buttons have the same link but their dusk attribute values are different:
dusk="700000004-edit-attached-button"
dusk="700000004-edit-button"
I also inspected vue component by searching "edit--attached-button" and "-edit-button" in laravel/nova vendor directory and I found it in vendor/laravel/nova/resources/js/components/ResourceTableRow.vue file:
<!-- Edit Pivot Button -->
<Button
v-if="authorizedToUpdateAnyResources && viaManyToMany"
:as="resource.authorizedToUpdate ? 'Link' : 'Button'"
v-tooltip.click="__('Edit Attached')"
:aria-label="__('Edit Attached')"
:dusk="`${resource['id'].value}-edit-attached-button`"
@click.stop="navigateToEditView"
icon="pencil-square"
variant="action"
:class="
resource.authorizedToUpdate
? 'hover:text-primary-500 dark:hover:text-primary-500'
: null
"
:disabled="!resource.authorizedToUpdate"
/>
<!-- Edit Resource Link -->
<Button
v-if="authorizedToUpdateAnyResources" <!-- todo: I guess its because there is a missing condition? like !viaManyToMany -->
:as="resource.authorizedToUpdate ? 'Link' : 'Button'"
v-tooltip.click="__('Edit')"
:aria-label="__('Edit')"
:dusk="`${resource['id'].value}-edit-button`"
@click.stop="navigateToEditView"
icon="pencil-square"
variant="action"
:class="
resource.authorizedToUpdate
? 'hover:text-primary-500 dark:hover:text-primary-500'
: null
"
:disabled="!resource.authorizedToUpdate"
/>
Isn't the if condition also has to have !viaManyToManycondition for "Edit Resource Link"? Could this be the reason why two icons appear?
Description:
I have 2 resources:
app/Nova/Product.php
app/Nova/Company.php
There is "BelongsToMany" relationship between the Product and Company Resource classes. The problem is that It shows me 2 edit button for "Companies Index component" on "Product detail" page like in screenshot below:
I inspected the elements:
Both of the buttons have the same link but their dusk attribute values are different:
I also inspected vue component by searching "edit--attached-button" and "-edit-button" in laravel/nova vendor directory and I found it in
vendor/laravel/nova/resources/js/components/ResourceTableRow.vue
file:<!-- Edit Pivot Button --> <Button v-if="authorizedToUpdateAnyResources && viaManyToMany" :as="resource.authorizedToUpdate ? 'Link' : 'Button'" v-tooltip.click="__('Edit Attached')" :aria-label="__('Edit Attached')" :dusk="`${resource['id'].value}-edit-attached-button`" @click.stop="navigateToEditView" icon="pencil-square" variant="action" :class=" resource.authorizedToUpdate ? 'hover:text-primary-500 dark:hover:text-primary-500' : null " :disabled="!resource.authorizedToUpdate" /> <!-- Edit Resource Link --> <Button v-if="authorizedToUpdateAnyResources" <!-- todo: I guess its because there is a missing condition? like !viaManyToMany --> :as="resource.authorizedToUpdate ? 'Link' : 'Button'" v-tooltip.click="__('Edit')" :aria-label="__('Edit')" :dusk="`${resource['id'].value}-edit-button`" @click.stop="navigateToEditView" icon="pencil-square" variant="action" :class=" resource.authorizedToUpdate ? 'hover:text-primary-500 dark:hover:text-primary-500' : null " :disabled="!resource.authorizedToUpdate" />
Isn't the if condition also has to have
!viaManyToMany
condition for "Edit Resource Link"? Could this be the reason why two icons appear?Extra Information
app/Models/Product.php:
app/Models/CompanyProduct.php:
app/Models/Company.php
Detailed steps to reproduce the issue on a fresh Nova installation:
The text was updated successfully, but these errors were encountered: