Giter Site home page Giter Site logo

statamic-accordion-group's Issues

Conditionals not working within accordion group

Thanks for creating this addon. I have used it in a few projects and it works great to keep the editor clean. However, it seems that using conditionals on fields doesn't work within an accordion group.

For example, I have a simple show of two fields when selecting banner_type for color and image. Both fields end up showing within the accordion group when it should only be showing one field depending upon the selection made to banner_type. The same example works fine when loading it via a partial.

Here the example code:

banner_type:
  options:
    color: Color
    image: Image
  type: select
  default: image
  display: Banner Type
banner_color:
  type: colorpicker
  localizable: true
  width: 33
  display: Background Color
  show_when:
    banner_type: color
banner_image:
  container: main
  folder: /
  restrict: false
  type: assets
  localizable: true
  width: 33
  display: Background Image
  max_files: 1
  mode: grid
  show_when:
    banner_type: image

Screenshot of the accordion group:
image

A few improvements

image
Image speaks louder than words.

  • Repeated title and instructions
  • No padding on the fieldset fields

EDIT:
This works flawlessly when it's not in a replicator.
In the screenshot, the accordion_group is added to a replicator.

Fix for Padding

add this to line 91.

    fieldClasses(field) {
      return [
        "form-group",
        "p-2",
        field.type + "-fieldtype",
        tailwind_width_class(field.width),
        field.classes || ""
      ];
    }

Not sure how we can fix the ReplicatorSet generated headers without changing the name for instruction and title.

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.