kirby-plugin-custom-add-fields icon indicating copy to clipboard operation
kirby-plugin-custom-add-fields copied to clipboard

Skipping doesn't work

Open nilshoerrmann opened this issue 4 years ago • 6 comments

I'm using this plugin to skip the create page dialog for a specific page type. If I hit the "add page" button, I get his dialog:

grafik

There are no logs in the console.

This is the blueprint:

title: Wochendienste
addFields:
  __dialog:
    skip: true
    forcedTemplate: service
columns:
  primary:
    width: 2/3
    sections:
      published:
        type: pages
        headline: Veröffentlicht
        status: published
  secondary:
    width: 1/3
    sections:
      drafts:
        type: pages
        headline: Entwürfe
        status: draft
        limit: 5

This is what the API responds:

{
    "page": {
        "content": {
            "title": 1584608856
        },
        "slug": 1584608856,
        "template": "service"
    },
    "skipDialog": true
}

While this looks correct, no page is created on disk, no redirect happens.

nilshoerrmann avatar Mar 19 '20 09:03 nilshoerrmann

Sorry for the late reply.

Basically, the properties skip and forcedTemplate control how parent pages/blueprints behave when adding subpages.

Let's say there is a blueprint called service-list and you intend to add pages based on blueprint service and skipping the add dialog. Then these properties have to be set on service-list.

For further assistance: Does the presented blueprint correspond to service.yml? What is the intended hierarchy of the pages/blueprints?

steirico avatar Mar 27 '20 10:03 steirico

Thanks for you feedback!

We've got two blueprints, services (the list view) and service (the page view):

services.yml

title: Wochendienste
addFields:
  title:
    label: Titel
    type: text
    required: false
    icon: title
  __dialog:
    redirect: true
    skip: true
    forcedTemplate: service
columns:
  primary:
    width: 2/3
    sections:
      published:
        type: pages
        headline: Veröffentlicht
        status: published
  secondary:
    width: 1/3
    sections:
      drafts:
        type: pages
        headline: Entwürfe
        status: draft
        limit: 5
        templates: service

service.yml

title: Wochendienst
fields:
  week:
    type: multiselect
    label: Kalenderwoche
    width: 2/3
    max: 1
    options: api
    api:
      url: "{{ kirby.url }}/fetch/weeks"
      fetch: weeks
  family:
    type: pages
    label: Familie
    width: 1/3
    query: site.find('kontakte')

Then these properties have to be set on service-list.

I thought to have done that by setting templates: service on my pages section. Is there another spot I've missed?

nilshoerrmann avatar Mar 27 '20 11:03 nilshoerrmann

Please have a look at v1.3.2 which should solve this issue.

Furthermore, I discovered some other minor issues (#24, #25) which might effect you as well.

steirico avatar Mar 29 '20 08:03 steirico

Thanks I'll check that out next week.

nilshoerrmann avatar Mar 29 '20 12:03 nilshoerrmann

@nilshoerrmann could you check this one?

steirico avatar Sep 23 '20 13:09 steirico

Skipping in general does work now: there is no dialog shown and the page is created directly. I see an error in console though:

{
  "_name": "NavigationDuplicated",
  "name": "NavigationDuplicated",
  "message": "Navigating to current location (\"/pages/begriffe\") is not allowed"
}

nilshoerrmann avatar Sep 23 '20 14:09 nilshoerrmann