bnomei/kirby3-doctor

make it a panel view not a field

bnomei opened this issue · 3 comments

make it a panel view not a field

Hey, as a quick workaround, here's some minimal code to wrap the field in a panel view.

panel.plugin('me/doctorpanelview', {
  views: {
    doctorview: {
      component: {
        template: `
          <k-view class="doctor-panel-view">
            <k-header>Kirby Doctor</k-header>
            <k-doctor-field label="Doctor" progress="Performing checks..." job="plugin-doctor/check">
          </k-view>
        `
      },
      icon: "bug",
      label: "Doctor"
    }
  }
});

Updated for K3.6 :

// index.js
panel.plugin('me/doctorpanelview', {
  components: {
    'doctor-view': {
      template: `
          <k-inside class="doctor-panel-view">
            <k-view>
            <k-header>
                Kirby Doctor
            </k-header>
            <k-doctor-field label="Doctor" progress="Performing checks..." job="plugin-doctor/check" />
            </k-view>
          </k-inside>
        `
    }
  }
})
// index.php
Kirby::plugin('me/doctorpanelview', [
    'areas' => [
        'doctor' => function ($kirby) {
            return [
                'label' => 'Doctor',
                'icon' => 'bug',
                'breadcrumbLabel' => function () {
                  return 'Doctor - Keep Kirby healthy !';
                },
                'menu' => true,
                'link' => 'doctor',
                'views' => [
                  [
                    'pattern' => 'doctor',
                    'action'  => function () use ($kirby)  {
                      return [
                        'component' => 'doctor-view',
                        'title' => 'Kirby Doctor'
                      ];
                    }
                  ]
                ]
            ];
        },
    ],
]);

@Daandelange wow. i will give it a try asap. thanks for your contribution