Code Monkey home page Code Monkey logo

Comments (7)

milewski avatar milewski commented on May 29, 2024

Hi, see this issue: #15 (comment)

from collapsible-resource-manager.

goldmerc avatar goldmerc commented on May 29, 2024

The solution works but I notice that I have to set the params for the sidebar link to appear. So, if my tool doesn't use params, I have to set an empty array for the link to display.

from collapsible-resource-manager.

NowakAdmin avatar NowakAdmin commented on May 29, 2024

I can;t handle to display custom tool inside RawResource, where i should put in my example
" new \Czemu\NovaCalendarTool\NovaCalendarTool " ?

RawResource::make([
        'badge' => null,
        'icon' => null,
        'target' => '_self',
        'path' => null,
        'params' => [ new \Czemu\NovaCalendarTool\NovaCalendarTool ],
        'query' => [ 'foo' => 'bar' ],
         'label' => 'NovaCalendarTool',
         'name' => 'NovaCalendarTool',
])

or

RawResource::make([
                        'badge' => null,
                        'icon' => null,
                        'target' => '_self',
                        'path' => new \Czemu\NovaCalendarTool\NovaCalendarTool,
                        'params' => [],
                        'query' => [],
                        'label' => 'NovaCalendarTool',
                        'name' => 'NovaCalendarTool',
                    ]),

not working

from collapsible-resource-manager.

milewski avatar milewski commented on May 29, 2024

You shouldn't be putting new \Czemu\NovaCalendarTool\NovaCalendarTool on the path.. you need to manually set that path your custom tool has registered on the .vue files.. for example:

'path' => /resources/my-custom-tool

from collapsible-resource-manager.

NowakAdmin avatar NowakAdmin commented on May 29, 2024

I found the way it works so i will share it here.
In file below i found proper name and path
\vendor\czemu\nova-calendar-tool\resources\js\tool.js

Nova.booting((Vue, router, store) => {
  router.addRoutes([
    {
      name: 'nova-calendar-tool',
      path: '/nova-calendar-tool',
      component: require('./components/Tool'),
    },
  ]);
})

Then i adapt code like this:

TopLevelResource::make([
     'resources' => [
            RawResource::make([
            'badge' => null,
            'icon' => null,
            'target' => '_self',
            'path' => '/nova-calendar-tool', // from tool.js
            'params' => [],
            'query' => [],
            'label' => 'Any label',
            'name' => 'nova-calendar-tool', // from tool.js
            ]),
    ],
]),

And it works :-)

from collapsible-resource-manager.

rgdigital avatar rgdigital commented on May 29, 2024

@NowakAdmin

This is fine if the tool is instantiated, but then $tool->renderNavigation() is still called in views/layout.blade.php, so there are double links. But if I don't instantiate the tool then the routing isn't added by the .vue file, so it doesn't work.

So if I want to move a tool into a specific resource group but leave the others, then I could just disable the renderNavigation method. But that means overriding the default template so the whole menu needs to be created via tools().

Did you find a way around this?

from collapsible-resource-manager.

rgdigital avatar rgdigital commented on May 29, 2024

Got the answer from this thread.

Override the renderNavigation method in the tool by extending the class:

return [
    new class extends YourTool1 { public function renderNavigation(): string { return ''; } },
]

from collapsible-resource-manager.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.