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

Display nested modules (children) on the dashboard #1697

Open
AndreSchwarzer opened this issue Jun 15, 2022 · 0 comments · May be fixed by #2547
Open

Display nested modules (children) on the dashboard #1697

AndreSchwarzer opened this issue Jun 15, 2022 · 0 comments · May be fixed by #2547
Assignees
Labels
type: enhancement New feature or request

Comments

@AndreSchwarzer
Copy link
Contributor

Summary

I've followed the setup instructions of nested-modules: parent-child-modules.

Let's stick with issues and articles, which are children of issues.

I was able to add issues to the dashboard as described in the docs under config/twill.php dashboard.modules.

<?php
// config/twill.php
return [
    'dashboard' => [
        'modules' => [
            \App\Models\Issue::class => [
                'name' => 'issues',
                'label' => 'Issues',
                'label_singular' => 'Issue',
                'count' => true,
                'create' => true,
                'activity' => true,
                'draft' => true,
                'search' => true,
                'search_fields' => ['title', 'description'],
            ],
        ]
    ]
]

Success for parent

The problem occurs when trying to add the child module in the same way.

<?php
// config/twill.php
return [
    'dashboard' => [
        'modules' => [
            \App\Models\Issue::class => [
                'name' => 'issues',
                'label' => 'Issues',
                'label_singular' => 'Issue',
                'count' => true,
                'create' => true,
                'activity' => true,
                'draft' => true,
                'search' => true,
                'search_fields' => ['title', 'description'],
            ],
            \App\Models\ IssueArticle::class => [
                'name' => 'issues.articles',
                'label' => 'Articles',
                'label_singular' => 'Article',
                'count' => true,
                'create' => true,
                'activity' => true,
                'draft' => true,
                'search' => true,
                'search_fields' => ['title', 'description'],
            ],
        ]
    ]
]

Error for Children

Describe the solution you'd like

I'd like the declaration for these child modules to be similar to their parents.

Since they are depending on their parents and therefore need extra handling a 'nested' filed in the parents declaration would also work and may even improve the readability of the config.

Additional context

Discord Discussion

In case the thread disappears:

@AndreSchwarzer
I've added the parent to the dashboard

but it seems \A17\Twill\Http\Controllers\Admin\DashboardController can't handle nested modules. Is there a way to make them search and displayable for the dashboard ?

@ifox
ha, well for the count option the link wouldn't know where to go as you can't browse all the children in a single screen (unless you've set it up that way, definitely possible with some custom code). For search and activities, we should be able to make that work. Right now you'd need to create some sort of virtual module on top of your child one to make it work it but honestly don't bother with that, create an issue about supporting nested modules in the dashboard and we'll get to it
for the count we could still support it without a link

@AndreSchwarzer
I'll open an issue and skip it for now
thanks

@ifox ifox added the type: enhancement New feature or request label Feb 9, 2024
@zeezo887 zeezo887 self-assigned this Mar 18, 2024
@zeezo887 zeezo887 linked a pull request Mar 18, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

3 participants