sylvainjule / kirby-locator

A simple map & geolocation field, built on top of open-source services and Mapbox. Kirby 3 and 4.
97 stars 14 forks source link

Field preview for structure fields #32

Closed gerricom closed 3 years ago

gerricom commented 4 years ago

I'm using your locator plugin within a structure field. With the current versions Kirby will only output .... I added a little field preview for structure fields.

You can customize the column view with some additional YAML in the kirby blueprint. E.g. this outputs country, city and street (in this order):

locations:
  label: My wonderful locations

  type: structure

  columns:
    name:
      width: 1/2
    location:
      width: 1/2
      fields:
        - country
        - city
        - street

  fields:
    name:
      label: Name
      type: text

    location:
      label: Location (on map)
      type: locator

The default values (city and country) are atm hardcoded.

My JS/VueJS skills aren't that good. Maybe somebody likes to tweak my code a bit.

jamiehunterdesign commented 3 years ago

Thank you for this, saved me a job!

sylvainjule commented 3 years ago

Thank you! Actually I had one done but it was under the kirby-previews plugin, which doesn't make many sense...

I'll include it directly in the plugin!