Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show code widget content if initially hidden #7131

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

hip3r
Copy link
Contributor

@hip3r hip3r commented Mar 1, 2024

Summary

fixes #6812
code widgets now shows content if it's inside list.

Test plan

config.yml

local_backend: true

backend:
  name: proxy
  proxy_url: http://localhost:8082/api/v1
  branch: main

# These lines should *not* be indented
media_folder: "static/img" # Media files will be stored in the repo under static/images/uploads
public_folder: "/img/" # The src attribute for uploaded media will begin with /images/uploads

collections:
  - name: docs
    label: Docs
    label_singular: "Doc"
    folder: "docs"
    path: "{{title}}/{{id}}"
    slug: "{{id}}"
    create: true
    nested: { depth: 100 } # accepts an optional summary template
    allow_nesting: true
    meta: { path: { widget: string, label: "Path", index_file: "index" } }
    fields:
      - { label: "title", name: "title", widget: "string" }
      - {
          name: "code test",
          label: "Example Code",
          widget: "code",
          default_language: "jsx",
          output_code_only: true,
          hint: "Add or choose a file with valid React or MUI code. This will render the preview area of the example. Specify imports as needed in your file.",
        }
      - {
        name: "items",
        label: "Examples",
        widget: "list",
        fields: [
          {
            name: "name",
            label: "Name",
            widget: "string",
            hint: "This is used to label the example in the admin area. It does not show on the website.",
          },
          {
            name: "type",
            label: "Type",
            widget: "select",
            options: [
              {
                label: "Theme Preview",
                value: "",
              },
              {
                label: "Do (Success)",
                value: "success",
              },
              {
                label: "Don't (Error)",
                value: "error",
              },
            ],
          },
          {
            name: "code",
            label: "Example Code",
            widget: "code",
            default_language: "jsx",
            output_code_only: true,
            hint: "Add or choose a file with valid React or MUI code. This will render the preview area of the example. Specify imports as needed in your file.",
          },
          {
            name: "description",
            label: "Description",
            widget: "text",
            hint: "Use this area to provide notes and context about this example. Line breaks and code are not supported and will be removed on save.\n ⚠",
          },
          {
            name: "items inside",
            label: "Examples inside",
            widget: "list",
            fields: [
              {
                name: "name",
                label: "Name",
                widget: "string",
                hint: "This is used to label the example in the admin area. It does not show on the website.",
              },
              {
                name: "type",
                label: "Type",
                widget: "select",
                options: [
                  {
                    label: "Theme Preview",
                    value: "",
                  },
                  {
                    label: "Do (Success)",
                    value: "success",
                  },
                  {
                    label: "Don't (Error)",
                    value: "error",
                  },
                ],
              },
              {
                name: "code",
                label: "Example Code",
                widget: "code",
                default_language: "jsx",
                output_code_only: true,
                hint: "Add or choose a file with valid React or MUI code. This will render the preview area of the example. Specify imports as needed in your file.",
              },
              {
                name: "description",
                label: "Description",
                widget: "text",
                hint: "Use this area to provide notes and context about this example. Line breaks and code are not supported and will be removed on save.\n ⚠",
              },
            ]
          }
        ]
      }

Before:
image

After:
image

Checklist

Please add a x inside each checkbox:

A picture of a cute animal (not mandatory but encouraged)
image

@hip3r hip3r requested a review from a team as a code owner March 1, 2024 18:49
@martinjagodic martinjagodic requested review from demshy and removed request for a team March 5, 2024 11:15
@demshy demshy merged commit b18b51b into decaporg:master Mar 7, 2024
10 checks passed
@demshy demshy deleted the hotfix/code-widget branch March 7, 2024 10:45
hip3r added a commit that referenced this pull request Mar 7, 2024
@hip3r hip3r mentioned this pull request Mar 7, 2024
demshy pushed a commit that referenced this pull request Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code widget inside list widget does not show code until clicked
2 participants