nova-tabs icon indicating copy to clipboard operation
nova-tabs copied to clipboard

Hide toolbar on relation

Open aqjw opened this issue 2 years ago • 4 comments

Is it possible to hide the toolbar for relation? and how to get rid of the panel border?

Screenshot 2022-06-26 at 20 05 05

Code:

Tabs::make('Product', [
    Tab::make('General', [
       ...
    ]),

    Tab::make('Details', [
        HasOne::make('Details'),
    ]),

    Tab::make('Images', [
        ...
    ]),
])->withToolbar(),

But if I do like this, nothing changes except the order of the tabs:

Tabs::make('Product', [
    Tab::make('General', [
       ...
    ]),

    HasOne::make('Details'),

    Tab::make('Images', [
        ...
    ]),
])->withToolbar(),

aqjw avatar Jun 26 '22 17:06 aqjw

How did you get a toolbar on a relation? I can't get it done on my end.

marcfil avatar Jun 28 '22 13:06 marcfil

The toolbar seems to show as part of the HasOne relationship. Can't see it in the other relationships of various types for the same Resource I'm currently viewing. I haven't used any morph-type relationships, though. So one equivalent to HasOne could also have the issue.

Regarding the border - HasOne relationships are displayed as individual Resources. So, effectively it's showing the pane from the HasOne Resource detail page.

This also applies to relationships like HasOne::ofMany(), as those are also HasOne relationships.

Edit: Added screenshots as demonstration of a HasMany vs HasOne::ofMany() for the same related Resource. Apologies for all the blanks. They are screenshots from an internal system under NDA.

HasOne::ofMany() ScreenShot 2022-07-03 at 19 33 03
HasMany ScreenShot 2022-07-03 at 19 32 38

juse-less avatar Jul 03 '22 17:07 juse-less

The toolbar seems to show as part of the HasOne relationship.

Can't see it in the other relationships of various types for the same Resource I'm currently viewing.

I haven't used any morph-type relationships, though. So one equivalent to HasOne could also have the issue.

Regarding the border -

HasOne relationships are displayed as individual Resources. So, effectively it's showing the pane from the HasOne Resource detail page.

This also applies to relationships like HasOne::ofMany(), as those are also HasOne relationships.

Edit: Added screenshots as demonstration of a HasMany vs HasOne::ofMany() for the same related Resource.

Apologies for all the blanks. They are screenshots from an internal system under NDA.

<summary>HasOne::ofMany()</summary>
ScreenShot 2022-07-03 at 19 33 03
<summary>HasMany</summary>
ScreenShot 2022-07-03 at 19 32 38

Isn't that because you then specified the toolbar should show up on the related resource?

marcfil avatar Jul 06 '22 15:07 marcfil

That's correct. If we remove the toolbar from the related resource, it's not visible as part of the HasOne field. But in that case, the toolbar will also be missing from the detail view of the related resource, as that's really what the HasOne relationship shows.

This may or may not be an issue, depending on peoples use-case. Sometimes people may want to show the toolbar with the relationships Actions, and sometimes not (but still be available on its detail page). A bit tricky. Thought I'd try posting what I could, in an attempt to help, though.

Edit: Tried clarifying a bit.

juse-less avatar Jul 06 '22 15:07 juse-less