diff --git a/.editorconfig b/.editorconfig index 8a5381d..f8ae1e5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -24,7 +24,7 @@ indent_style = space # 4 space indentation indent_size = 4 -[*.{html,dtml,pt,zpt,xml,zcml,js,json,ts,less,css,sass,scss,yml,yaml}] +[*.{html,dtml,pt,zpt,xml,zcml,js,json,ts,less,scss,css,sass,yml,yaml}] # 2 space indentation indent_size = 2 diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index d5754f8..840ca16 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -2,86 +2,91 @@ name: Backend CI on: workflow_call: - workflow_dispatch: - -env: - IMAGE_NAME_PREFIX: ghcr.io/collective/volto-form-block - IMAGE_NAME_SUFFIX: backend - PYTHON_VERSION: "3.11" - -defaults: - run: - working-directory: ./backend + inputs: + base-tag: + required: true + type: string + image-name-prefix: + required: true + type: string + image-name-suffix: + required: true + type: string + python-version: + required: true + type: string + plone-version: + required: true + type: string + working-directory: + required: false + type: string + default: backend jobs: - config: - runs-on: ubuntu-latest - outputs: - BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }} - PLONE_VERSION: ${{ steps.vars.outputs.PLONE_VERSION }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set Env Vars - id: vars - run: | - echo "PLONE_VERSION=$(cat version.txt)" >> $GITHUB_OUTPUT - echo 'BASE_TAG=sha-'$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT - - - name: Test vars - run: | - echo 'BASE_TAG=${{ steps.vars.outputs.BASE_TAG }}' - echo 'PLONE_VERSION=${{ steps.vars.outputs.PLONE_VERSION }}' - - code-quality: + lint: + name: "Backend: Lint" + uses: plone/meta/.github/workflows/backend-lint.yml@2.x + with: + python-version: ${{ inputs.python-version }} + plone-version: ${{ inputs.plone-version }} + working-directory: ${{ inputs.working-directory }} + + test: + name: "Backend: Test" + uses: plone/meta/.github/workflows/backend-pytest.yml@2.x + with: + python-version: ${{ inputs.python-version }} + plone-version: ${{ inputs.plone-version }} + working-directory: ${{ inputs.working-directory }} + + coverage: + name: "Backend: Coverage" + uses: plone/meta/.github/workflows/backend-pytest-coverage.yml@2.x + with: + python-version: ${{ inputs.python-version }} + plone-version: ${{ inputs.plone-version }} + working-directory: ${{ inputs.working-directory }} + + release: + name: "Backend: Build and publish Container Image" + uses: plone/meta/.github/workflows/container-image-build-push.yml@2.x + needs: + - lint + - test + - coverage + permissions: + contents: read + packages: write + with: + base-tag: ${{ inputs.base-tag }} + image-name-prefix: ${{ inputs.image-name-prefix }} + image-name-suffix: ${{ inputs.image-name-suffix }} + working-directory: ${{ inputs.working-directory }} + build-args: | + PLONE_VERSION=${{ inputs.plone-version }} + push: ${{ github.event_name != 'pull_request' }} + secrets: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + report: + name: "Final report" + if: ${{ always() }} runs-on: ubuntu-latest needs: - - config + - lint + - test + - coverage + - release steps: - - name: Checkout codebase - uses: actions/checkout@v4 - - - name: Install hatch - run: pipx install hatch - - - name: Generate Constraints file - run: pipx run mxdev -c mx.ini - - - uses: actions/setup-python@v5 - with: - python-version: ${{ env.PYTHON_VERSION }} - cache: 'pip' - - - name: "Install Environment" - run: hatch env create - - - name: "Run checks" - run: hatch run lint - - # test: - # runs-on: ubuntu-latest - # needs: - # - config - # steps: - # - name: Checkout codebase - # uses: actions/checkout@v4 - - # - name: Install hatch - # run: pipx install hatch - - # - name: Generate Constraints file - # run: pipx run mxdev -c mx.ini - - # - uses: actions/setup-python@v5 - # with: - # python-version: ${{ env.PYTHON_VERSION }} - # cache: 'pip' - - # - name: "Install Environment" - # run: hatch env create - - # - name: "Test Codebase" - # run: hatch run test - + - name: Write report + run: | + echo '# Backend Workflow Report' >> $GITHUB_STEP_SUMMARY + echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY + echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY + echo '| lint | ${{ needs.lint.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| test | ${{ needs.test.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| coverage | ${{ needs.coverage.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| release | ${{ needs.release.result }} |' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/config.yml b/.github/workflows/config.yml new file mode 100644 index 0000000..80b3cff --- /dev/null +++ b/.github/workflows/config.yml @@ -0,0 +1,152 @@ +name: "Compute Config variables" + +on: + workflow_call: + inputs: + node-version: + required: false + type: string + default: "22" + python-version: + required: false + type: string + default: "3.12" + stack-name: + required: false + type: string + default: "project-example-com" + environment: + required: false + type: string + default: "project.example.com" + outputs: + acceptance: + description: "Flag reporting if we should run the acceptance jobs" + value: ${{ jobs.config.outputs.acceptance }} + backend: + description: "Flag reporting if we should run the backend jobs" + value: ${{ jobs.config.outputs.backend }} + devops: + description: "Flag reporting if we should run the devops jobs" + value: ${{ jobs.config.outputs.devops }} + docs: + description: "Flag reporting if we should run the docs jobs" + value: ${{ jobs.config.outputs.docs }} + frontend: + description: "Flag reporting if we should run the frontend jobs" + value: ${{ jobs.config.outputs.frontend }} + varnish: + description: "Flag reporting if we should run the varnish jobs" + value: ${{ jobs.config.outputs.varnish }} + base-tag: + description: "Base tag to be used when creating container images" + value: ${{ jobs.config.outputs.base-tag }} + event-name: + description: "Event name triggering the workflow" + value: ${{ github.event_name }} + image-name-prefix: + description: "Image name prefix for container images" + value: ${{ jobs.config.outputs.image-name-prefix }} + stack-name: + description: "Stack name for the deployment" + value: ${{ inputs.stack-name }} + environment: + description: "Environment to be used for the deployment" + value: ${{ inputs.environment }} + node-version: + description: "Node version to be used" + value: ${{ inputs.node-version }} + python-version: + description: "Python version to be used" + value: ${{ inputs.python-version }} + plone-version: + description: "Plone version to be used" + value: ${{ jobs.config.outputs.plone-version }} + volto-version: + description: "Volto version to be used" + value: ${{ jobs.config.outputs.volto-version }} + +jobs: + config: + runs-on: ubuntu-latest + outputs: + acceptance: ${{ steps.filter.outputs.acceptance }} + backend: ${{ steps.filter.outputs.backend }} + devops: ${{ steps.filter.outputs.devops }} + docs: ${{ steps.filter.outputs.docs }} + frontend: ${{ steps.filter.outputs.frontend }} + varnish: ${{ steps.filter.outputs.varnish }} + base-tag: ${{ steps.vars.outputs.base-tag }} + plone-version: ${{ steps.vars.outputs.plone-version }} + volto-version: ${{ steps.vars.outputs.volto-version }} + image-name-prefix: ${{ steps.vars.outputs.image-name-prefix }} + + steps: + + - name: Checkout + uses: actions/checkout@v5 + + - name: Setup uv + uses: plone/meta/.github/actions/setup_uv@2.x + with: + python-version: ${{ inputs.python-version }} + working-directory: '.' + + - name: Compute several vars needed for the CI + id: vars + shell: bash + run: | + REPOSITORY_SETTINGS="$(uvx repoplone settings dump)" + echo "image-name-prefix=$(jq -r '.container_images_prefix' <<< "$REPOSITORY_SETTINGS")" >> "$GITHUB_OUTPUT" + echo "plone-version=$(jq -r '.backend.base_package_version' <<< "$REPOSITORY_SETTINGS")" >> "$GITHUB_OUTPUT" + echo "volto-version=$(jq -r '.frontend.volto_version' <<< "$REPOSITORY_SETTINGS")" >> "$GITHUB_OUTPUT" + echo "base-tag=sha-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + + - name: Filter paths + uses: dorny/paths-filter@v3.0.2 + id: filter + with: + filters: | + acceptance: + - '.github/workflows/backend*' + - '.github/workflows/frontend*' + - '.github/workflows/config*' + - 'backend/**' + - 'frontend/**' + backend: + - 'backend/**' + - '.github/workflows/backend*' + - '.github/workflows/config*' + devops: + - 'devops/**' + - '.github/workflows/config*' + docs: + - '.readthedocs.yaml' + - 'docs/**' + - '.github/workflows/docs.yaml' + - '.github/workflows/config*' + frontend: + - 'frontend/**' + - '.github/workflows/frontend*' + - '.github/workflows/config*' + varnish: + - 'devops/varnish/**' + - '.github/workflows/varnish*' + - '.github/workflows/config*' + + - name: Test vars + run: | + echo '# Config Settings' >> $GITHUB_STEP_SUMMARY + echo '| Variable | Value |' >> $GITHUB_STEP_SUMMARY + echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY + echo "| base-tag | ${{ steps.vars.outputs.base-tag }} |" >> $GITHUB_STEP_SUMMARY + echo "| plone-version | ${{ steps.vars.outputs.plone-version }} |" >> $GITHUB_STEP_SUMMARY + echo "| volto-version | ${{ steps.vars.outputs.volto-version }} |" >> $GITHUB_STEP_SUMMARY + echo "| image-name-prefix | ${{ steps.vars.outputs.image-name-prefix }} |" >> $GITHUB_STEP_SUMMARY + echo "| event-name | ${{ github.event_name }} |" >> $GITHUB_STEP_SUMMARY + echo "| acceptance | ${{ steps.filter.outputs.acceptance }} |" >> $GITHUB_STEP_SUMMARY + echo "| backend | ${{ steps.filter.outputs.backend }} |" >> $GITHUB_STEP_SUMMARY + echo "| devops | ${{ steps.filter.outputs.devops }} |" >> $GITHUB_STEP_SUMMARY + echo "| docs | ${{ steps.filter.outputs.docs }} |" >> $GITHUB_STEP_SUMMARY + echo "| frontend | ${{ steps.filter.outputs.frontend }} |" >> $GITHUB_STEP_SUMMARY + echo "| varnish | ${{ steps.filter.outputs.varnish }} |" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml index eb09d5b..9f50624 100644 --- a/.github/workflows/frontend.yml +++ b/.github/workflows/frontend.yml @@ -2,88 +2,87 @@ name: Frontend CI on: workflow_call: - workflow_dispatch: - -env: - IMAGE_NAME_PREFIX: ghcr.io/collective/volto-form-block - IMAGE_NAME_SUFFIX: frontend - NODE_VERSION: 20.x - -defaults: - run: - working-directory: ./frontend + inputs: + base-tag: + required: true + type: string + image-name-prefix: + required: true + type: string + image-name-suffix: + required: true + type: string + node-version: + required: true + type: string + volto-version: + required: true + type: string + working-directory: + required: false + type: string + default: frontend jobs: - meta: - runs-on: ubuntu-latest - outputs: - BASE_TAG: ${{ steps.vars.outputs.BASE_TAG }} - VOLTO_VERSION: ${{ steps.vars.outputs.VOLTO_VERSION }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Compute several vars needed for the build - id: vars - run: | - echo 'BASE_TAG=sha-$(git rev-parse --short HEAD)' >> $GITHUB_OUTPUT - python3 -c 'import json; data = json.load(open("./mrs.developer.json")); print("VOLTO_VERSION=" + data["core"].get("tag") or data["core"].get("branch") or "latest")' >> $GITHUB_OUTPUT - - name: Test vars - run: | - echo 'BASE_TAG=${{ steps.vars.outputs.BASE_TAG }}' - echo 'VOLTO_VERSION=${{ steps.vars.outputs.VOLTO_VERSION }}' - code-analysis: - runs-on: ubuntu-latest - steps: - - name: Checkout codebase - uses: actions/checkout@v4 + name: "Frontend: Codeanalysis" + uses: plone/meta/.github/workflows/frontend-code.yml@2.x + with: + node-version: ${{ inputs.node-version }} + working-directory: ${{ inputs.working-directory }} - - name: Use Node.js ${{ env.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} + i18n: + name: "Frontend: i18n" + uses: plone/meta/.github/workflows/frontend-i18n.yml@2.x + with: + node-version: ${{ inputs.node-version }} + working-directory: ${{ inputs.working-directory }} - - name: Enable corepack - run: corepack enable + unit: + name: "Frontend: Unit tests" + uses: plone/meta/.github/workflows/frontend-unit.yml@2.x + with: + node-version: ${{ inputs.node-version }} + working-directory: ${{ inputs.working-directory }} - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: make install - - - name: Linting - id: lint - if: ${{ success() || failure() }} - run: make lint - - - name: i18n sync - id: i18n - if: ${{ success() || failure() }} - run: make ci-i18n + release: + name: "Frontend: Build and publish container image" + uses: plone/meta/.github/workflows/container-image-build-push.yml@2.x + needs: + - code-analysis + - i18n + - unit + permissions: + contents: read + packages: write + with: + base-tag: ${{ inputs.base-tag }} + image-name-prefix: ${{ inputs.image-name-prefix }} + image-name-suffix: ${{ inputs.image-name-suffix }} + working-directory: ${{ inputs.working-directory }} + build-args: | + VOLTO_VERSION=${{ inputs.volto-version }} + push: ${{ github.event_name != 'pull_request' }} + secrets: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Unit Tests - id: unit - if: ${{ success() || failure() }} - run: make ci-test - - - name: Report - if: ${{ success() || failure() }} + report: + name: "Final report" + if: ${{ always() }} + runs-on: ubuntu-latest + needs: + - code-analysis + - i18n + - unit + - release + steps: + - name: Write report run: | - echo '# Code Analysis' >> $GITHUB_STEP_SUMMARY - echo '| Test | Status |' >> $GITHUB_STEP_SUMMARY + echo '# Frontend Workflow Report' >> $GITHUB_STEP_SUMMARY + echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY - echo '| Lint | ${{ steps.lint.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - echo '| i18n | ${{ steps.i18n.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - echo '| Unit Tests | ${{ steps.unit.conclusion == 'failure' && '❌' || ' ✅' }} |' >> $GITHUB_STEP_SUMMARY - + echo '| code-analysis | ${{ needs.code-analysis.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| i18n | ${{ needs.i18n.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| unit | ${{ needs.unit.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| release | ${{ needs.release.result }} |' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c48bee6..1d57215 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,48 +1,60 @@ -name: 'volto-form-block' +name: Form Block CI on: push: paths: - "backend/**" - "frontend/**" - - ".github/workflows/backend.yml" - - ".github/workflows/frontend.yml" - - ".github/workflows/main.yml" + - ".github/workflows/*.yml" + - "devops/**" workflow_dispatch: jobs: config: - runs-on: ubuntu-latest - outputs: - backend: ${{ steps.filter.outputs.backend }} - frontend: ${{ steps.filter.outputs.frontend }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - uses: dorny/paths-filter@v3 - id: filter - with: - filters: | - backend: - - 'backend/**' - - '.github/workflows/backend.yml' - frontend: - - 'frontend/**' - - '.github/workflows/frontend.yml' - + uses: ./.github/workflows/config.yml backend: uses: ./.github/workflows/backend.yml - needs: config + needs: + - config + with: + base-tag: ${{ needs.config.outputs.base-tag }} + image-name-prefix: ${{ needs.config.outputs.image-name-prefix }} + image-name-suffix: backend + python-version: ${{ needs.config.outputs.python-version }} + plone-version: ${{ needs.config.outputs.plone-version }} if: ${{ needs.config.outputs.backend == 'true' }} permissions: contents: read packages: write - frontend: uses: ./.github/workflows/frontend.yml - needs: config + needs: + - config + with: + base-tag: ${{ needs.config.outputs.base-tag }} + image-name-prefix: ${{ needs.config.outputs.image-name-prefix }} + image-name-suffix: frontend + node-version: ${{ needs.config.outputs.node-version }} + volto-version: ${{ needs.config.outputs.volto-version }} if: ${{ needs.config.outputs.frontend == 'true' }} permissions: contents: read packages: write + + report: + name: "Final report" + if: ${{ always() }} + runs-on: ubuntu-latest + needs: + - config + - backend + - frontend + steps: + - name: Write report + run: | + echo '# Workflow Report' >> $GITHUB_STEP_SUMMARY + echo '| Job ID | Conclusion |' >> $GITHUB_STEP_SUMMARY + echo '| --- | --- |' >> $GITHUB_STEP_SUMMARY + echo '| config | ${{ needs.config.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| backend | ${{ needs.backend.result }} |' >> $GITHUB_STEP_SUMMARY + echo '| frontend | ${{ needs.frontend.result }} |' >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/manual_deploy.yml b/.github/workflows/manual_deploy.yml new file mode 100644 index 0000000..1159736 --- /dev/null +++ b/.github/workflows/manual_deploy.yml @@ -0,0 +1,35 @@ +name: Manual Deployment of project.example.com + +on: + workflow_dispatch: + +jobs: + + config: + uses: ./.github/workflows/config.yml + + deploy: + if: ${{ github.ref == 'refs/heads/main' }} + needs: + - config + runs-on: ubuntu-latest + environment: ${{ needs.config.outputs.environment }} + steps: + - name: Checkout + uses: actions/checkout@v5 + + - name: Deploy to cluster + uses: kitconcept/docker-stack-deploy@v1.2.0 + with: + registry: "ghcr.io" + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + remote_host: ${{ secrets.DEPLOY_HOST }} + remote_port: ${{ secrets.DEPLOY_PORT }} + remote_user: ${{ secrets.DEPLOY_USER }} + remote_private_key: ${{ secrets.DEPLOY_SSH }} + stack_file: devops/stacks/${{ needs.config.outputs.environment }}.yml + stack_name: ${{ needs.config.outputs.stack-name }} + stack_param: ${{ github.ref_name }} + env_file: ${{ secrets.ENV_FILE }} + deploy_timeout: 480 diff --git a/.github/workflows/varnish.yml b/.github/workflows/varnish.yml new file mode 100644 index 0000000..3d86c01 --- /dev/null +++ b/.github/workflows/varnish.yml @@ -0,0 +1,36 @@ +name: Varnish Image Creation + +on: + workflow_call: + inputs: + base-tag: + required: true + type: string + image-name-prefix: + required: true + type: string + image-name-suffix: + required: true + type: string + working-directory: + required: false + type: string + default: devops/varnish + +jobs: + + release: + name: "Varnish: Build and publish Container Image" + uses: plone/meta/.github/workflows/container-image-build-push.yml@2.x + permissions: + contents: read + packages: write + with: + base-tag: ${{ inputs.base-tag }} + image-name-prefix: ${{ inputs.image-name-prefix }} + image-name-suffix: ${{ inputs.image-name-suffix }} + working-directory: ${{ inputs.working-directory }} + push: ${{ github.event_name != 'pull_request' }} + secrets: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 2073158..9099385 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules /core /public +*.mo diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..f097bef --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,16 @@ +{ + "recommendations": [ + "plone.plone-vs-utilities", + "editorconfig.editorconfig", + "ExecutableBookProject.myst-highlight", + "charliermarsh.ruff", + "ms-python.python", + "dbaeumer.vscode-eslint", + "esbenp.prettier-vscode", + "stylelint.vscode-stylelint", + "github.vscode-github-actions", + "ms-azuretools.vscode-containers", + "ms-vscode-remote.remote-containers", + "redhat.vscode-yaml" + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 04f8089..7c84efc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,26 @@ { + "files.encoding": "utf8", "eslint.workingDirectories": ["./frontend"], - "flake8.cwd": "${workspaceFolder}/backend", - "flake8.args": ["--config=pyproject.toml"] + "stylelint.enable": true, + "css.validate": false, + "less.validate": false, + "scss.validate": false, + "[css][less][scss]": { + "editor.tabSize": 2, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.fixAll.stylelint": "explicit" + }, + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "ruff.organizeImports": true, + "python.terminal.activateEnvironment": true, + "python.testing.pytestArgs": [ + "backend/tests" + ], + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "[markdown]": { + "editor.formatOnSave": false + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 9186d30..8b94ec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ -# Changes +# Change log -## 1.0.0 (2024-07-08) + -- Initial version [collective] + diff --git a/Makefile b/Makefile index fdc0f34..1b7c219 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,12 @@ MAKEFLAGS+=--no-builtin-rules CURRENT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) GIT_FOLDER=$(CURRENT_DIR)/.git -PROJECT_NAME=volto-form-block -STACK_NAME=volto-form-block-example-com +REPOSITORY_SETTINGS := $(shell uvx repoplone settings dump) -VOLTO_VERSION = $(shell cat frontend/mrs.developer.json | python -c "import sys, json; print(json.load(sys.stdin)['core']['tag'])") -PLONE_VERSION=$(shell cat backend/version.txt) +PROJECT_NAME := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.name') + +VOLTO_VERSION := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.frontend.volto_version') +PLONE_VERSION := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.base_package_version') # We like colors # From: https://coderwall.com/p/izxssa/colored-makefile-for-golang-projects @@ -33,6 +34,13 @@ all: install help: ## This help message @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' +.PHONY: debug-settings +debug-settings: ## Debug settings + @echo "Debug settings" + @echo "PROJECT_NAME: $(PROJECT_NAME)" + @echo "VOLTO_VERSION: $(VOLTO_VERSION)" + @echo "PLONE_VERSION: $(PLONE_VERSION)" + ########################################### # Frontend ########################################### @@ -82,64 +90,79 @@ backend-test: ## Test backend codebase @echo "Test backend" $(MAKE) -C "./backend/" test +########################################### +# Environment +########################################### .PHONY: install install: ## Install @echo "Install Backend & Frontend" $(MAKE) backend-install $(MAKE) frontend-install -.PHONY: start -start: ## Start - @echo "Starting application" - $(MAKE) backend-start - $(MAKE) frontend-start - .PHONY: clean clean: ## Clean installation @echo "Clean installation" $(MAKE) -C "./backend/" clean $(MAKE) -C "./frontend/" clean +########################################### +# QA +########################################### .PHONY: format format: ## Format codebase - @echo "Format codebase" + @echo "Format the codebase" $(MAKE) -C "./backend/" format $(MAKE) -C "./frontend/" format .PHONY: lint -lint: ## Lint codebase - @echo "Lint codebase" +lint: ## Format codebase + @echo "Lint the codebase" $(MAKE) -C "./backend/" lint $(MAKE) -C "./frontend/" lint +.PHONY: check +check: format lint ## Lint and Format codebase + +########################################### +# i18n +########################################### .PHONY: i18n i18n: ## Update locales @echo "Update locales" $(MAKE) -C "./backend/" i18n $(MAKE) -C "./frontend/" i18n +########################################### +# Testing +########################################### .PHONY: test test: backend-test frontend-test ## Test codebase +########################################### +# Container images +########################################### .PHONY: build-images -build-images: ## Build docker images +build-images: ## Build container images @echo "Build" $(MAKE) -C "./backend/" build-image $(MAKE) -C "./frontend/" build-image -## Docker stack +########################################### +# Local Stack +########################################### +.PHONY: stack-create-site +stack-create-site: ## Local Stack: Create a new site + @echo "Create a new site in the local Docker stack" + @echo "(Stack must not be running already.)" + VOLTO_VERSION=$(VOLTO_VERSION) PLONE_VERSION=$(PLONE_VERSION) docker compose -f docker-compose.yml run --build backend ./docker-entrypoint.sh create-site + .PHONY: stack-start stack-start: ## Local Stack: Start Services @echo "Start local Docker stack" VOLTO_VERSION=$(VOLTO_VERSION) PLONE_VERSION=$(PLONE_VERSION) docker compose -f docker-compose.yml up -d --build - @echo "Now visit: http://volto-form-block.localhost" + @echo "Now visit: http://form-block.localhost" -.PHONY: start-stack -stack-create-site: ## Local Stack: Create a new site - @echo "Create a new site in the local Docker stack" - @docker compose -f docker-compose.yml exec backend ./docker-entrypoint.sh create-site - -.PHONY: start-ps +.PHONY: stack-status stack-status: ## Local Stack: Check Status @echo "Check the status of the local Docker stack" @docker compose -f docker-compose.yml ps @@ -156,32 +179,34 @@ stack-rm: ## Local Stack: Remove Services and Volumes @echo "Remove local volume data" @docker volume rm $(PROJECT_NAME)_vol-site-data -## Acceptance +########################################### +# Acceptance +########################################### .PHONY: acceptance-backend-dev-start -acceptance-backend-dev-start: ## Build Acceptance Servers - @echo "Build acceptance backend" +acceptance-backend-dev-start: + @echo "Start acceptance backend" $(MAKE) -C "./backend/" acceptance-backend-start .PHONY: acceptance-frontend-dev-start -acceptance-frontend-dev-start: ## Build Acceptance Servers - @echo "Build acceptance backend" +acceptance-frontend-dev-start: + @echo "Start acceptance frontend" $(MAKE) -C "./frontend/" acceptance-frontend-dev-start .PHONY: acceptance-test -acceptance-test: ## Start Acceptance tests in interactive mode - @echo "Build acceptance backend" +acceptance-test: + @echo "Start acceptance tests in interactive mode" $(MAKE) -C "./frontend/" acceptance-test # Build Docker images .PHONY: acceptance-frontend-image-build -acceptance-frontend-image-build: ## Build Acceptance frontend server image - @echo "Build acceptance frontend" - @docker build frontend -t collective/volto-form-block-frontend:acceptance -f frontend/Dockerfile --build-arg VOLTO_VERSION=$(VOLTO_VERSION) +acceptance-frontend-image-build: + @echo "Build acceptance frontend image" + @docker build frontend -t plone/form-block-frontend:acceptance -f frontend/Dockerfile --build-arg VOLTO_VERSION=$(VOLTO_VERSION) .PHONY: acceptance-backend-image-build -acceptance-backend-image-build: ## Build Acceptance backend server image - @echo "Build acceptance backend" - @docker build backend -t collective/volto-form-block-backend:acceptance -f backend/Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION) +acceptance-backend-image-build: + @echo "Build acceptance backend image" + @docker build backend -t plone/form-block-backend:acceptance -f backend/Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION) .PHONY: acceptance-images-build acceptance-images-build: ## Build Acceptance frontend/backend images @@ -189,14 +214,14 @@ acceptance-images-build: ## Build Acceptance frontend/backend images $(MAKE) acceptance-frontend-image-build .PHONY: acceptance-frontend-container-start -acceptance-frontend-container-start: ## Start Acceptance frontend container +acceptance-frontend-container-start: @echo "Start acceptance frontend" - @docker run --rm -p 3000:3000 --name volto-form-block-frontend-acceptance --link volto-form-block-backend-acceptance:backend -e RAZZLE_API_PATH=http://localhost:55001/plone -e RAZZLE_INTERNAL_API_PATH=http://backend:55001/plone -d collective/volto-form-block-frontend:acceptance + @docker run --rm -p 3000:3000 --name form-block-frontend-acceptance --link form-block-backend-acceptance:backend -e RAZZLE_API_PATH=http://localhost:55001/plone -e RAZZLE_INTERNAL_API_PATH=http://backend:55001/plone -d plone/form-block-frontend:acceptance .PHONY: acceptance-backend-container-start -acceptance-backend-container-start: ## Start Acceptance backend container +acceptance-backend-container-start: @echo "Start acceptance backend" - @docker run --rm -p 55001:55001 --name volto-form-block-backend-acceptance -d collective/volto-form-block-backend:acceptance + @docker run --rm -p 55001:55001 --name form-block-backend-acceptance -d plone/form-block-backend:acceptance .PHONY: acceptance-containers-start acceptance-containers-start: ## Start Acceptance containers @@ -206,11 +231,12 @@ acceptance-containers-start: ## Start Acceptance containers .PHONY: acceptance-containers-stop acceptance-containers-stop: ## Stop Acceptance containers @echo "Stop acceptance containers" - @docker stop volto-form-block-frontend-acceptance - @docker stop volto-form-block-backend-acceptance + @docker stop form-block-frontend-acceptance + @docker stop form-block-backend-acceptance .PHONY: ci-acceptance-test -ci-acceptance-test: ## Run Acceptance tests in ci mode +ci-acceptance-test: + @echo "Run acceptance tests in CI mode" $(MAKE) acceptance-containers-start pnpm dlx wait-on --httpTimeout 20000 http-get://localhost:55001/plone http://localhost:3000 $(MAKE) -C "./frontend/" ci-acceptance-test diff --git a/README.md b/README.md index 2a42ef3..882e0bc 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# form-block 🚀 +# Form Block 🚀 [![Built with Cookieplone](https://img.shields.io/badge/built%20with-Cookieplone-0083be.svg?logo=cookiecutter)](https://github.com/plone/cookieplone-templates/) [![Black code style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) @@ -25,7 +25,7 @@ Form Block add-on for Plone CMS. ```shell git clone git@github.com:plone/form-block.git - cd kitconcept-gmbh-website + cd form-block ``` 2. Install this code base. @@ -63,7 +63,7 @@ Deploy a local Docker Compose environment that includes the following. - Docker images for Backend and Frontend 🖼️ - A stack with a Traefik router and a PostgreSQL database 🗃️ -- Accessible at [http://kitconcept-gmbh-website.localhost](http://kitconcept-gmbh-website.localhost) 🌐 +- Accessible at [http://form-block.localhost](http://form-block.localhost) 🌐 Run the following commands in a shell session. @@ -78,7 +78,7 @@ And... you're all set! Your Plone site is up and running locally! 🚀 This monorepo consists of the following distinct sections: -- **backend**: Houses the API and Plone installation, utilizing pip instead of buildout, and includes a policy package named kitconcept_gmbh.website. +- **backend**: Houses the API and Plone installation, utilizing pip instead of buildout, and includes a policy package named collective.volto.formsupport. - **frontend**: Contains the React (Volto) package. - **devops**: Encompasses Docker stack, Ansible playbooks, and cache settings. - **docs**: Scaffold for writing documentation for your project. @@ -145,4 +145,4 @@ make i18n ## Credits and acknowledgements 🙏 -Generated using [Cookieplone (0.9.10)](https://github.com/plone/cookieplone) and [cookieplone-templates (8063e74)](https://github.com/plone/cookieplone-templates/commit/8063e74a542d07accadb9a8be81c2e6482256cb1) on 2025-11-05 17:52:22.460918. A special thanks to all contributors and supporters! +Generated using [Cookieplone (0.9.10)](https://github.com/plone/cookieplone) and [cookieplone-templates (562ef7e)](https://github.com/plone/cookieplone-templates/commit/562ef7e9ad24d2568566d74ca6edb15a9a506df3) on 2025-11-14 13:58:03.622621. A special thanks to all contributors and supporters! diff --git a/backend/.editorconfig b/backend/.editorconfig index 8ae05aa..b3561a7 100644 --- a/backend/.editorconfig +++ b/backend/.editorconfig @@ -1,9 +1,6 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file -# + # EditorConfig Configuration file, for more details see: -# http://EditorConfig.org +# https://EditorConfig.org # EditorConfig is a convention description, that could be interpreted # by multiple editors to enforce common coding conventions for specific # file types @@ -22,33 +19,17 @@ trim_trailing_whitespace = true charset = utf-8 # Indent style default indent_style = space -# Max Line Length - a hard line wrap, should be disabled -max_line_length = off [*.{py,cfg,ini}] # 4 space indentation indent_size = 4 -[*.{yml,zpt,pt,dtml,zcml}] -# 2 space indentation -indent_size = 2 - -[*.{json,jsonl,js,jsx,ts,tsx,css,less,scss,html}] # Frontend development +[*.{html,dtml,pt,zpt,xml,zcml,js,json,ts,less,scss,css,sass,yml,yaml}] # 2 space indentation indent_size = 2 -max_line_length = 80 [{Makefile,.gitmodules}] # Tab indentation (no size specified, but view as 4 spaces) indent_style = tab indent_size = unset tab_width = unset - - -## -# Add extra configuration options in .meta.toml: -# [editorconfig] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/.gitignore b/backend/.gitignore index c5cbfdc..d2260f2 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -1,45 +1,45 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file # python related *.egg-info *.pyc *.pyo # tools related -build/ +__pycache__/ .coverage +.mypy_cache +.pytest_cache +.ruff_cache +/build/ coverage.xml dist/ docs/_build -__pycache__/ -.tox -.vscode/ node_modules/ # venv / buildout related +.eggs/ +.installed.cfg +.mr.developer.cfg +.venv/ bin/ develop-eggs/ eggs/ -.eggs/ etc/ -.installed.cfg include/ lib/ lib64 -.mr.developer.cfg parts/ pyvenv.cfg var/ -*.mo # mxdev -/instance/ +.installed.txt +.lock /.make-sentinels/ /*-mxdev.txt +/instance/ /reports/ /sources/ /venv/ -.installed.txt -.lock -requirements.lock +.mxdev_cache +constraints*.txt +requirements*.txt \ No newline at end of file diff --git a/backend/.mrbob.ini b/backend/.mrbob.ini new file mode 100644 index 0000000..cf75b64 --- /dev/null +++ b/backend/.mrbob.ini @@ -0,0 +1,4 @@ +[variables] +package.dottedname = collective.volto.formsupport +package.browserlayer = IBrowserLayer + diff --git a/backend/CHANGES.md b/backend/CHANGELOG.md similarity index 100% rename from backend/CHANGES.md rename to backend/CHANGELOG.md diff --git a/backend/Dockerfile b/backend/Dockerfile index 3bd45a6..8e88880 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,38 +1,56 @@ -# syntax=docker/dockerfile:1 -ARG PLONE_VERSION=6.0.11 -FROM plone/server-builder:${PLONE_VERSION} AS builder - -WORKDIR /app - - -# Add local code -COPY scripts/ scripts/ -COPY . src +# syntax=docker/dockerfile:1.9 +ARG PYTHON_VERSION=3.12 +FROM plone/server-builder:uv-${PYTHON_VERSION} AS builder + +# Install project dependencies based on uv.lock and pyproject.toml +# We expect pyproject.toml to have an entry cointainer inside [dependency-groups] +RUN --mount=type=cache,target=/root/.cache \ + --mount=type=bind,source=uv.lock,target=uv.lock \ + --mount=type=bind,source=pyproject.toml,target=pyproject.toml \ + uv sync \ + --locked \ + --no-dev \ + --no-group test \ + --group container \ + --no-install-project + +COPY . /src +WORKDIR /src + +# Install package +RUN --mount=type=cache,target=/root/.cache \ + uv sync \ + --locked \ + --no-dev \ + --no-group test \ + --group container \ + --no-editable + +# Move skeleton files to /app +RUN <= tuple(map(int, '$(PYTHON_VERSION_MIN)'.split('.'))))") -ifeq ($(PYTHON_VERSION_OK),0) - $(error "Need python $(PYTHON_VERSION) >= $(PYTHON_VERSION_MIN)") -endif +REPOSITORY_SETTINGS := $(shell uvx repoplone settings dump) +IMAGE_NAME_PREFIX := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.container_images_prefix') +IMAGE_TAG=latest +IMAGE_NAME=$(IMAGE_NAME_PREFIX)-backend:$(IMAGE_TAG) PLONE_SITE_ID=Plone BACKEND_FOLDER=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) -PLONE_VERSION=$(shell cat $(BACKEND_FOLDER)/version.txt) -EXAMPLE_CONTENT_FOLDER=${BACKEND_FOLDER}/src/collective/voltoformblock/setuphandlers/examplecontent +PLONE_VERSION := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.base_package_version') +EXAMPLE_CONTENT_FOLDER := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.code_path')/setuphandlers/examplecontent +PACKAGE_NAME := $(shell echo '$(REPOSITORY_SETTINGS)' | jq -r '.backend.name') -GIT_FOLDER=$(BACKEND_FOLDER)/.git VENV_FOLDER=$(BACKEND_FOLDER)/.venv +export VIRTUAL_ENV=$(VENV_FOLDER) BIN_FOLDER=$(VENV_FOLDER)/bin -SEED=$(shell date +'%Y%m%d-%H%M%S') +# Environment variables to be exported +export UV_VENV_CLEAR := 1 +export PYTHONWARNINGS := ignore +export DOCKER_BUILDKIT := 1 all: build @@ -52,89 +50,117 @@ all: build help: ## This help message @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' -$(BIN_FOLDER)/hatch: ## Setup virtual env - @echo "$(GREEN)==> Install dependencies$(RESET)" - @pipx run hatch env create +.PHONY: debug-settings +debug-settings: ## Debug settings + @echo "PLONE_VERSION: $(PLONE_VERSION)" + @echo "PACKAGE_NAME: $(PACKAGE_NAME)" + @echo "EXAMPLE_CONTENT_FOLDER: $(EXAMPLE_CONTENT_FOLDER)" + +requirements-mxdev.txt: pyproject.toml mx.ini ## Generate constraints file + @echo "$(GREEN)==> Generate constraints file$(RESET)" + @echo '-c https://dist.plone.org/release/$(PLONE_VERSION)/constraints.txt' > requirements.txt + @uvx mxdev -c mx.ini + +$(VENV_FOLDER): requirements-mxdev.txt ## Install dependencies + @echo "$(GREEN)==> Install environment$(RESET)" +ifdef CI + @uv venv $(VENV_FOLDER) +else + @uv venv --python=3.12 $(VENV_FOLDER) +endif + @uv pip install -r requirements-mxdev.txt + +.PHONY: sync +sync: $(VENV_FOLDER) ## Sync project dependencies + @echo "$(GREEN)==> Sync project dependencies$(RESET)" + @uv pip install -r requirements-mxdev.txt -instance/etc/zope.ini: ## Create instance configuration +instance/etc/zope.ini instance/etc/zope.conf: instance.yaml ## Create instance configuration @echo "$(GREEN)==> Create instance configuration$(RESET)" - @pipx run cookiecutter -f --no-input --config-file instance.yaml gh:plone/cookiecutter-zope-instance + @uvx cookiecutter -f --no-input -c 2.1.1 --config-file instance.yaml gh:plone/cookiecutter-zope-instance .PHONY: config config: instance/etc/zope.ini -constraints-mxdev.txt: ## Generate constraints file - @echo "$(GREEN)==> Generate constraints file$(RESET)" - @echo '-c https://dist.plone.org/release/$(PLONE_VERSION)/constraints.txt' > requirements.txt - @pipx run mxdev -c mx.ini - -.PHONY: build-dev -build-dev: constraints-mxdev.txt config $(BIN_FOLDER)/hatch ## Install Plone packages - .PHONY: install -install: build-dev ## Install Plone +install: $(VENV_FOLDER) config ## Install Plone and dependencies -.PHONY: build -build: build-dev ## Install Plone .PHONY: clean -clean: ## Clean environment +clean: ## Clean installation and instance (data left intact) @echo "$(RED)==> Cleaning environment and build$(RESET)" - rm -rf $(VENV_FOLDER) pyvenv.cfg dist instance .venv .pytest_cache requirements-mxdev.txt constraints-mxdev.txt requirements.lock + @rm -rf $(VENV_FOLDER) pyvenv.cfg .installed.cfg instance/etc .venv .pytest_cache .ruff_cache constraints* requirements* + +.PHONY: remove-data +remove-data: ## Remove all content + @echo "$(RED)==> Removing all content$(RESET)" + rm -rf $(VENV_FOLDER) instance/var .PHONY: start -start: ## Start a Plone instance on localhost:8080 - ENABLE_PRINTING_MAILHOST=True PYTHONWARNINGS=ignore $(BIN_FOLDER)/runwsgi instance/etc/zope.ini +start: $(VENV_FOLDER) instance/etc/zope.ini ## Start a Plone instance on localhost:8080 + @$(BIN_FOLDER)/runwsgi instance/etc/zope.ini .PHONY: console -console: instance/etc/zope.ini ## Start a console into a Plone instance - PYTHONWARNINGS=ignore $(BIN_FOLDER)/zconsole debug instance/etc/zope.conf +console: $(VENV_FOLDER) instance/etc/zope.ini ## Start a console into a Plone instance + @$(BIN_FOLDER)/zconsole debug instance/etc/zope.conf .PHONY: create-site -create-site: instance/etc/zope.ini ## Create a new site from scratch - PYTHONWARNINGS=ignore $(BIN_FOLDER)/zconsole run instance/etc/zope.conf ./scripts/create_site.py +create-site: $(VENV_FOLDER) instance/etc/zope.ini ## Create a new site from scratch + @$(BIN_FOLDER)/zconsole run instance/etc/zope.conf ./scripts/create_site.py # Example Content .PHONY: update-example-content -update-example-content: $(BIN_FOLDER)/tox ## Export example content inside package +update-example-content: $(VENV_FOLDER) ## Export example content inside package @echo "$(GREEN)==> Export example content into $(EXAMPLE_CONTENT_FOLDER) $(RESET)" if [ -d $(EXAMPLE_CONTENT_FOLDER)/content ]; then rm -r $(EXAMPLE_CONTENT_FOLDER)/* ;fi - $(BIN_FOLDER)/plone-exporter instance/etc/zope.conf $(PLONE_SITE_ID) $(EXAMPLE_CONTENT_FOLDER) + @$(BIN_FOLDER)/plone-exporter instance/etc/zope.conf $(PLONE_SITE_ID) $(EXAMPLE_CONTENT_FOLDER) +# QA .PHONY: lint -lint: $(BIN_FOLDER)/hatch ## Check and fix code base according to Plone standards +lint: ## Check and fix code base according to Plone standards @echo "$(GREEN)==> Lint codebase$(RESET)" - $(BIN_FOLDER)/hatch run lint + @uvx ruff@latest check --fix --config $(BACKEND_FOLDER)/pyproject.toml + @uvx pyroma@latest -d . + @uvx check-python-versions@latest . + @uvx zpretty@latest --check src .PHONY: format -format: $(BIN_FOLDER)/hatch ## Check and fix code base according to Plone standards +format: ## Check and fix code base according to Plone standards @echo "$(GREEN)==> Format codebase$(RESET)" - $(BIN_FOLDER)/hatch run format + @uvx ruff@latest check --select I --fix --config $(BACKEND_FOLDER)/pyproject.toml + @uvx ruff@latest format --config $(BACKEND_FOLDER)/pyproject.toml + @uvx zpretty@latest -i src +# i18n .PHONY: i18n -i18n: ## Update locales +i18n: $(VENV_FOLDER) ## Update locales @echo "$(GREEN)==> Updating locales$(RESET)" - $(BIN_FOLDER)/hatch run i18n + @$(BIN_FOLDER)/python -m $(PACKAGE_NAME).locales # Tests .PHONY: test -test: $(BIN_FOLDER)/pytest ## run tests - $(BIN_FOLDER)/hatch run test +test: $(VENV_FOLDER) ## run tests + @$(BIN_FOLDER)/pytest .PHONY: test-coverage -test-coverage: $(BIN_FOLDER)/pytest ## run tests with coverage - $(BIN_FOLDER)/hatch run cov +test-coverage: $(VENV_FOLDER) ## run tests with coverage + @$(BIN_FOLDER)/pytest --cov=$(PACKAGE_NAME) --cov-report term-missing # Build Docker images .PHONY: build-image build-image: ## Build Docker Images - @DOCKER_BUILDKIT=1 docker build . -t $(IMAGE_NAME_PREFIX)-backend:$(IMAGE_TAG) -f Dockerfile --build-arg PLONE_VERSION=$(PLONE_VERSION) + @echo "$(GREEN)==> Building image $(IMAGE_NAME) $(RESET)" + @docker build . -t $(IMAGE_NAME) --progress plain -f Dockerfile # Acceptance tests .PHONY: acceptance-backend-start acceptance-backend-start: ## Start backend acceptance server - ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="plonegovbr/intranet:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,plonegovbr/intranet" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING + ZSERVER_HOST=0.0.0.0 ZSERVER_PORT=55001 LISTEN_PORT=55001 APPLY_PROFILES="collective.volto.formsupport:default" CONFIGURE_PACKAGES="plone.restapi,plone.volto,plone.volto.cors,collective.volto.formsupport" $(BIN_FOLDER)/robot-server plone.app.robotframework.testing.VOLTO_ROBOT_TESTING .PHONY: acceptance-image-build acceptance-image-build: ## Build Docker Images - @DOCKER_BUILDKIT=1 docker build . -t $(IMAGE_NAME_PREFIX)-backend-acceptance:$(IMAGE_TAG) -f Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION) + @docker build . -t $(IMAGE_NAME_PREFIX)-backend-acceptance:$(IMAGE_TAG) -f Dockerfile.acceptance --build-arg PLONE_VERSION=$(PLONE_VERSION) + +## Add bobtemplates features (check bobtemplates.plone's documentation to get the list of available features) +add: $(VENV_FOLDER) + @uvx plonecli add -b .mrbob.ini $(filter-out $@,$(MAKECMDGOALS)) diff --git a/backend/README.md b/backend/README.md index e91caec..f4cb650 100644 --- a/backend/README.md +++ b/backend/README.md @@ -1,327 +1,87 @@ # collective.volto.formsupport -Add some helper routes and functionalities for Volto sites with `form` blocks provided by `volto-form-block `\_ Volto plugin. +Form Block add-on for Plone CMS. -## volto-form-block version +## Features -Works with volto-form-block >= v3.8.0 +TODO: List our awesome features -## plone.restapi endpoints - -### `@schemaform-data` - -Endpoint that the frontend should call as a submit action. - -You can call it with a POST on the context where the block form is stored like this: - -```shell -> curl -i -X POST http://localhost:8080/Plone/my-form/@schemaform-data -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"block_id": "123456789", "data": [{"field_id": "foo", "value":"foo", "label": "Foo"},{"field_id": "from", "value": "support@foo.com"}, {"field_id":"name", "value": "John Doe", "label": "Name"}]}' -``` - -where: - -- `my-form` is the context where we have a form block -- `block_id` is the id of the block -- `data` contains the submitted form data - -Calling this endpoint, it will do some actions (based on block settings) and returns a `200` response with the submitted data. - -### `@form-data` - -This is an expansion component. - -There is a rule that returns a `form-data` item into "components" slot if the user can edit the -context (**Modify portal content** permission) and there is a block that can store data. +## Installation -Calling with "expand=true", this endpoint returns the stored data: +Install collective.volto.formsupport with uv. ```shell -> curl -i -X GET http://localhost:8080/Plone/my-form/@form-data -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin +uv add collective.volto.formsupport ``` -Specifying a block_id parameter returns only the records associated with a specific block on the page. +Create the Plone site. ```shell -> curl -i -X GET http://localhost:8080/Plone/my-form/@form-data?block_id=123456789 -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin +make create-site ``` -And replies with something similar:: +## Contribute -```json - { - "@id": "http://localhost:8080/Plone/my-form/@form-data?block_id=123456789", - "items": [ - { - "block_id": "123456789", - "date": "2021-03-10T12:25:24", - "from": "support@foo.com", - "id": 912078826, - "name": "John Doe" - }, - ... - ], - "items_total": 42, - "expired_total": 2 - } -``` +- [Issue tracker](https://github.com/plone/form-block/issues) +- [Source code](https://github.com/plone/form-block/) -### `@form-data-export` +### Prerequisites ✅ -Returns a csv file with all data (only for users that have **Modify portal content** permission): +- An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned. +- [uv](https://6.docs.plone.org/install/create-project-cookieplone.html#uv) +- [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make) +- [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git) +- [Docker](https://docs.docker.com/get-started/get-docker/) (optional) -```shell -> curl -i -X GET http://localhost:8080/Plone/my-form/@form-data-export -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin -``` +### Installation 🔧 -If form fields changed between some submissions, you will see also columns related to old fields. +1. Clone this repository. -### `@form-data-clear` + ```shell + git clone git@github.com:plone/form-block.git + cd form-block/backend + ``` -Reset the store (only for users that have **Modify portal content** permission): +2. Install this code base. -```shell -> curl -i -X DELETE http://localhost:8080/Plone/my-form/@form-data-clear --data-raw '{block_id: bbb}' -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin -``` + ```shell + make install + ``` -Optional parameters could be passed in the payload: -- `block_id` to delete only data related to a specific block on the page, otherwise data from all form blocks on the page will be deleted -- `expired` a boolean that, if `true`, removes only records older than the value of days specified in the block configuration (the above `block_id` parameter is required) +### Add features using `plonecli` or `bobtemplates.plone` -### `@validate-email-address` +This package provides markers as strings (``) that are compatible with [`plonecli`](https://github.com/plone/plonecli) and [`bobtemplates.plone`](https://github.com/plone/bobtemplates.plone). +These markers act as hooks to add all kinds of features through subtemplates, including behaviors, control panels, upgrade steps, or other subtemplates from `bobtemplates.plone`. +`plonecli` is a command line client for `bobtemplates.plone`, adding autocompletion and other features. -Send an message to the passed email with OTP code to verify the address. -Returns a HTTP 204 in case of success or HTTP 400 in case the email is badly composed.: +To add a feature as a subtemplate to your package, use the following command pattern. ```shell -> curl -i -X POST http://localhost:8080/Plone/my-form/@validate-email-address --data-raw '{"email": "email@email.com", "uid": "ffffffff"}' -H 'Accept: application/json' -H 'Content-Type: application/json' +make add ``` -parameters: - -- `email` email address. -- `uid` uid related to email field - -### `@validate-email-token` - -Supposed to validate the OTP code received by the user via email. -Returns HTTP 204 in case of success or HTTP 400 in case of failure :: +For example, you can add a content type to your package with the following command. ```shell -> curl -i -X POST http://localhost:8080/Plone/my-form/@validate-email-token --data-raw '{"email": "email@email.com", "otp": "blahblahblah"}' -H 'Accept: application/json' -H 'Content-Type: application/json' +make add content_type ``` -parameters: - -- `email` email address -- `uid` uid used to generate the OTP -- `otp` OTP code - -## Form actions - -Using `volto-form-block `\_ you can set if the form submit should send data to an email address -or store it into an internal catalog (or both). - -### Send - -If block is set to send data, an email with form data will be sent to the recipient set in block settings or (if not set) to the site address. - -If there are file upload fields in the POST data, these files will be attached to the email sent. - -#### Acknowledgement email - -It is possible to also send an email to the user who filled in the form. - -Set the 'Send to' value to include `acknowledgement` to enable this behaviour. The additional block field `acknowledgementMessage` can then be used to write the message being sent to the user and the `acknowledgementFields` block field used to choose the field that will contain the email address the acknowledgement will be sent to. - -### Store - -If block is set to store data, we store it into the content that has that block (with a `souper.plone `\_ catalog). - -The store is an adapter registered for _IFormDataStore_ interface, so you can override it easily. - -Only fields that are also in block settings are stored. Missing ones will be skipped. - -Each Record stores also two _service_ attributes: - -- **fields_labels**: a mapping of field ids to field labels. This is useful when we export csv files, so we can labels for the columns. -- **fields_order**: sorted list of field ids. This can be used in csv export to keep the order of fields. - -We store these attributes because the form can change over time and we want to have a snapshot of the fields in the Record. - -#### Data ID Mapping - -The exported CSV file may need to be used by further processes which require specific values for the columns of the CSV. In such a case, the `Data ID Mapping` feature can be used to change the column name to custom text for each field. - -## Block serializer - -There is a custom block serializer for type `form`. - -This serializer removes all fields that start with "\*\*default\_\*\*\" if the user can't edit the current context. - -This is useful because we don't want to expose some internals configurations (for example the recipient email address) -to external users that should only fill the form. - -If the block has a field `captcha`, an additional property `captcha_props` is serialized by the `serialize` -method provided by the ICaptchaSupport named adapter, the result contains useful metadata for the client, as the -captcha public_key, ie: - -```json - { - "subblocks": [ - ... - ], - "captcha": "recaptcha", - "captcha_props": { - "provider": "recaptcha", - "public_key": "aaaaaaaaaaaaa" - } - } -``` - -## Captcha support - -Captcha support requires a specific name adapter that implements `ICaptchaSupport`. -This product contains implementations for: - -- HCaptcha (plone.formwidget.hcaptcha) -- Google ReCaptcha (plone.formwidget.recaptcha) -- Custom questions and answers (collective.z3cform.norobots) -- Honeypot (collective.honeypot) - -Each implementation must be included, installed and configured separately. - -To include one implementation, you need to install the egg with the needed extras_require: - -- collective.volto.formsupport[recaptcha] -- collective.volto.formsupport[hcaptcha] -- collective.volto.formsupport[norobots] -- collective.volto.formsupport[honeypot] - -During the form post, the token captcha will be verified with the defined captcha method. - -For captcha support `volto-form-block` version >= 2.4.0 is required. - -### Honeypot configuration - -If honeypot dependency is available in the buildout, the honeypot validation is enabled and selectable in forms. - -Default field name is `protected_1` and you can change it with an environment variable. See `collective.honeypot `\_ for details. - -## File upload limits - -Forms can have one or more file upload fields to allow users to upload some files. - -These files will be sent via mail, so it could be a good idea setting a limit to them. -For example if you use Gmail as mail server, you can't send messages with attachments > 25MB. - -There is an environment variable that you can use to set that limit (in MB): - -```ini - [instance] - environment-vars = - FORM_ATTACHMENTS_LIMIT 25 -``` - -By default this is not set. - -## Content-transfer-encoding - -It is possible to set the content-transfer-encoding for the email body, settings the environment -variable `MAIL_CONTENT_TRANSFER_ENCODING`: - -```ini - [instance] - environment-vars = - MAIL_CONTENT_TRANSFER_ENCODING base64 -``` - -This is useful for some SMTP servers that have problems with `quoted-printable` encoding. - -By default the content-transfer-encoding is `quoted-printable` as overridden in -https://github.com/zopefoundation/Products.MailHost/blob/master/src/Products/MailHost/MailHost.py#L65 - -## Email subject templating - -You can also interpolate the form values to the email subject using the field id, in this way: ${123321123} - -## Header forwarding - -It is possible to configure some headers from the form POST request to be included in the email's headers by configuring the `httpHeaders` field in your volto block. - -[volto-formblock](https://github.com/collective/volto-form-block) allows the following headers to be forwarded: - -- `HTTP_X_FORWARDED_FOR` -- `HTTP_X_FORWARDED_PORT` -- `REMOTE_ADDR` -- `PATH_INFO` -- `HTTP_USER_AGENT` -- `HTTP_REFERER` - -## Data retention - -There is a script that implements data cleansing (i.e. for GDPR purpose): +You can add a behavior with the following command. ```shell - bin/instance -OPlone run bin/formsupport_data_cleansing --help - Usage: interpreter [OPTIONS] - - bin/instance -OPlone run bin/formsupport_data_cleansing [--dryrun|--no-dryrun] - - Options: - --dryrun --dryrun (default) simulate, --no-dryrun actually save the - changes - - --help Show this message and exit. +make add behavior ``` -The form block as an integer field `remove_data_after_days`, the retention days can be defined on a single block, -If the value is lower or equal to `0` there is no data cleaning for the specific form. - -## Examples - -This add-on can be seen in action at the following sites: - -- https://www.comune.modena.it/form/contatti - -## Translations - -This product has been translated into - -- Italian - -## Installation - -Install collective.volto.formsupport by adding it to your buildout:: - -```ini - [buildout] - - ... - - eggs = - collective.volto.formsupport +```{seealso} +You can check the list of available subtemplates in the [`bobtemplates.plone` `README.md` file](https://github.com/plone/bobtemplates.plone/?tab=readme-ov-file#provided-subtemplates). +See also the documentation of [Mockup and Patternslib](https://6.docs.plone.org/classic-ui/mockup.html) for how to build the UI toolkit for Classic UI. ``` -and then running `bin/buildout` - -## Contribute - -- Issue Tracker: https://github.com/collective/volto-form-block/issues -- Source Code: https://github.com/collective/volto-form-block - ## License -The project is licensed under the GPLv2. - -## Authors - -This product was developed by **RedTurtle Technology** team. - -.. image:: https://avatars1.githubusercontent.com/u/1087171?s=100&v=4 -:alt: RedTurtle Technology Site -:target: https://www.redturtle.it/ +The project is licensed under GPLv2. -## Credits and Acknowledgements 🙏 +## Credits and acknowledgements 🙏 -Crafted with care by **This was generated by [cookiecutter-plone](https://github.com/plone/cookieplone-templates/backend_addon) on 2024-07-08 10:04:24**. A special thanks to all contributors and supporters! +Generated from the [`cookieplone-templates` monorepo_addon template](https://github.com/plone/cookieplone-templates/tree/main/monorepo_addon) on 2025-11-14 13:00:05.. A special thanks to all contributors and supporters! diff --git a/backend/bobtemplate.cfg b/backend/bobtemplate.cfg new file mode 100644 index 0000000..39fc98c --- /dev/null +++ b/backend/bobtemplate.cfg @@ -0,0 +1,5 @@ +[main] +version = 6.0.13 +template = plone_addon +git_init = True +python = python3 diff --git a/backend/constraints.txt b/backend/constraints.txt deleted file mode 100644 index d32a83f..0000000 --- a/backend/constraints.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/6.0.11/constraints.txt diff --git a/backend/docs/.gitkeep b/backend/docs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/backend/instance.yaml b/backend/instance.yaml index 76e1e7a..ea8c3ea 100644 --- a/backend/instance.yaml +++ b/backend/instance.yaml @@ -1,3 +1,3 @@ default_context: initial_user_password: 'admin' - zcml_package_includes: 'collective.volto.formsupport' + zcml_package_includes: 'collective.volto.formsupport' \ No newline at end of file diff --git a/backend/mx.ini b/backend/mx.ini index 9fccb99..70f2001 100644 --- a/backend/mx.ini +++ b/backend/mx.ini @@ -14,4 +14,4 @@ main-package = -e .[test] ; url = https://github.com/collective/example.contenttype.git ; pushurl = git@github.com:collective/example.contenttype.git ; extras = test -; branch = feature-7 +; branch = master diff --git a/backend/news/.changelog_template.jinja b/backend/news/.changelog_template.jinja index 678bfa1..0cf429a 100644 --- a/backend/news/.changelog_template.jinja +++ b/backend/news/.changelog_template.jinja @@ -1,9 +1,9 @@ -{% if sections[] %} -{% for category, val in definitions.items() if category in sections[] %} +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} ### {{ definitions[category]['name'] }} -{% for text, values in sections[][category].items() %} +{% for text, values in sections[""][category].items() %} - {{ text }} {{ values|join(', ') }} {% endfor %} diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 4a237ca..a20ce23 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -1,187 +1,113 @@ [project] name = "collective.volto.formsupport" -description = "Add support for customizable forms in Volto" dynamic = ["version"] -authors = [ - { name = "RedTurtle Technology", email = "sviluppo@redturtle.it" }, -] +description = "Form Block add-on for Plone CMS." readme = "README.md" -requires-python = ">=3.8" -license = "MIT" -keywords = ["Plone", "Python", "forms", "CMS", "Volto"] -classifiers = [ - "Development Status :: 5 - Production/Stable", - "Environment :: Web Environment", - "Framework :: Plone", - "Framework :: Plone :: Addon", - "Framework :: Plone :: 6.0", - "Programming Language :: Python", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Operating System :: OS Independent", - "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", -] -dependencies = [ - "z3c.jbot", - "Zope", - "plone.api>=1.8.4", - "plone.dexterity", - "plone.keyring", - "plone.i18n", - "plone.memoize", - "plone.protect", - "plone.registry", - "plone.restapi>=8.36.0", - "plone.schema", - "plone.volto", - "Products.GenericSetup", - "Products.PortalTransforms", - "souper.plone", - "click", - "beautifulsoup4", - "jsonschema", - "pyotp", -] - -[project.urls] -Documentation = "https://github.com/collective/collective.volto.formsupport#readme" -Issues = "https://github.com/collective/collective.volto.formsupport/issues" -Source = "https://github.com/collective/collective.volto.formsupport" - -[project.entry-points."z3c.autoinclude.plugin"] -target = "plone" - -[tool.hatch.version] -path = "src/collective/volto/formsupport/about.py" - -[tool.hatch.build] -strict-naming = false -packages = ["src/collective","src/collective/volto"] - -[tool.hatch.build.targets.sdist] -exclude = [ - "/.github", +license = "GPL-2.0-only" +requires-python = ">=3.12" +authors = [ + { name = "Plone Foundation", email = "collective@plone.org" }, ] - -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[tool.hatch.env] -requires = [ - "hatch-pip-compile" +keywords = [ + "CMS", + "Plone", + "Python", ] - -[tool.hatch.envs.default] -type = "pip-compile" -path = ".venv" -pip-compile-resolver = "uv" -pip-compile-installer = "uv" -lock-filename = "requirements.lock" -pip-compile-args = [ - "--constraint", - "constraints-mxdev.txt", +classifiers = [ + "Development Status :: 3 - Alpha", + "Environment :: Web Environment", + "Framework :: Plone","Framework :: Plone :: 6.1", + "Framework :: Plone :: Addon", + "Operating System :: OS Independent", + "Programming Language :: Python","Programming Language :: Python :: 3.12", ] dependencies = [ - "collective.honeypot", - "collective.MockMailHost", - "collective.z3cform.norobots", - "coverage[toml]>=6.5", - "hatch", - "hatchling==1.24.2", - "i18ndude", - "isort", - "plone.app.iterate", - "plone.app.testing", - "plone.app.upgrade", - "plone.browserlayer", - "plone.formwidget.hcaptcha", - "plone.formwidget.recaptcha", - "plone.restapi[test]", - "Products.MailHost", - "Products.PrintingMailHost", - "pytest-plone>=0.5.0", - "pytest", - "ruff", - "zpretty", + "Products.CMFPlone", + "plone.api", + "plone.restapi", + "plone.volto", + "souper.plone", + "beautifulsoup4", + "collective.volto.otp", ] -[tool.hatch.envs.default.scripts] -test = "pytest {args:tests}" -test-cov = "coverage run -m pytest {args:tests}" -cov-report = [ - "- coverage combine", - "coverage report", -] -cov = [ - "test-cov", - "cov-report", +[project.optional-dependencies] +hcaptcha = [ + "plone.formwidget.hcaptcha>=1.0.3", ] -zpretty_lint = [ - "find src -name '*.xml'|xargs zpretty -x --check", - "find src -name '*.zcml'|xargs zpretty -z --check", +recaptcha = [ + "plone.formwidget.recaptcha", ] -zpretty_format = [ - "find src -name '*.xml'|xargs zpretty -x -i", - "find src -name '*.zcml'|xargs zpretty -z -i", +norobots = [ + "collective.z3cform.norobots", ] -lint = [ - "ruff check", - "isort --check-only src/ tests/", - "zpretty_lint" +honeypot = [ + "collective.honeypot>=2.1", ] -format = [ - "ruff format", - "isort src/ tests/", - "zpretty_format" +blocksfield = [ + "collective.volto.blocksfield", ] -i18n = [ - "python -m collective.volto.formsupport.locales.update" +test = [ + "horse-with-no-namespace", + "collective.MockMailHost", + "collective.honeypot", + "plone.formwidget.hcaptcha", + "plone.formwidget.recaptcha", + "collective.z3cform.norobots", + "collective.volto.otp", + "plone.app.testing", + "plone.restapi[test]", + "pytest", + "pytest-cov", + "pytest-plone>=1.0.0a2", ] -changelog-draft = "towncrier --draft" -[[tool.hatch.envs.all.matrix]] -python = ["3.10", "3.11", "3.12"] -[tool.coverage.run] -source_pkgs = ["collective.volto.formsupport", "tests"] -branch = true -parallel = true -omit = [ - "collective/volto/formsupport/locales/__init__.py", - "collective/volto/formsupport/locales/update.py", +[dependency-groups] +container = [ + "plone.app.upgrade", + "psycopg2==2.9.10", + "relstorage==4.1.1", + "zeo==6.0.0", ] -[tool.coverage.paths] -collective.volto.formsupport = ["src/collective/volto/formsupport"] -tests = ["tests",] -[tool.coverage.report] -skip_empty = true -show_missing = true -exclude_lines = [ - "no cov", - "if __name__ == .__main__.:", - "if TYPE_CHECKING:", -] +[project.urls] +Homepage = "https://github.com/plone/form-block" +Source = "https://github.com/plone/form-block" +Tracker = "https://github.com/plone/form-block/issues" -[tool.pytest.ini_options] -testpaths = ["tests"] +[project.entry-points."plone.autoinclude.plugin"] +target = "plone" + +[tool.uv] +managed = false + +[tool.hatch.version] +path = "src/collective/volto/formsupport/__init__.py" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build] +strict-naming = true + +[tool.hatch.build.targets.sdist] +exclude = [ + "/.github", +] -[tool.isort] -profile = "plone" +[tool.hatch.build.targets.wheel] +packages = ["src/collective"] [tool.towncrier] -package = "collective.volto.formsupport" -package_dir = "src" directory = "news/" -filename = "CHANGES.md" +filename = "CHANGELOG.md" start_string = "\n" title_format = "## {version} ({project_date})" template = "news/.changelog_template.jinja" +issue_format = "[#{issue}](https://github.com/plone/form-block/issues/{issue})" underlines = ["", "", ""] [[tool.towncrier.type]] @@ -215,7 +141,7 @@ name = "Tests" showcontent = true [tool.ruff] -target-version = "py310" +target-version = "py312" line-length = 88 fix = true lint.select = [ @@ -249,28 +175,30 @@ lint.select = [ lint.ignore = [ # DoNotAssignLambda "E731", - "S602", - "SIM102", - "S314", - "S324" ] +[tool.ruff.lint.isort] +case-sensitive = false +no-sections = true +force-single-line = true +from-first = true +lines-after-imports = 2 +lines-between-types = 1 +order-by-type = false + [tool.ruff.format] preview = true [tool.ruff.lint.per-file-ignores] -"tests/*" = ["S101"] +"tests/*" = ["E501", "RUF001", "S101"] -[tool.codespell] -ignore-words-list = "discreet,vew" -skip = "*.po,*.min.js" +[tool.pytest.ini_options] +testpaths = ["tests"] -[tool.check-manifest] -ignore = [ - ".editorconfig", - ".flake8", - ".meta.toml", - ".pre-commit-config.yaml", - "dependabot.yml", - "mx.ini", -] +[tool.coverage.run] +source_pkgs = ["collective.volto.formsupport", "tests"] +branch = true +parallel = true +omit = [ + "src/collective/volto/formsupport/locales/*.py", +] \ No newline at end of file diff --git a/backend/requirements-docker.txt b/backend/requirements-docker.txt deleted file mode 100644 index da44320..0000000 --- a/backend/requirements-docker.txt +++ /dev/null @@ -1 +0,0 @@ --c constraints.txt diff --git a/backend/requirements.txt b/backend/requirements.txt deleted file mode 100644 index 55f014e..0000000 --- a/backend/requirements.txt +++ /dev/null @@ -1 +0,0 @@ --c https://dist.plone.org/release/6.1.2/constraints.txt diff --git a/backend/src/collective/__init__.py b/backend/src/collective/__init__.py deleted file mode 100644 index 5284146..0000000 --- a/backend/src/collective/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__import__("pkg_resources").declare_namespace(__name__) diff --git a/backend/src/collective/volto/formsupport/__init__.py b/backend/src/collective/volto/formsupport/__init__.py index d247e25..f700ca0 100644 --- a/backend/src/collective/volto/formsupport/__init__.py +++ b/backend/src/collective/volto/formsupport/__init__.py @@ -5,6 +5,8 @@ import logging +__version__ = "1.0.0a0" + PACKAGE_NAME = "collective.volto.formsupport" logger = logging.getLogger(PACKAGE_NAME) diff --git a/backend/tox.ini b/backend/tox.ini deleted file mode 100644 index 04fa197..0000000 --- a/backend/tox.ini +++ /dev/null @@ -1,211 +0,0 @@ -# Generated from: -# https://github.com/plone/meta/tree/master/config/default -# See the inline comments on how to expand/tweak this configuration file -[tox] -# We need 4.4.0 for constrain_package_deps. -min_version = 4.4.0 -envlist = - lint - test - dependencies - - -## -# Add extra configuration options in .meta.toml: -# [tox] -# envlist_lines = """ -# my_other_environment -# """ -# config_lines = """ -# my_extra_top_level_tox_configuration_lines -# """ -## - -[testenv] -skip_install = true -allowlist_externals = - echo - false -# Make sure typos like `tox -e formaat` are caught instead of silently doing nothing. -# See https://github.com/tox-dev/tox/issues/2858. -commands = - echo "Unrecognized environment name {envname}" - false - -[testenv:init] -description = Prepare environment -skip_install = true -deps = - mxdev -commands = - mxdev -c mx.ini - echo "Initial setup for mxdev" - - -[testenv:format] -description = automatically reformat code -skip_install = true -deps = - pre-commit -commands = - pre-commit run -a pyupgrade - pre-commit run -a isort - pre-commit run -a black - pre-commit run -a zpretty - -[testenv:lint] -description = run linters that will help improve the code style -skip_install = true -deps = - pre-commit -commands = - pre-commit run -a - -[testenv:dependencies] -description = check if the package defines all its dependencies -skip_install = true -deps = - build - z3c.dependencychecker==2.11 -commands = - python -m build --sdist --no-isolation - dependencychecker - -[testenv:dependencies-graph] -description = generate a graph out of the dependencies of the package -skip_install = false -allowlist_externals = - sh -deps = - pipdeptree==2.5.1 - graphviz # optional dependency of pipdeptree -commands = - sh -c 'pipdeptree --exclude setuptools,wheel,pipdeptree,zope.interface,zope.component --graph-output svg > dependencies.svg' - -[testenv:test] -description = run the distribution tests -use_develop = true -skip_install = false -constrain_package_deps = true -set_env = - ROBOT_BROWSER=headlesschrome - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -# -# Set constrain_package_deps .meta.toml: -# [tox] -# constrain_package_deps = false -## -deps = - pytest-plone - pytest - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -## -# Specify additional deps in .meta.toml: -# [tox] -# test_deps_additional = """ -# -esources/plonegovbr.portal_base[test] -# """ -# -# Specify a custom constraints file in .meta.toml: -# [tox] -# constraints_file = "https://my-server.com/constraints.txt" -## -commands = - pytest --disable-warnings {posargs} {toxinidir}/tests -extras = - test - - -[testenv:coverage] -description = get a test coverage report -use_develop = true -skip_install = false -constrain_package_deps = true -set_env = - ROBOT_BROWSER=headlesschrome - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -# -# Set constrain_package_deps .meta.toml: -# [tox] -# constrain_package_deps = "false" -## -deps = - pytest-plone - pytest - coverage - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - coverage run --source plone.distribution -m pytest {posargs} --disable-warnings {toxinidir}/tests - coverage report -m --format markdown - coverage xml -extras = - test - - -[testenv:release-check] -description = ensure that the distribution is ready to release -skip_install = true -deps = - twine - build - towncrier - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - # fake version to not have to install the package - # we build the change log as news entries might break - # the README that is displayed on PyPI - towncrier build --version=100.0.0 --yes - python -m build --sdist --no-isolation - twine check dist/* - -[testenv:circular] -description = ensure there are no cyclic dependencies -use_develop = true -skip_install = false -set_env = - -## -# Specify extra test environment variables in .meta.toml: -# [tox] -# test_environment_variables = """ -# PIP_EXTRA_INDEX_URL=https://my-pypi.my-server.com/ -# """ -## -allowlist_externals = - sh -deps = - pipdeptree - pipforester - -c https://dist.plone.org/release/6.0-dev/constraints.txt - -commands = - # Generate the full dependency tree - sh -c 'pipdeptree -j > forest.json' - # Generate a DOT graph with the circular dependencies, if any - pipforester -i forest.json -o forest.dot --cycles - # Report if there are any circular dependencies, i.e. error if there are any - pipforester -i forest.json --check-cycles -o /dev/null - - -## -# Add extra configuration options in .meta.toml: -# [tox] -# extra_lines = """ -# _your own configuration lines_ -# """ -## diff --git a/backend/version.txt b/backend/version.txt index 5e32542..88d06f1 100644 --- a/backend/version.txt +++ b/backend/version.txt @@ -1 +1 @@ -6.1.2 +6.1.3 diff --git a/docker-compose.yml b/docker-compose.yml index 52dd5df..7ab17f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ --- -name: volto-form-block +name: form-block services: traefik: - image: traefik:v2.10 + image: traefik:v2.11 ports: - 80:80 @@ -11,7 +11,7 @@ services: labels: - traefik.enable=true - traefik.constraint-label=public - - traefik.http.routers.traefik-public-http.rule=Host(`traefik.volto-form-block.localhost`) + - traefik.http.routers.traefik-public-http.rule=Host(`traefik.${HOSTNAME:-form-block.localhost}`) - traefik.http.routers.traefik-public-http.entrypoints=http - traefik.http.routers.traefik-public-http.service=api@internal - traefik.http.services.traefik-public.loadbalancer.server.port=8000 @@ -31,6 +31,7 @@ services: - --accesslog - --log - --api + frontend: build: context: ./frontend @@ -47,20 +48,23 @@ services: - traefik.http.services.svc-frontend.loadbalancer.server.port=3000 # Routers ## / - - traefik.http.routers.rt-frontend.rule=Host(`volto-form-block.localhost`) + - traefik.http.routers.rt-frontend.rule=Host(`${HOSTNAME:-form-block.localhost}`) - traefik.http.routers.rt-frontend.entrypoints=http - traefik.http.routers.rt-frontend.service=svc-frontend - traefik.http.routers.rt-frontend.middlewares=gzip + backend: build: context: ./backend args: - PLONE_VERSION=${PLONE_VERSION} environment: - RELSTORAGE_DSN: "dbname='${DB_NAME:-plone}' user='${DB_NAME:-plone}' host='${DB_HOST:-db}' password='${DB_PASSWORD:-EUGpQKcQgBzw}' port='${DB_PORT:-5432}'" + RELSTORAGE_DSN: "dbname='${DB_NAME:-plone}' user='${DB_NAME:-plone}' host='${DB_HOST:-db}' password='${DB_PASSWORD:-ZmerqPXBhetx}' port='${DB_PORT:-5432}'" depends_on: - db + volumes: + - vol-site-data:/data labels: - traefik.enable=true - traefik.constraint-label=public @@ -70,34 +74,36 @@ services: # Middlewares ## VHM rewrite /++api++/ - "traefik.http.middlewares.mw-backend-vhm-api.replacepathregex.regex=^/\\+\\+api\\+\\+($$|/.*)" - - "traefik.http.middlewares.mw-backend-vhm-api.replacepathregex.replacement=/VirtualHostBase/http/volto-form-block.localhost/Plone/++api++/VirtualHostRoot$$1" + - "traefik.http.middlewares.mw-backend-vhm-api.replacepathregex.replacement=/VirtualHostBase/http/${HOSTNAME:-form-block.localhost}/Plone/++api++/VirtualHostRoot$$1" ## VHM rewrite /ClassicUI/ - "traefik.http.middlewares.mw-backend-vhm-classic.replacepathregex.regex=^/ClassicUI($$|/.*)" - - "traefik.http.middlewares.mw-backend-vhm-classic.replacepathregex.replacement=/VirtualHostBase/http/volto-form-block.localhost/Plone/VirtualHostRoot/_vh_ClassicUI$$1" + - "traefik.http.middlewares.mw-backend-vhm-classic.replacepathregex.replacement=/VirtualHostBase/http/${HOSTNAME:-form-block.localhost}/Plone/VirtualHostRoot/_vh_ClassicUI$$1" ## Basic Authentication ### Note: all dollar signs in the hash need to be doubled for escaping. ### To create user:password pair, it's possible to use this command: ### echo $(htpasswd -nb user password) | sed -e s/\\$/\\$\\$/g ### Defaults to admin:admin + - traefik.http.middlewares.mw-backend-auth.basicauth.headerField=X-Auth-ClassicUI - traefik.http.middlewares.mw-backend-auth.basicauth.users=admin:$$apr1$$uZPT5Fgu$$AmlIdamxT5ipBvPlsdfD70 # Routers - - traefik.http.routers.rt-backend-api.rule=Host(`volto-form-block.localhost`) && (PathPrefix(`/++api++`)) + - traefik.http.routers.rt-backend-api.rule=Host(`${HOSTNAME:-form-block.localhost}`) && (PathPrefix(`/++api++`)) - traefik.http.routers.rt-backend-api.entrypoints=http - traefik.http.routers.rt-backend-api.service=svc-backend - traefik.http.routers.rt-backend-api.middlewares=gzip,mw-backend-vhm-api + ## /ClassicUI - - traefik.http.routers.rt-backend-classic.rule=Host(`volto-form-block.localhost`) && PathPrefix(`/ClassicUI`) + - traefik.http.routers.rt-backend-classic.rule=Host(`${HOSTNAME:-form-block.localhost}`) && PathPrefix(`/ClassicUI`) - traefik.http.routers.rt-backend-classic.entrypoints=http - traefik.http.routers.rt-backend-classic.service=svc-backend - traefik.http.routers.rt-backend-classic.middlewares=gzip,mw-backend-auth,mw-backend-vhm-classic db: - image: postgres:14 + image: postgres:14.15 environment: POSTGRES_USER: plone - POSTGRES_PASSWORD: EUGpQKcQgBzw + POSTGRES_PASSWORD: ZmerqPXBhetx POSTGRES_DB: plone volumes: - vol-site-data:/var/lib/postgresql/data diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..71a9d07 --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,6 @@ +*.log +build +cache +cypress +Dockerfile +node_modules diff --git a/frontend/.github/workflows/acceptance.yml b/frontend/.github/workflows/acceptance.yml deleted file mode 100644 index 574f1ae..0000000 --- a/frontend/.github/workflows/acceptance.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: Acceptance tests -on: - push: - paths: - - "*.js" - - "*.json" - - "*.yaml" - - "cypress/**" - - "packages/**" - - ".github/workflows/acceptance.yml" - -env: - NODE_VERSION: 20.x - CYPRESS_RETRIES: 2 - -jobs: - - acceptance: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Enable corepack - run: corepack enable - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Cache Cypress Binary - id: cache-cypress-binary - uses: actions/cache@v4 - with: - path: ~/.cache/Cypress - key: binary-${{ env.NODE_VERSION }}-${{ hashFiles('pnpm-lock.yaml') }} - - - name: Install dependencies - run: make install - - - name: Install Cypress if not in cache - if: steps.cache-cypress-binary.outputs.cache-hit != 'true' - working-directory: core/packages/volto - run: make cypress-install - - - uses: JarvusInnovations/background-action@v1 - name: Start Servers - with: - run: | - make ci-acceptance-backend-start & - make acceptance-frontend-prod-start & - # your step-level and job-level environment variables are available to your commands as-is - # npm install will count towards the wait-for timeout - # whenever possible, move unrelated scripts to a different step - # to background multiple processes: add & to the end of the command - - wait-on: | - http-get://localhost:55001/plone - http://localhost:3000 - # IMPORTANT: to use environment variables in wait-on, you must use this form: ${{ env.VAR }} - # See wait-on section below for all resource types and prefixes - - tail: true # true = stderr,stdout - # This will allow you to monitor the progress live - - log-output-resume: stderr - # Eliminates previosuly output stderr log entries from post-run output - - wait-for: 10m - - log-output: stderr,stdout # same as true - - log-output-if: failure - - - run: make ci-acceptance-test - - # Upload Cypress screenshots - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-screenshots-acceptance - path: acceptance/cypress/screenshots - - # Upload Cypress videos - - uses: actions/upload-artifact@v4 - if: failure() - with: - name: cypress-videos-acceptance - path: acceptance/cypress/videos diff --git a/frontend/.github/workflows/changelog.yml b/frontend/.github/workflows/changelog.yml deleted file mode 100644 index a51ea11..0000000 --- a/frontend/.github/workflows/changelog.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Changelog check -on: - pull_request: - types: [assigned, opened, synchronize, reopened, labeled, unlabeled] - branches: - - main - -env: - NODE_VERSION: 20.x - ADDON_NAME: volto-form-block - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - # Fetch all history - fetch-depth: '0' - - - name: Install pipx - run: pip install towncrier - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Enable corepack - run: corepack enable - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: | - make install - - - name: Check for presence of a Change Log fragment (only pull requests) - run: | - # Fetch the pull request' base branch so towncrier will be able to - # compare the current branch with the base branch. - # Source: https://github.com/actions/checkout/#fetch-all-branches. - git fetch --no-tags origin ${BASE_BRANCH} - towncrier check --dir packages/${ADDON_NAME} - env: - BASE_BRANCH: ${{ github.base_ref }} - if: github.event_name == 'pull_request' diff --git a/frontend/.github/workflows/code.yml b/frontend/.github/workflows/code.yml deleted file mode 100644 index 79f96f4..0000000 --- a/frontend/.github/workflows/code.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Code analysis checks -on: - push: - paths: - - "*.js" - - "*.json" - - "*.yaml" - - "packages/**" - - ".github/workflows/code.yml" - -env: - NODE_VERSION: 20.x - -jobs: - codeanalysis: - runs-on: ubuntu-latest - - steps: - - name: Main checkout - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Enable corepack - run: corepack enable - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: make install - - - name: Linting - run: make lint diff --git a/frontend/.github/workflows/i18n.yml b/frontend/.github/workflows/i18n.yml deleted file mode 100644 index c8e463b..0000000 --- a/frontend/.github/workflows/i18n.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: i18n -on: - push: - paths: - - "*.js" - - "*.json" - - "*.yaml" - - "packages/**" - - ".github/workflows/i18n.yml" - -env: - NODE_VERSION: 20.x - -jobs: - unit: - runs-on: ubuntu-latest - - steps: - - name: Main checkout - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Enable corepack - run: corepack enable - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: make install - - - name: test i18n command - run: make i18n diff --git a/frontend/.github/workflows/storybook.yml b/frontend/.github/workflows/storybook.yml deleted file mode 100644 index 32a8b60..0000000 --- a/frontend/.github/workflows/storybook.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Storybook -on: - push: - paths: - - "*.js" - - "*.json" - - "*.yaml" - - "packages/**" - - ".github/workflows/storybook.yml" - -env: - NODE_VERSION: 20.x - -permissions: - contents: write - -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Enable corepack - run: corepack enable - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: make install - - - name: Generate Storybook - run: | - make storybook-build - - - name: Deploy to GitHub pages - uses: JamesIves/github-pages-deploy-action@v4 - if: ${{ github.ref == 'refs/heads/main' }} - with: - branch: gh-pages - folder: .storybook-build diff --git a/frontend/.github/workflows/unit.yml b/frontend/.github/workflows/unit.yml deleted file mode 100644 index 0de7eba..0000000 --- a/frontend/.github/workflows/unit.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Unit Tests -on: - push: - paths: - - "*.js" - - "*.json" - - "*.yaml" - - "packages/**" - - ".github/workflows/unit.yml" - -env: - NODE_VERSION: 20.x - -jobs: - unit: - runs-on: ubuntu-latest - - steps: - - name: Main checkout - uses: actions/checkout@v4 - - - name: Use Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Enable corepack - run: corepack enable - - - name: Get pnpm store directory - shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - - uses: actions/cache@v4 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-store- - - - name: Install dependencies - run: make install - - - name: Unit tests - run: make test-ci diff --git a/frontend/.gitignore b/frontend/.gitignore index cdcd937..2afc709 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -6,7 +6,7 @@ acceptance/cypress/videos/ acceptance/node_modules .storybook-build build -core +/core node_modules results yarn.lock diff --git a/frontend/.npmrc b/frontend/.npmrc index 71c6843..67cdee2 100644 --- a/frontend/.npmrc +++ b/frontend/.npmrc @@ -2,5 +2,5 @@ public-hoist-pattern[]=*eslint* public-hoist-pattern[]=*prettier* public-hoist-pattern[]=*stylelint* public-hoist-pattern[]=*cypress* -public-hoist-pattern[]=*process* -public-hoist-pattern[]=*parcel* +public-hoist-pattern[]=babel-plugin-react-intl +public-hoist-pattern[]=babel-preset-razzle diff --git a/frontend/.storybook/main.js b/frontend/.storybook/main.js index 1b15d3b..889f9e7 100644 --- a/frontend/.storybook/main.js +++ b/frontend/.storybook/main.js @@ -4,6 +4,7 @@ const path = require('path'); const projectRootPath = path.resolve('.'); const lessPlugin = require('@plone/volto/webpack-plugins/webpack-less-plugin'); +const RelativeResolverPlugin = require('@plone/volto/webpack-plugins/webpack-relative-resolver'); const scssPlugin = require('razzle-plugin-scss'); const createConfig = require('razzle/config/createConfigAsync.js'); @@ -107,9 +108,9 @@ module.exports = { [], defaultRazzleOptions, ); - const AddonConfigurationRegistry = require('@plone/registry/src/addon-registry'); + const { AddonRegistry } = require('@plone/registry/addon-registry'); - const registry = new AddonConfigurationRegistry(projectRootPath); + const { registry } = AddonRegistry.init(projectRootPath); config = lessPlugin({ registry }).modifyWebpackConfig({ env: { target: 'web', dev: 'dev' }, @@ -147,6 +148,10 @@ module.exports = { ...config.resolve, alias: { ...config.resolve.alias, ...baseConfig.resolve.alias }, fallback: { ...config.resolve.fallback, zlib: false }, + plugins: [ + ...(config.resolve.plugins || []), + new RelativeResolverPlugin(registry), + ], }, }; diff --git a/frontend/CHANGELOG.md b/frontend/CHANGELOG.md deleted file mode 100644 index 8648a8d..0000000 --- a/frontend/CHANGELOG.md +++ /dev/null @@ -1,751 +0,0 @@ -## 1.0.0-alpha.0 (2025-11-14) - -### Internal - -- Move to the new setup @sneridagh [#109](https://github.com/plone/form-block/issue/109) - -### [3.10.1](https://github.com/collective/volto-form-block/compare/v3.10.0...v3.10.1) (2024-10-03) - - -### Bug Fixes - -* always set static_text fields as not required ([3cdb14d](https://github.com/collective/volto-form-block/commit/3cdb14d9b8b892d5681f9c30fb3a9cdf422cce06)) - -## [3.10.0](https://github.com/collective/volto-form-block/compare/v3.9.3...v3.10.0) (2024-10-02) - - -### Features - -* email otp validation switchable per form ([#119](https://github.com/collective/volto-form-block/issues/119)) ([9cda160](https://github.com/collective/volto-form-block/commit/9cda1608d9a6c7bb600f27f23b305360a4e21072)) - -### [3.9.3](https://github.com/collective/volto-form-block/compare/v3.9.2...v3.9.3) (2024-09-12) - - -### Bug Fixes - -* Fix bug that form data can not be loaded for forms in accordions ([#74](https://github.com/collective/volto-form-block/issues/74)) ([9dd726f](https://github.com/collective/volto-form-block/commit/9dd726f2286f3004d7cf74ebc1df364d8e5d9fc4)) -* reset otp on formdata reset ([#116](https://github.com/collective/volto-form-block/issues/116)) ([eb259a0](https://github.com/collective/volto-form-block/commit/eb259a048ba3688116cad1aeafcf4ef49d5e0d8f)) - -### [3.9.2](https://github.com/collective/volto-form-block/compare/v3.9.1...v3.9.2) (2024-07-01) - - -### Maintenance - -* updated subject field with description text ([3080394](https://github.com/collective/volto-form-block/commit/30803949a013161b38ac650c783a45e25ae56b89)) - -### [3.9.1](https://github.com/collective/volto-form-block/compare/v3.9.0...v3.9.1) (2024-06-26) - - -### Maintenance - -* updated header and footer email fields with richtext ([c656644](https://github.com/collective/volto-form-block/commit/c65664461a934f541823be4973e257a3e3190373)) - -## [3.9.0](https://github.com/collective/volto-form-block/compare/v3.8.7...v3.9.0) (2024-06-20) - - -### Features - -* add missing german translations ([c40b1ea](https://github.com/collective/volto-form-block/commit/c40b1ea895b23990cdde29cc8b56c6de95039fed)) -* added header and footer mail fields ([#105](https://github.com/collective/volto-form-block/issues/105)) ([d74cf6c](https://github.com/collective/volto-form-block/commit/d74cf6c54c59a81d3498b2960dda443c35b7ad47)) - -### [3.8.7](https://github.com/collective/volto-form-block/compare/v3.8.6...v3.8.7) (2024-06-17) - - -### Bug Fixes - -* view message response [#96](https://github.com/collective/volto-form-block/issues/96) ([#103](https://github.com/collective/volto-form-block/issues/103)) ([7262025](https://github.com/collective/volto-form-block/commit/726202567e72e6e7540603e7439229042778323f)) - -### [3.8.6](https://github.com/collective/volto-form-block/compare/v3.8.5...v3.8.6) (2024-06-14) - - -### Bug Fixes - -* formState success ([8bbf87e](https://github.com/collective/volto-form-block/commit/8bbf87e28a339aab30ab9603eda06f85c2d51687)) - -### [3.8.5](https://github.com/collective/volto-form-block/compare/v3.8.4...v3.8.5) (2024-05-30) - - -### Bug Fixes - -* upgrade volto-subblocks to 2.1.0 ([ebc71a3](https://github.com/collective/volto-form-block/commit/ebc71a3aeade96efc33f3e7dcf27a13b2c0c3a5b)) - -### [3.8.4](https://github.com/collective/volto-form-block/compare/v3.8.3...v3.8.4) (2024-05-30) - - -### Bug Fixes - -* align-items start in CSS - Makes autoprefixer happy :/ ([#100](https://github.com/collective/volto-form-block/issues/100)) ([39ab173](https://github.com/collective/volto-form-block/commit/39ab173e6c561cbc92d0f5fef630b13535d5c9e2)) - -### [3.8.3](https://github.com/collective/volto-form-block/compare/v3.8.2...v3.8.3) (2024-05-16) - - -### Bug Fixes - -* error on form submit: Objects are not valid as a React child. ([#97](https://github.com/collective/volto-form-block/issues/97)) ([1816c1b](https://github.com/collective/volto-form-block/commit/1816c1b3d51f635f5e24843dc217a8dd33b8b2cc)) - - -### Maintenance - -* add the first few Dutch translations. ([#98](https://github.com/collective/volto-form-block/issues/98)) ([6132730](https://github.com/collective/volto-form-block/commit/6132730f361c30b346f6276ab90fb7004be10eb2)) -* eu and es translations ([#95](https://github.com/collective/volto-form-block/issues/95)) ([09c248f](https://github.com/collective/volto-form-block/commit/09c248faa9d177e8482d4342f0e1a86e0b3cacf7)) - -### [3.8.2](https://github.com/collective/volto-form-block/compare/v3.8.1...v3.8.2) (2024-04-26) - - -### Maintenance - -* removed print field id ([98278d1](https://github.com/collective/volto-form-block/commit/98278d18d2eb665d4c28e44f63da08c96a74fa9c)) - -### [3.8.1](https://github.com/collective/volto-form-block/compare/v3.8.0...v3.8.1) (2024-04-26) - - -### Bug Fixes - -* display field_id for more fields in sidebar ([e15e1ad](https://github.com/collective/volto-form-block/commit/e15e1ad071fedb11422804d3c2208109f3f54b64)) -* replace placeholder of empty fields with nothing in thamkyou message ([8e75c8b](https://github.com/collective/volto-form-block/commit/8e75c8b665476958d0ec9bab803b11d1cfdaff2b)) - -## [3.8.0](https://github.com/collective/volto-form-block/compare/v3.7.5...v3.8.0) (2024-04-18) - - -### Features - -* added bcc email validation with otp code ([#93](https://github.com/collective/volto-form-block/issues/93)) ([e2100be](https://github.com/collective/volto-form-block/commit/e2100be25ac307f7fc27a1d70de53a771badc9ea)) - -### [3.7.5](https://github.com/collective/volto-form-block/compare/v3.7.4...v3.7.5) (2024-04-17) - - -### Bug Fixes - -* replace message ([8982698](https://github.com/collective/volto-form-block/commit/8982698b4ebd191b6f27d6afe2612a80147e7143)) - -### [3.7.4](https://github.com/collective/volto-form-block/compare/v3.7.3...v3.7.4) (2024-04-16) - - -### Bug Fixes - -* fix field schema form sent_message and added customizable FormResult component ([6dd725b](https://github.com/collective/volto-form-block/commit/6dd725b7aa3d7a218a7426cfa3df9ec72c90b6a1)) -* prevent xss in form block reading sent data from BE response ([b4139d2](https://github.com/collective/volto-form-block/commit/b4139d2284102e6820b892e7e40eee7ffcd1a36d)) - - -### Maintenance - -* fix husky config ([6a47f33](https://github.com/collective/volto-form-block/commit/6a47f33fa8bd103c0b697336bd3ad59f480599ae)) - -### [3.7.3](https://github.com/collective/volto-form-block/compare/v3.7.2...v3.7.3) (2024-04-08) - - -### Maintenance - -* gitignore ([435d0d7](https://github.com/collective/volto-form-block/commit/435d0d793a1ae3a7670221cb4df5fd72254a4af8)) -* lazy loading components to improve bundle size ([#92](https://github.com/collective/volto-form-block/issues/92)) ([e791bf0](https://github.com/collective/volto-form-block/commit/e791bf032255459697b71ac3a06a2d50629c13d8)) - - - -### [3.7.2](https://github.com/collective/volto-form-block/compare/v3.7.1...v3.7.2) (2024-03-27) - - -### Bug Fixes - -* Fix 'error is null' when adding form block. ([06f8300](https://github.com/collective/volto-form-block/commit/06f830071396aeaa798c58459c068421bd47177e)) - -### [3.7.1](https://github.com/collective/volto-form-block/compare/v3.7.0...v3.7.1) (2024-03-19) - - -### Bug Fixes - -* empty props ([e03df2e](https://github.com/collective/volto-form-block/commit/e03df2e984d5338c106bf61f83c1428c08ef39dc)) - - -### Maintenance - -* removed console.log ([3022402](https://github.com/collective/volto-form-block/commit/302240223280c75dbb447697451b846ffb15e212)) - -## [3.7.0](https://github.com/collective/volto-form-block/compare/v3.5.2...v3.7.0) (2024-03-18) - - -### Features - -* added default validators for field default_from and default_to ([ba41002](https://github.com/collective/volto-form-block/commit/ba410028c45ef8472f6c68a6cefa28b4b1f34d71)) - - -### Bug Fixes - -* removed 'required' option for field type 'static_text ([32c4ef5](https://github.com/collective/volto-form-block/commit/32c4ef5e8851b29fbfddb95c0db7c86c01de4043)) - - -### Maintenance - -* removed unused translations ([164bd34](https://github.com/collective/volto-form-block/commit/164bd3422f1fe0493007e789412b5ca908fd6b8b)) - -### [3.5.2](https://github.com/collective/volto-form-block/compare/v3.5.1...v3.5.2) (2024-03-15) - - -### Bug Fixes - -* view form ([6b389bc](https://github.com/collective/volto-form-block/commit/6b389bc06ed7fd72f8f3287c230e0a7013544e42)) - -### [3.5.1](https://github.com/collective/volto-form-block/compare/v3.5.0...v3.5.1) (2024-03-15) - - -### Bug Fixes - -* view block ([18cfa82](https://github.com/collective/volto-form-block/commit/18cfa826ee0ff5296df844c4bcf7b1987e74b953)) - -## [3.5.0](https://github.com/collective/volto-form-block/compare/v3.4.1...v3.5.0) (2024-03-14) - - -### Features - -* Validate field config and fix multiple form in page ([#83](https://github.com/collective/volto-form-block/issues/83)) ([ca373b6](https://github.com/collective/volto-form-block/commit/ca373b685481988effff667f10461214766c5977)) - -### [3.4.1](https://github.com/collective/volto-form-block/compare/v3.4.0...v3.4.1) (2024-03-13) - - -### Bug Fixes - -* validator for mail ([eded840](https://github.com/collective/volto-form-block/commit/eded840689b891df98316261508cecfbbfbd63e1)) - -## [3.4.0](https://github.com/collective/volto-form-block/compare/v3.3.1...v3.4.0) (2024-03-13) - - -### Features - -* view error for each field, validate form config ([#82](https://github.com/collective/volto-form-block/issues/82)) ([23e710c](https://github.com/collective/volto-form-block/commit/23e710c0a74b3bda9a64e9e6d11e16d925847bab)) - -### [3.3.1](https://github.com/collective/volto-form-block/compare/v3.3.0...v3.3.1) (2024-02-29) - - -### Bug Fixes - -* remain in form when there's errors on sending form ([c6fe827](https://github.com/collective/volto-form-block/commit/c6fe82721906dfaac8588164a77ca145b16d0dbd)) - - - -## [3.3.0](https://github.com/collective/volto-form-block/compare/v3.2.0...v3.3.0) (2024-02-27) - - -### Features - -* validate email field ([6572342](https://github.com/collective/volto-form-block/commit/65723428812859e84a1661181c4f75aa7f0a947c)) - - -### Maintenance - -* lint/husky ([bb32a2f](https://github.com/collective/volto-form-block/commit/bb32a2fcd7a8350dcecfce3a8cdd07a0767a7c79)) -* updated lockfile ([ec16920](https://github.com/collective/volto-form-block/commit/ec16920763e49ae4691f562a90ba404b665830de)) - -## [3.2.0](https://github.com/collective/volto-form-block/compare/v3.1.0...v3.2.0) (2023-12-11) - - -### Features - -* added form reset button and an user customizable submit confirm message ([#75](https://github.com/collective/volto-form-block/issues/75)) ([0c83317](https://github.com/collective/volto-form-block/commit/0c833175e5e57e6c6a758fc04c4a09ff39142e98)) - -## [3.1.0](https://github.com/collective/volto-form-block/compare/v3.0.1...v3.1.0) (2023-05-29) - - -### Features - -* added hidden field type ([#53](https://github.com/collective/volto-form-block/issues/53)) ([5650ee5](https://github.com/collective/volto-form-block/commit/5650ee557a2fc6cbbf6a70bcf7df469a281b974a)) -* make attachment type field list configurable in config ([#59](https://github.com/collective/volto-form-block/issues/59)) ([55cfe9d](https://github.com/collective/volto-form-block/commit/55cfe9dcfc38ccafcec0bc9fcbd4aa0bd3b72b3b)) - - -### Bug Fixes - -* captcha provider selection widget ([ba9ecd2](https://github.com/collective/volto-form-block/commit/ba9ecd2d2ec5843b43c9d9d283faeb14b3d29f1e)) -* i18n ([3d0fd99](https://github.com/collective/volto-form-block/commit/3d0fd991e0e58dd4061ba2d3e08d7d2142cc2afd)) -* swap store / send description ([#66](https://github.com/collective/volto-form-block/issues/66)) ([b76c1ec](https://github.com/collective/volto-form-block/commit/b76c1ec93daf48103e1da4fb31bda91a56b57fba)) -* use string for field_type ([#64](https://github.com/collective/volto-form-block/issues/64)) ([f031914](https://github.com/collective/volto-form-block/commit/f03191430011c3f2554b68635c7cb1639f2aa061)) - -### [3.0.1](https://github.com/collective/volto-form-block/compare/v3.0.0...v3.0.1) (2023-02-06) - - -### Bug Fixes - -* add missing dep on volto-subblocks ([#49](https://github.com/collective/volto-form-block/issues/49)) ([90f605b](https://github.com/collective/volto-form-block/commit/90f605b9a2c7389e75bc9a4345a6b8c4d4cb7247)) -* field extenders should be applied in FormView ([#44](https://github.com/collective/volto-form-block/issues/44)) ([4d063c6](https://github.com/collective/volto-form-block/commit/4d063c6247fd504116c18efb42e47320265f6987)) - -## [3.0.0](https://github.com/collective/volto-form-block/compare/v2.8.1...v3.0.0) (2022-10-30) - - -### Changes - -* upgraded dependencies and babel config for volto 16 ([#47](https://github.com/collective/volto-form-block/issues/47)) ([5ec2bb6](https://github.com/collective/volto-form-block/commit/5ec2bb6201b59aaa424c6d83a57c97f254267007)) - -### [2.8.1](https://github.com/collective/volto-form-block/compare/v2.8.0...v2.8.1) (2022-10-19) - - -### Bug Fixes - -* fixed imports and codereview ([e6863eb](https://github.com/collective/volto-form-block/commit/e6863ebfc61b8afe6fb98e102b616983536509f4)) -* updated it translations ([4d683f3](https://github.com/collective/volto-form-block/commit/4d683f3d43fe29a9779dbbb770411b3834117e7c)) - -## [2.8.0](https://github.com/collective/volto-form-block/compare/v2.7.1...v2.8.0) (2022-10-07) - - -### Features - -* scroll the window to the top of the form after submitting it succesfully ([#43](https://github.com/collective/volto-form-block/issues/43)) ([3c26486](https://github.com/collective/volto-form-block/commit/3c26486ae305ed173e86025f9d3b36e5fc6ad1c0)) - - -### Bug Fixes - -* set norobots captcha as required ([9d73566](https://github.com/collective/volto-form-block/commit/9d73566df9b234e0c8da08b5dcc3240cc9f9670d)) - -### [2.7.1](https://github.com/collective/volto-form-block/compare/v2.7.0...v2.7.1) (2022-09-30) - - -### Bug Fixes - -* show only the error message and not the http error code ([d328505](https://github.com/collective/volto-form-block/commit/d3285057b40fa25b869edb76a4e64c9177291390)) - -## [2.7.0](https://github.com/collective/volto-form-block/compare/v2.6.1...v2.7.0) (2022-09-30) - - -### Features - -* do not reset the form when a backend error happens ([ff33951](https://github.com/collective/volto-form-block/commit/ff33951fa44951420341f25cdaddd625b3db5bac)) - -### [2.6.1](https://github.com/collective/volto-form-block/compare/v2.6.0...v2.6.1) (2022-09-21) - - -### Bug Fixes - -* removed semantic-ui grid class ([f8c5b65](https://github.com/collective/volto-form-block/commit/f8c5b65de964fc15ed2ded7939c710b277907e06)) - -## [2.6.0](https://github.com/collective/volto-form-block/compare/v2.5.0...v2.6.0) (2022-09-21) - - -### Features - -* added honeypot field type ([272e3c3](https://github.com/collective/volto-form-block/commit/272e3c3093c0dbc253f2a2406125cc497354cd01)) -* added honeypot widget captcha ([2723f52](https://github.com/collective/volto-form-block/commit/2723f5281fb918f2baf30940a746a956b85cc49c)) - - -### Bug Fixes - -* fix captcha widget ([b4d990c](https://github.com/collective/volto-form-block/commit/b4d990ca822d0c42e263194e3e91221fc7715dd2)) -* fix captcha widget manage token ([1a3c19b](https://github.com/collective/volto-form-block/commit/1a3c19bfa644147024347bc543f3cb8cc73e7f6d)) -* fix HoneypotWidget props ([cd294c4](https://github.com/collective/volto-form-block/commit/cd294c45b54920c6f0d0f15c70a9b33469bfa6a0)) -* fixed const variables and added row class ([300d6c9](https://github.com/collective/volto-form-block/commit/300d6c9c560163e2fec455c9e23bc8af4552fddc)) - - -### Maintenance - -* added captcha value of submit request ([1946a08](https://github.com/collective/volto-form-block/commit/1946a0839cda2e19693c21cc64c48c79395b32e7)) -* updated yarn.lock ([f49b32f](https://github.com/collective/volto-form-block/commit/f49b32fd7dec1942efdd4ed84dbe2d5ac2feeebd)) - -## [2.5.0](https://github.com/collective/volto-form-block/compare/v2.4.2...v2.5.0) (2022-09-05) - - -### Features - -* handled collective.volto.formsupport.captcha.providers vocabulary ([12060e7](https://github.com/collective/volto-form-block/commit/12060e77eaa863a5b8792ad2c604f034546f7e06)) - - -### Bug Fixes - -* fixed disabled submit button ([e1026bc](https://github.com/collective/volto-form-block/commit/e1026bcff8b36cf69b8dd648cff6b6b00cdf02e8)) -* send captcha to backend to make it effective ([15b4a4f](https://github.com/collective/volto-form-block/commit/15b4a4f9701baa5427d3048f53f55226f5bcde18)) -* send captcha to backend to make it effective ([a9f422b](https://github.com/collective/volto-form-block/commit/a9f422bc4f9f5d13f6b923d0eb26b785cd4308c1)) - - -### Maintenance - -* updated README ([1d76435](https://github.com/collective/volto-form-block/commit/1d764354a4332ba21509b9aceba133da6dcaa062)) -* updated README ([3dd04ca](https://github.com/collective/volto-form-block/commit/3dd04ca2a924ed07de6aef960990b2544c370dd3)) - -### [2.4.2](https://github.com/collective/volto-form-block/compare/v2.4.1...v2.4.2) (2022-08-05) - -### [2.4.1](https://github.com/collective/volto-form-block/compare/v2.4.0...v2.4.1) (2022-07-07) - - -### Bug Fixes - -* a11y screen reader for checkbox and radio grooups ([9433cc1](https://github.com/collective/volto-form-block/commit/9433cc1b36fc4019f25fed25ca8209e62dc9e511)) - -## [2.4.0](https://github.com/collective/volto-form-block/compare/v2.3.6...v2.4.0) (2022-07-07) - - -### Features - -* added a11y support for fields ([bce0433](https://github.com/collective/volto-form-block/commit/bce0433ed074a2108a594de3372929ee98954448)) - -### [2.3.6](https://github.com/collective/volto-form-block/compare/v2.3.5...v2.3.6) (2022-05-27) - - -### Maintenance - -* updated volto-subblocks ([c8d7095](https://github.com/collective/volto-form-block/commit/c8d7095c35d83b99723a9ff11edda6170edbfd74)) - -### [2.3.5](https://github.com/collective/volto-form-block/compare/v2.3.4...v2.3.5) (2022-05-24) - - -### Maintenance - -* updated volto-subblocks for lazyloding libraries ([311f29e](https://github.com/collective/volto-form-block/commit/311f29e070164869e16c0eda3fa77273468c050d)) - -### [2.3.4](https://github.com/collective/volto-form-block/compare/v2.3.3...v2.3.4) (2022-05-23) - - -### Maintenance - -* updated volto-subblocks for lazyloading libraries ([b817efd](https://github.com/collective/volto-form-block/commit/b817efd917add700260824b7ba1d4d11f8b873d5)) - -### [2.3.3](https://github.com/collective/volto-form-block/compare/v2.3.2...v2.3.3) (2022-05-17) - -### [2.3.2](https://github.com/collective/volto-form-block/compare/v2.3.1...v2.3.2) (2022-05-13) - - -### Bug Fixes - -* fixed name for static fields! ([8e4452f](https://github.com/collective/volto-form-block/commit/8e4452f9e2fff4008ad22663a181aa1e4c58ac70)) - -### [2.3.1](https://github.com/collective/volto-form-block/compare/v2.3.0...v2.3.1) (2022-05-11) - - -### Bug Fixes - -* fixed date format in send email ([758a64a](https://github.com/collective/volto-form-block/commit/758a64a41a283e0cbd01b4461f3eae0f36221058)) - -## [2.3.0](https://github.com/collective/volto-form-block/compare/v2.2.3...v2.3.0) (2022-03-25) - - -### Features - -* added use_as_bcc for 'email' field ([b46b1fa](https://github.com/collective/volto-form-block/commit/b46b1fa9c421fba9631151e66bdecdae61fcd423)) - -### [2.2.3](https://github.com/collective/volto-form-block/compare/v2.2.2...v2.2.3) (2022-01-28) - -### Maintenance - -* **i18n:** add german translations ([c9d7c98](https://github.com/collective/volto-form-block/pull/21/commits/c9d7c98b548137de4139a7f06bf187af228c0cfb)) - - -### [2.2.2](https://github.com/collective/volto-form-block/compare/v2.2.1...v2.2.2) (2022-01-27) - -### [2.2.1](https://github.com/collective/volto-form-block/compare/v2.1.2...v2.2.1) (2022-01-21) - - -### Bug Fixes - -* fix package.json ([b2d556d](https://github.com/collective/volto-form-block/commit/b2d556d5b4f8a7de2df5732c39394e081022141d)) - - -### Maintenance - -* removed comment ([4e3aa08](https://github.com/collective/volto-form-block/commit/4e3aa088f458d6b7417c7ee04ce15b7d3923a11d)) -* revert some fixes ([2107bee](https://github.com/collective/volto-form-block/commit/2107bee7f9d9ec34e24c2787b543bdd382da6b56)) - -### [2.1.2](https://github.com/collective/volto-form-block/compare/v2.1.1...v2.1.2) (2022-01-04) - - -### Bug Fixes - -* fixed ArrayWidget in sidebar ([ad43bbd](https://github.com/collective/volto-form-block/commit/ad43bbded5e061d7f595db5e0fda7eba54756c0d)) - -### [2.1.1](https://github.com/collective/volto-form-block/compare/v2.1.0...v2.1.1) (2021-11-25) - - -### Maintenance - -* **i18n:** add es translation ([86ebaba](https://github.com/collective/volto-form-block/commit/86ebaba68e6bc0de0866e43f8ee80135422f948c)) -* **i18n:** add eu translation ([c1ee795](https://github.com/collective/volto-form-block/commit/c1ee795dd92fe23c07ff6e13039b291e6497924e)) - -## [2.1.0](https://github.com/collective/volto-form-block/compare/v2.0.3...v2.1.0) (2021-10-25) - - -### Bug Fixes - -* readme title ([2d56ace](https://github.com/collective/volto-form-block/commit/2d56aced8a7ebd1bfbbbde1054694948f6b17396)) - - -### Maintenance - -* upgrade to volto 14, use @plone/script i18n ([3069217](https://github.com/collective/volto-form-block/commit/30692170860ebe50df5677d6992b209a8995fc10)) - -### [2.0.3](https://github.com/collective/volto-form-block/compare/v2.0.2...v2.0.3) (2021-10-19) - - -### Bug Fixes - -* fixed field name if label is duplicate ([734f7e6](https://github.com/collective/volto-form-block/commit/734f7e6b518756256ff0b8b3044e451100e6f9be)) - -### [2.0.2](https://github.com/collective/volto-form-block/compare/v2.0.1...v2.0.2) (2021-08-25) - - -### Bug Fixes - -* fix field name if no label is set ([a306050](https://github.com/collective/volto-form-block/commit/a306050313b1c945a10b0c97e64026d6154a395b)) - -### [2.0.1](https://github.com/collective/volto-form-block/compare/v2.0.0...v2.0.1) (2021-08-24) - - -### Bug Fixes - -* checkbox field validation ([532caae](https://github.com/collective/volto-form-block/commit/532caae1e0a1df6c2b84cf640f4aae55a9e15f91)) - -## [2.0.0](https://github.com/collective/volto-form-block/compare/v1.8.1...v2.0.0) (2021-08-20) - - -### ⚠ BREAKING CHANGES - -* add checkbox field, rename old checkbox and radio - -### Features - -* add checkbox field, rename old checkbox and radio ([669e88b](https://github.com/collective/volto-form-block/commit/669e88bd7a9dbc3b1e13b6f0581effbdda413ce9)) -* add static rich text field ([b5e127d](https://github.com/collective/volto-form-block/commit/b5e127d37dd573c9f99912154db8969e2945782f)) -* sidebar option for invisible hcaptcha ([e793acc](https://github.com/collective/volto-form-block/commit/e793accb985a3b06bef61c097f965d2c70d79309)) - - -### Bug Fixes - -* static text field styles ([6296dcb](https://github.com/collective/volto-form-block/commit/6296dcb665fe8aa66ccd3637756eddf6bbbad15d)) - - -### Changes - -* captcha components with loadable ([83d504b](https://github.com/collective/volto-form-block/commit/83d504b2cffd690b8db4f45b3e702108e457c582)) -* captcha token usage, button disabled condition ([4e7556c](https://github.com/collective/volto-form-block/commit/4e7556c2ab1bb584bd3cc434784aa21bbce6302d)) -* captcha widgets with loadable, form -> view ([0b0b13f](https://github.com/collective/volto-form-block/commit/0b0b13f639643f436bc0de51e87d1569cd364e21)) -* disable button logic and env vars ([d09dcce](https://github.com/collective/volto-form-block/commit/d09dcce9eb09257c65385758f2a851947c931d03)) -* row padded top ([940a3ec](https://github.com/collective/volto-form-block/commit/940a3ec9ff3da22e82c7533e929533a67aec1185)) - - -### Maintenance - -* add editorConfig ([470101d](https://github.com/collective/volto-form-block/commit/470101d8b82aa119e793a3355a8e7d9a5933134c)) -* add release-it dev ([485efc4](https://github.com/collective/volto-form-block/commit/485efc4ed132bc662d94da778ad9a3651a602449)) -* added exports ([4072c78](https://github.com/collective/volto-form-block/commit/4072c7842d4061b1cd2f631ee4e2a744f49a889d)) -* **i18n:** update translations ([060403c](https://github.com/collective/volto-form-block/commit/060403c0b952baeb85bc1ef6a1d64cc296161779)) -* remove redraft unused import ([66bbc7d](https://github.com/collective/volto-form-block/commit/66bbc7d41c7824538c2ad1a9cac0ffaed1a72929)) -* update editorConfig ([0783f63](https://github.com/collective/volto-form-block/commit/0783f6343ee122910688c91c048ee4b837a2e590)) -* update locales ([c60cf68](https://github.com/collective/volto-form-block/commit/c60cf6863be10be416f8a52f851c29104fd2622b)) - -### [1.8.1](https://github.com/collective/volto-form-block/compare/v1.8.0...v1.8.1) (2021-08-10) - - -### Bug Fixes - -* form validation prop ([6a1c96b](https://github.com/collective/volto-form-block/commit/6a1c96b6b95abf05b4184ac952488e548a2b7dfb)) - -## [1.8.0](https://github.com/collective/volto-form-block/compare/v1.7.0...v1.8.0) (2021-08-09) - - -### Features - -* add hcaptcha integration ([3ae4599](https://github.com/collective/volto-form-block/commit/3ae45995bef9ef11819d76b2ca1d7316eb79e24e)) - - -### Maintenance - -* **i18n:** fix italian translation ([b027874](https://github.com/collective/volto-form-block/commit/b027874f26b30e81c7df0810fa3d13c0a5dd206a)) -* update package.json tags ([9f94c72](https://github.com/collective/volto-form-block/commit/9f94c722b2db0cdb7dae24e88f0750ff02fce678)) - -## [1.7.0](https://github.com/collective/volto-form-block/compare/v1.6.0...v1.7.0) (2021-08-05) - - -### Features - -* add validation fn for additionalFields ([61409f0](https://github.com/collective/volto-form-block/commit/61409f0b72c77dd7f93fd5a71c5d8ed1633f8bda)) -* additionalFields from config ([29cacb1](https://github.com/collective/volto-form-block/commit/29cacb115c499654a7e79343a971ccd4fc5a0e48)) - - -### Bug Fixes - -* additionalFields validation + static field className ([0d3e2b8](https://github.com/collective/volto-form-block/commit/0d3e2b81dfdbe48d06cc3e21504cfbe71c760c05)) - - -### Changes - -* update readme + translations ([62b25c2](https://github.com/collective/volto-form-block/commit/62b25c21c0705b17ae000ce2ea5364a186d89d9c)) - -## [1.6.0](https://github.com/collective/volto-form-block/compare/v1.5.2...v1.6.0) (2021-07-05) - - -### Features - -* add title and description ([0b7be9f](https://github.com/collective/volto-form-block/commit/0b7be9f4372c617dbcc0bcf38e8233c0662d7526)) - - -### Bug Fixes - -* typo in readme ([29119b4](https://github.com/collective/volto-form-block/commit/29119b4db4cd4109fc728c8e548a5d85800f187c)) - -### [1.5.2](https://github.com/collective/volto-form-block/compare/v1.5.1...v1.5.2) (2021-05-13) - - -### Maintenance - -* add release-it config, commitlint ([52deb93](https://github.com/collective/volto-form-block/commit/52deb939721b83b5369738e143757bf0c7ea0cb3)) - -### Changelog - -All notable changes to this project will be documented in this file. Dates are displayed in UTC. - -Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - -#### [v1.5.1](https://github.com/collective/volto-form-block/compare/v1.5.0...v1.5.1) - -- Add Brazilian Portuguese translations. [`#3`](https://github.com/collective/volto-form-block/pull/3) - -#### [v1.5.0](https://github.com/collective/volto-form-block/compare/v1.4.4...v1.5.0) - -> 8 April 2021 - -- feat: add email field 'use as reply to' option [`#2`](https://github.com/collective/volto-form-block/pull/2) -- Release 1.5.0 [`4c17ad7`](https://github.com/collective/volto-form-block/commit/4c17ad77f4ba755a3ee9414587cd2c961cb0d401) -- refactor: change useAsReplyTo in snake case [`6fbb95d`](https://github.com/collective/volto-form-block/commit/6fbb95d1e995211d48f30be3aed2a3ebd11dfdde) - -#### [v1.4.4](https://github.com/collective/volto-form-block/compare/v1.4.3...v1.4.4) - -> 24 March 2021 - -- chore: update translations [`6cf2b5a`](https://github.com/collective/volto-form-block/commit/6cf2b5acf155a1b92073973add90794dcf5f6122) -- Release 1.4.4 [`36c69d9`](https://github.com/collective/volto-form-block/commit/36c69d93bfe6ed50503fc97d06bef96d88b1aa85) - -#### [v1.4.3](https://github.com/collective/volto-form-block/compare/v1.4.2...v1.4.3) - -> 24 March 2021 - -- Release 1.4.3 [`feccc66`](https://github.com/collective/volto-form-block/commit/feccc66e517605b5fd9a12e4bbc5d897f4a66cbe) -- fix: remove console.log [`8853ce0`](https://github.com/collective/volto-form-block/commit/8853ce0505189b62cab597122594a0723510e5cd) - -#### [v1.4.2](https://github.com/collective/volto-form-block/compare/v1.4.1...v1.4.2) - -> 23 March 2021 - -- chore(i18n): update translations [`980a0b8`](https://github.com/collective/volto-form-block/commit/980a0b861ab4f6d3550e5d641874287a71cd89a5) -- Release 1.4.2 [`5234eff`](https://github.com/collective/volto-form-block/commit/5234eff28b1a9db1b1e4178a4f3d11fc64664746) - -#### [v1.4.1](https://github.com/collective/volto-form-block/compare/v1.4.0...v1.4.1) - -> 20 March 2021 - -- docs: add features in readme and yt demos [`d63e926`](https://github.com/collective/volto-form-block/commit/d63e92678cc2f2e08f4bec87af363ac296e94936) -- Release 1.4.1 [`ab522a1`](https://github.com/collective/volto-form-block/commit/ab522a158ac3970482318a41e217f30d70d05c0d) -- docs: update readme [`c104224`](https://github.com/collective/volto-form-block/commit/c104224a0d8c4244a201c1cf2985398767c5e3c0) -- docs: update readme [`a789970`](https://github.com/collective/volto-form-block/commit/a7899705d376a6d118e9d44dd657bce9a2b7db43) -- chore(i18n): update translations [`e82192b`](https://github.com/collective/volto-form-block/commit/e82192b43f65fe7e364446a8910de3d2d4ca3726) - -#### [v1.4.0](https://github.com/collective/volto-form-block/compare/v1.3.5...v1.4.0) - -> 19 March 2021 - -- Release 1.4.0 [`b89405d`](https://github.com/collective/volto-form-block/commit/b89405d7b84488159994663a4e6ee56b319b44a7) -- refactor: attachment info styles [`2904849`](https://github.com/collective/volto-form-block/commit/290484910165a0f246f680bec5cbdc916d0e4437) -- refactor: fix translation, add attachment info [`73dd6e1`](https://github.com/collective/volto-form-block/commit/73dd6e1e3cdc77c9880b69386aa4136887593da7) -- feat: reset form state when navigating [`cfc4f37`](https://github.com/collective/volto-form-block/commit/cfc4f3712aea25d0051548971c36e676fd5e340b) -- fix: attachment info styles [`00ab8bb`](https://github.com/collective/volto-form-block/commit/00ab8bbe1e504fd9b070fa06786d11f78c839617) - -#### [v1.3.5](https://github.com/collective/volto-form-block/compare/v1.3.4...v1.3.5) - -> 19 March 2021 - -- refactor: add file attachment info text [`277640a`](https://github.com/collective/volto-form-block/commit/277640a5c90f47729b6a928f0b0e4cfd431093fa) -- Release 1.3.5 [`ff2e272`](https://github.com/collective/volto-form-block/commit/ff2e272f31945b496828e85f85f0f4210979d577) - -#### [v1.3.4](https://github.com/collective/volto-form-block/compare/v1.3.3...v1.3.4) - -> 19 March 2021 - -- Release 1.3.4 [`85c511c`](https://github.com/collective/volto-form-block/commit/85c511cc561d9f789dd671b188fd956dd0aa9f13) -- chore(i18n): add translations [`9d59f0c`](https://github.com/collective/volto-form-block/commit/9d59f0c6585badc04d07ec76e3a90dad6bb6ace2) - -#### [v1.3.3](https://github.com/collective/volto-form-block/compare/v1.3.2...v1.3.3) - -> 19 March 2021 - -- Release 1.3.3 [`9d90ce5`](https://github.com/collective/volto-form-block/commit/9d90ce588cccd5daf05d6ff23bbcc3fcfa394f5d) -- fix: translations [`327d43a`](https://github.com/collective/volto-form-block/commit/327d43a3b9ef81a28aaa435ac7943dda59c603ec) - -#### [v1.3.2](https://github.com/collective/volto-form-block/compare/v1.3.1...v1.3.2) - -> 19 March 2021 - -- Release 1.3.2 [`9b8d0ac`](https://github.com/collective/volto-form-block/commit/9b8d0acdb2ed2ecf4f796bc44e417b4497a368a4) -- fix: form errors handling [`4c64932`](https://github.com/collective/volto-form-block/commit/4c64932b89217ba75040ebbef99ee1816acfe008) - -#### [v1.3.1](https://github.com/collective/volto-form-block/compare/v1.3.0...v1.3.1) - -> 18 March 2021 - -- Release 1.3.1 [`f2cfec1`](https://github.com/collective/volto-form-block/commit/f2cfec14d6fa8942c6ddf8eca55f5c0e01012feb) -- chore(i18n): updated translations [`d0b1e09`](https://github.com/collective/volto-form-block/commit/d0b1e09c1a4090b35ba5f83f9afe62ff200b7b9d) - -#### [v1.3.0](https://github.com/collective/volto-form-block/compare/v1.2.2...v1.3.0) - -> 18 March 2021 - -- feat: add multiple value checkbox widget [`0f86816`](https://github.com/collective/volto-form-block/commit/0f868164d80bb250b6fe8a29685c40b5930c80da) -- Release 1.3.0 [`aa8ad2b`](https://github.com/collective/volto-form-block/commit/aa8ad2b21396b4e7b374aae57b4284cf13e30c75) - -#### [v1.2.2](https://github.com/collective/volto-form-block/compare/v1.2.1...v1.2.2) - -> 18 March 2021 - -- refactor: add cancel translation [`608d3bd`](https://github.com/collective/volto-form-block/commit/608d3bd28660f0b2f5c80f5d9486076b9fd32088) -- Release 1.2.2 [`ae30355`](https://github.com/collective/volto-form-block/commit/ae303556044822a0f726d82d194b8c6136d7eb49) - -#### [v1.2.1](https://github.com/collective/volto-form-block/compare/v1.2.0...v1.2.1) - -> 18 March 2021 - -- fix: form reset [`84c6087`](https://github.com/collective/volto-form-block/commit/84c608737159cd8b7694d2ae4bed194bb671f253) -- Release 1.2.1 [`cb63ff1`](https://github.com/collective/volto-form-block/commit/cb63ff1851643233e609a0fc52731130c714c281) -- refactor: add autocomplete off [`5147c5f`](https://github.com/collective/volto-form-block/commit/5147c5f1e913b6a998f452c24aa67bf99157a93e) - -#### [v1.2.0](https://github.com/collective/volto-form-block/compare/v1.1.2...v1.2.0) - -> 18 March 2021 - -- feat: add reset form [`d07a79f`](https://github.com/collective/volto-form-block/commit/d07a79f7cc06688ef538cdb01c201b174c23eb69) -- chore(i18n): updated translations [`8115403`](https://github.com/collective/volto-form-block/commit/81154034f48284d0bcbe9fc0221d555536e2abf9) -- Release 1.2.0 [`1b3fb8f`](https://github.com/collective/volto-form-block/commit/1b3fb8ff64a60ea1cbf4667a7d8ee0436f8c90fd) -- chore(i18n): updated translations [`e7f4864`](https://github.com/collective/volto-form-block/commit/e7f4864b1e53012ee7a2d920c2d7a462aed89584) - -#### [v1.1.2](https://github.com/collective/volto-form-block/compare/v1.1.1...v1.1.2) - -> 17 March 2021 - -- fix: import paths [`9fde60d`](https://github.com/collective/volto-form-block/commit/9fde60dbecb81dbf2844ae0069bb1804e46a668b) -- Release 1.1.2 [`83b8ae8`](https://github.com/collective/volto-form-block/commit/83b8ae8ca1ff0a1ddd7688712b412b38d450794a) - -#### [v1.1.1](https://github.com/collective/volto-form-block/compare/v1.1.0...v1.1.1) - -> 16 March 2021 - -- refactor: improved translations [`5351b1f`](https://github.com/collective/volto-form-block/commit/5351b1f08dbd70f6b954a05bf215e6ca7b699597) -- Release 1.1.1 [`e9ca9bb`](https://github.com/collective/volto-form-block/commit/e9ca9bbf078828ba3b6279ef4e874900ac14fbe3) - -#### [v1.1.0](https://github.com/collective/volto-form-block/compare/v1.0.0...v1.1.0) - -> 16 March 2021 - -- feat: add static fields rendering [`da6ae8d`](https://github.com/collective/volto-form-block/commit/da6ae8dd0729b511a1de87a39fab0ad14037cb32) -- Release 1.1.0 [`1e76e9b`](https://github.com/collective/volto-form-block/commit/1e76e9b451d1514ed6f57e587b37253a223ef8e8) -- feat: add static fields [`746e62e`](https://github.com/collective/volto-form-block/commit/746e62e1eadbf1316f271fc762fd62b980e4d278) -- fix: add field_type for static fields [`85ed53f`](https://github.com/collective/volto-form-block/commit/85ed53f1676d3b19452152b069df8e5a69929ce3) - -#### v1.0.0 - -> 15 March 2021 - -- feat: add form block [`8857ec5`](https://github.com/collective/volto-form-block/commit/8857ec5f96069586113b9ac623f9e902b6a1ce5c) -- chore(i18n): add translations [`58fd2d0`](https://github.com/collective/volto-form-block/commit/58fd2d04f45c4cd24ed37564112132ceabeac98d) -- feat: add export/clear buttons [`9dc8545`](https://github.com/collective/volto-form-block/commit/9dc85458c02dc35b7cc8e085a7d0657622e26218) -- refactor(i18n): add translations, used en default [`be2f7d0`](https://github.com/collective/volto-form-block/commit/be2f7d05619db87f71a2fd87ced5415911cff3d2) -- chore: add addon scripts [`842b242`](https://github.com/collective/volto-form-block/commit/842b242cb0da7ae4232dc98e4ab601e7f82ffb77) -- chore: removed unused module [`9e2038a`](https://github.com/collective/volto-form-block/commit/9e2038a2f9d065faa2581e00e08f154049310207) -- first commit [`db2c10d`](https://github.com/collective/volto-form-block/commit/db2c10d209c6e93adb850babf7ddd6544b97e6d4) -- fix: form fields [`e69764c`](https://github.com/collective/volto-form-block/commit/e69764c018a2c527b749faee339a0967b9471f17) -- fix: field styles and fileWidget props [`daa1d22`](https://github.com/collective/volto-form-block/commit/daa1d22e7a4e8e8da24139daf99f953da0fec600) -- refactor: add confirm message [`e321e76`](https://github.com/collective/volto-form-block/commit/e321e7659ee69267217c3393689bbec735c3dfc3) -- fix: required fields label [`05da825`](https://github.com/collective/volto-form-block/commit/05da825bb51a6dafcc5917b37d855b12a68b5baf) -- feat: submit form with formsupport [`b27b736`](https://github.com/collective/volto-form-block/commit/b27b736552a995831f3ecd5d384c1592059f0c81) -- docs: fix jsdoc [`b776472`](https://github.com/collective/volto-form-block/commit/b776472e3dfdcb70bedaafee21d83d8d47cfa346) -- Release 1.0.0 [`2e3e54a`](https://github.com/collective/volto-form-block/commit/2e3e54a58fb8f2cfa5792f38f0698567552a604a) -- chore: add dependencies [`24a83bc`](https://github.com/collective/volto-form-block/commit/24a83bc30f73a50290acc833a047d4684c187db9) -- chore: add addon scripts [`33b5ad6`](https://github.com/collective/volto-form-block/commit/33b5ad66ab292da9124d0083e403b113645dfad8) -- Update README.md [`231fa90`](https://github.com/collective/volto-form-block/commit/231fa907def440a67cfbc74bf21977461d9b94a2) \ No newline at end of file diff --git a/frontend/Dockerfile b/frontend/Dockerfile index b081320..aa8a08f 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -3,7 +3,7 @@ ARG VOLTO_VERSION # TODO: Replace with # FROM plone/frontend-builder:${VOLTO_VERSION} # when the main image is ready -FROM ghcr.io/kitconcept/frontend-builder:${VOLTO_VERSION} AS builder +FROM plone/frontend-builder:${VOLTO_VERSION} AS builder COPY --chown=node packages/volto-form-block /app/packages/volto-form-block COPY --chown=node volto.config.js /app/ @@ -15,13 +15,13 @@ RUN --mount=type=cache,id=pnpm,target=/app/.pnpm-store,uid=1000 < Cleaning Volto core and node_modules$(RESET)" + rm -rf core node_modules .PHONY: install install: ## Installs the add-on in a development environment @@ -48,10 +61,10 @@ start: ## Starts Volto, allowing reloading of the add-on during development build: ## Build a production bundle for distribution of the project with the add-on pnpm build -core/packages/registry/dist: core/packages/registry/src +core/packages/registry/dist: $(shell find core/packages/registry/src -type f) pnpm --filter @plone/registry build -core/packages/components/dist: core/packages/components/src +core/packages/components/dist: $(shell find core/packages/components/src -type f) pnpm --filter @plone/components build .PHONY: build-deps @@ -89,7 +102,7 @@ release-dry-run: ## Dry-run the release of the add-on on npmjs.org test: ## Run unit tests pnpm test -.PHONY: test-ci +.PHONY: ci-test ci-test: ## Run unit tests in CI # Unit Tests need the i18n to be built VOLTOCONFIG=$(pwd)/volto.config.js pnpm --filter @plone/volto i18n diff --git a/frontend/README.md b/frontend/README.md index d53e637..1b72b35 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,211 +1,78 @@ -# Volto Add-on (volto-form-block) +# Form Block (@plone/volto-form-block) -Volto addon which adds a customizable form using a block. -Intended to be used with [collective.volto.formsupport](https://github.com/collective/collective.volto.formsupport). +Form Block add-on for Plone CMS. -[![npm](https://img.shields.io/npm/v/volto-form-block)](https://www.npmjs.com/package/volto-form-block) -[![](https://img.shields.io/badge/-Storybook-ff4785?logo=Storybook&logoColor=white&style=flat-square)](https://collective.github.io/volto-form-block/) -[![Code analysis checks](https://github.com/collective/volto-form-block/actions/workflows/code.yml/badge.svg)](https://github.com/collective/volto-form-block/actions/workflows/code.yml) -[![Unit tests](https://github.com/collective/volto-form-block/actions/workflows/unit.yml/badge.svg)](https://github.com/collective/volto-form-block/actions/workflows/unit.yml) +[![npm](https://img.shields.io/npm/v/@plone/volto-form-block)](https://www.npmjs.com/package/@plone/volto-form-block) +[![](https://img.shields.io/badge/-Storybook-ff4785?logo=Storybook&logoColor=white&style=flat-square)](https://plone.github.io/volto-form-block/) +[![CI](https://github.com/plone/form-block/actions/workflows/main.yml/badge.svg)](https://github.com/plone/form-block/actions/workflows/main.yml) -## Compatibility - -> **Note**: Since version v2.0.0 of this addon, it's required [collective.volto.formsupport](https://github.com/collective/collective.volto.formsupport) 2.0.0 or higher (and its upgrade steps). -> -> **Note**: Since version v2.1.2 of this addon, it's required Volto 14.2.0 -> -> **Note**: Since version v3.0.0 of this addon, it's required Volto >= 16.0.0-alpha.38 ## Features -This addon will add in your project the Form block and the needed reducers. - -Form block in chooser - -![Form block view](./docs/form-block-view.png) - -Using the engine of subblocks, you can manage form fields adding, sorting and deleting items. - -For each field, you can select the field type from: - -- Text -- Textarea -- Select -- Single choice (radio buttons) -- Multiple choice (checkbox buttons) -- Checkbox -- Date picker -- File upload with DnD -- E-mail -- Static rich text (not a fillable field, just text to display between other fields) - -For every field you can set a label and a help text. -For select, radio and checkbox fields, you can select a list of values. - -## Captcha verification - -This form addon is configured to work with [HCaptcha](https://www.hcaptcha.com), [ReCaptcha](https://www.google.com/recaptcha/) and -[NoRobot](https://github.com/collective/collective.z3cform.norobots) to prevent spam. - -In order to make one of these integrations work, you need to add -[https://github.com/plone/plone.formwidget.hcaptcha](https://github.com/plone/plone.formwidget.hcaptcha) and/or -[https://github.com/plone/plone.formwidget.recaptcha](https://github.com/plone/plone.formwidget.recaptcha) and/or -[https://github.com/collective/collective.z3cform.norobots](https://github.com/collective/collective.z3cform.norobots) -Plone addon and configure public and private keys in controlpanels. - -### HCaptcha - -With HCaptcha integration, you also have an additional option in the sidebar in 'Captcha provider' to enable or disable the invisible captcha (see implications [here](https://docs.hcaptcha.com/faq#do-i-need-to-display-anything-on-the-page-when-using-hcaptcha-in-invisible-mode)). - -In some test scenarios it's found that the "Passing Threshold" of HCaptcha must be configured as "Auto" to get the best results. In some test cases if one sets the Threshold to "Moderate" HCaptcha starts to fail. - -### OTP email validation - -To prevent sending spam emails to users via the email address configured as sender, the 'email' fields type flagged as BCC will require the user to enter an OTP code received at the address entered in the field when user fills out the form. - -## Export + -With backend support, you can store data submitted from the form. -In Edit, you can export and clear stored data from the sidebar. +## Installation -Form export +To install your project, you must choose the method appropriate to your version of Volto. -## Additional fields -In addition to the fields described above, you can add any field you want. -If you need a field that is not supported, PRs are always welcome, but if you have to use a custom field tailored on your project needs, then you can add additional custom fields. +### Volto 18 and later -```jsx -config.blocks.blocksConfig.form.additionalFields.push({ - id: 'field type id', - label: - intl.formatMessage(messages.customFieldLabel) || - 'Label for field type select, translation obj or string', - component: MyCustomWidget, - isValid: (formData, name) => true, -}); -``` +Add `@plone/volto-form-block` to your `package.json`. -The widget component should have the following firm: - -```js -({ - id, - name, - title, - description, - required, - onChange, - value, - isDisabled, - invalid, -}) => ReactElement; +```json +"dependencies": { + "@plone/volto-form-block": "*" +} ``` -You should also pass a function to validate your field's data. -The `isValid` function accepts `formData` (the whole form data) and the name of the field, thus you can access to your fields' data as `formData[name]` but you also have access to other fields. - -`isValid` has the firm: +Add `@plone/volto-form-block` to your `volto.config.js`. -```js -(formData, name) => boolean; +```javascript +const addons = ['@plone/volto-form-block']; ``` -Example custom field [here](https://gist.github.com/nzambello/30949078616328e6ee0293e5b302bb40). +If this package provides a Volto theme, and you want to activate it, then add the following to your `volto.config.js`. -## Static fields - -In backend integration, you can add in block data an object called `static_fields` and the form block will show those in form view as readonly and will aggregate those with user compiled data. - -i.e.: aggregated data from user federated authentication: - -![Static fields](./docs/form-static-fields.png) - -## Schema validators - -If you want to validate configuration field (for example, testing if 'From email' is an address of a specific domain), you could add your validation functions to block config: - -```js -config.blocks.blocksConfig.form = { - ...config.blocks.blocksConfig.form, - schemaValidators: { - fieldname: yourValidationFN(data), - }, -}; +```javascript +const theme = '@plone/volto-form-block'; ``` -`yourValidationFN` have to return: - -- null if field is valid -- a string with the error message if field is invalid. - -## Upgrade guide - -To upgrade to version 2.4.0 you need to: - -- remove the env vars -- install [https://github.com/plone/plone.formwidget.hcaptcha](https://github.com/plone/plone.formwidget.hcaptcha) or [https://github.com/plone/plone.formwidget.recaptcha](https://github.com/plone/plone.formwidget.recaptcha) or both in Plone. -- insert private and public keys in Plone HCaptcha controlpanel or/and Plone ReCaptcha controlpanel. - -## Video demos - -- [Form usage](https://youtu.be/v5KtjEACRmI) -- [Form editing](https://youtu.be/wmTpzYBtNCQ) -- [Export stored data](https://youtu.be/3zVUaGaaVOg) - -## VERSIONS - -With volto-form-block@2.5.0 you need to upgrade collective.volto.formsupport to version 2.4.0 - -## Installation - -To install your project, you must choose the method appropriate to your version of Volto. - - ### Volto 17 and earlier -Create a new Volto project (you can skip this step if you already have one): +Create a new Volto project. +You can skip this step if you already have one. ``` npm install -g yo @plone/generator-volto -yo @plone/volto my-volto-project --addon volto-form-block +yo @plone/volto my-volto-project --addon @plone/volto-form-block cd my-volto-project ``` -Add `volto-form-block` to your package.json: +Add `@plone/volto-form-block` to your `package.json`. ```JSON "addons": [ - "volto-form-block" + "@plone/volto-form-block" ], "dependencies": { - "volto-form-block": "*" + "@plone/volto-form-block": "*" } ``` -Download and install the new add-on by running: +Download and install the new add-on. ``` yarn install ``` -Start volto with: +Start Volto. ``` yarn start ``` -### Volto 18 and later - -Add `volto-form-block` to your add-on `package.json`: - -```json -"dependencies": { - "volto-form-block": "*" -} -``` - ## Test installation Visit http://localhost:3000/ in a browser, login, and check the awesome new features. @@ -213,46 +80,41 @@ Visit http://localhost:3000/ in a browser, login, and check the awesome new feat ## Development -The development of this add-on is done in isolation using a new approach using pnpm workspaces and latest `mrs-developer` and other Volto core improvements. -For this reason, it only works with pnpm and Volto 18 (currently in alpha). +The development of this add-on is done in isolation using pnpm workspaces, the latest `mrs-developer`, and other Volto core improvements. +For these reasons, it only works with pnpm and Volto 18. + + +### Prerequisites ✅ +- An [operating system](https://6.docs.plone.org/install/create-project-cookieplone.html#prerequisites-for-installation) that runs all the requirements mentioned. +- [nvm](https://6.docs.plone.org/install/create-project-cookieplone.html#nvm) +- [Node.js and pnpm](https://6.docs.plone.org/install/create-project.html#node-js) 24 +- [Make](https://6.docs.plone.org/install/create-project-cookieplone.html#make) +- [Git](https://6.docs.plone.org/install/create-project-cookieplone.html#git) +- [Docker](https://docs.docker.com/get-started/get-docker/) (optional) -### Pre-requisites +### Installation 🔧 -- [Node.js](https://6.docs.plone.org/install/create-project.html#node-js) -- [Make](https://6.docs.plone.org/install/create-project.html#make) -- [Docker](https://6.docs.plone.org/install/create-project.html#docker) +1. Clone this repository, then change your working directory. + + ```shell + git clone git@github.com:plone/form-block.git + cd form-block/frontend + ``` + +2. Install this code base. + + ```shell + make install + ``` ### Make convenience commands -Run `make help` to list the available commands. - -```text -help Show this help -install Installs the add-on in a development environment -start Starts Volto, allowing reloading of the add-on during development -build Build a production bundle for distribution of the project with the add-on -i18n Sync i18n -ci-i18n Check if i18n is not synced -format Format codebase -lint Lint, or catch and remove problems, in code base -release Release the add-on on npmjs.org -release-dry-run Dry-run the release of the add-on on npmjs.org -test Run unit tests -ci-test Run unit tests in CI -backend-docker-start Starts a Docker-based backend for development -storybook-start Start Storybook server on port 6006 -storybook-build Build Storybook -acceptance-frontend-dev-start Start acceptance frontend in development mode -acceptance-frontend-prod-start Start acceptance frontend in production mode -acceptance-backend-start Start backend acceptance server -ci-acceptance-backend-start Start backend acceptance server in headless mode for CI -acceptance-test Start Cypress in interactive mode -ci-acceptance-test Run cypress tests in headless mode for CI -``` +Run `make help` to list the available Make commands. -### Development environment set up + +### Set up development environment Install package requirements. @@ -331,7 +193,3 @@ make acceptance-test ## License The project is licensed under the MIT license. - -## Credits and Acknowledgements 🙏 - -Crafted with care by **Generated using [Cookieplone (0.7.1)](https://github.com/plone/cookieplone) and [cookiecutter-plone (aee0d59)](https://github.com/plone/cookiecutter-plone/commit/aee0d59c18bd0dd8af1da9c961014ff87a66ccfa) on 2024-07-04 10:49:50.444730**. A special thanks to all contributors and supporters! diff --git a/frontend/cypress/tests/example.cy.js b/frontend/cypress/tests/example.cy.js index f3a1fad..f102f27 100644 --- a/frontend/cypress/tests/example.cy.js +++ b/frontend/cypress/tests/example.cy.js @@ -9,11 +9,13 @@ context('Example Acceptance Tests', () => { contentTitle: 'Test document', }); cy.autologin(); + cy.intercept('GET', '/**/document*').as('content'); }); it('As editor I can add edit a Page', function () { cy.visit('/document'); cy.navigate('/document/edit'); + cy.wait('@content'); cy.get('#toolbar-save').click(); }); }); diff --git a/frontend/package.json b/frontend/package.json index 1aa5f5d..55ea653 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,9 +1,9 @@ { - "name": "volto-form-block-dev", + "name": "@plone/volto-form-block-dev", "version": "1.0.0-alpha.0", - "description": "Volto block to build a form", - "author": "Plone Community", - "homepage": "https://github.com/collective/volto-form-block", + "description": "Form Block add-on for Plone CMS.", + "author": "Plone Foundation", + "homepage": "https://github.com/plone/form-block", "license": "MIT", "keywords": [ "volto-addon", @@ -60,4 +60,4 @@ ] }, "packageManager": "pnpm@10.20.0" -} \ No newline at end of file +} diff --git a/frontend/packages/volto-form-block/.release-it.json b/frontend/packages/volto-form-block/.release-it.json index be8ae92..b5bd369 100644 --- a/frontend/packages/volto-form-block/.release-it.json +++ b/frontend/packages/volto-form-block/.release-it.json @@ -12,6 +12,12 @@ ], "after:release": "rm .changelog.draft README.md" }, + "npm": { + "publish": false + }, + "plonePrePublish": { + "publish": false + }, "git": { "changelog": "pipx run towncrier build --draft --yes --version 0.0.0", "requireUpstream": false, @@ -20,12 +26,9 @@ "tagName": "${version}", "tagAnnotation": "Release ${version}" }, - "npm": { - "publish": false - }, "github": { - "release": true, + "release": false, "releaseName": "${version}", "releaseNotes": "cat .changelog.draft" } -} +} \ No newline at end of file diff --git a/frontend/packages/volto-form-block/CHANGELOG.md b/frontend/packages/volto-form-block/CHANGELOG.md index 8648a8d..da63824 100644 --- a/frontend/packages/volto-form-block/CHANGELOG.md +++ b/frontend/packages/volto-form-block/CHANGELOG.md @@ -1,751 +1,9 @@ -## 1.0.0-alpha.0 (2025-11-14) +# Changelog -### Internal + -- Move to the new setup @sneridagh [#109](https://github.com/plone/form-block/issue/109) - -### [3.10.1](https://github.com/collective/volto-form-block/compare/v3.10.0...v3.10.1) (2024-10-03) - - -### Bug Fixes - -* always set static_text fields as not required ([3cdb14d](https://github.com/collective/volto-form-block/commit/3cdb14d9b8b892d5681f9c30fb3a9cdf422cce06)) - -## [3.10.0](https://github.com/collective/volto-form-block/compare/v3.9.3...v3.10.0) (2024-10-02) - - -### Features - -* email otp validation switchable per form ([#119](https://github.com/collective/volto-form-block/issues/119)) ([9cda160](https://github.com/collective/volto-form-block/commit/9cda1608d9a6c7bb600f27f23b305360a4e21072)) - -### [3.9.3](https://github.com/collective/volto-form-block/compare/v3.9.2...v3.9.3) (2024-09-12) - - -### Bug Fixes - -* Fix bug that form data can not be loaded for forms in accordions ([#74](https://github.com/collective/volto-form-block/issues/74)) ([9dd726f](https://github.com/collective/volto-form-block/commit/9dd726f2286f3004d7cf74ebc1df364d8e5d9fc4)) -* reset otp on formdata reset ([#116](https://github.com/collective/volto-form-block/issues/116)) ([eb259a0](https://github.com/collective/volto-form-block/commit/eb259a048ba3688116cad1aeafcf4ef49d5e0d8f)) - -### [3.9.2](https://github.com/collective/volto-form-block/compare/v3.9.1...v3.9.2) (2024-07-01) - - -### Maintenance - -* updated subject field with description text ([3080394](https://github.com/collective/volto-form-block/commit/30803949a013161b38ac650c783a45e25ae56b89)) - -### [3.9.1](https://github.com/collective/volto-form-block/compare/v3.9.0...v3.9.1) (2024-06-26) - - -### Maintenance - -* updated header and footer email fields with richtext ([c656644](https://github.com/collective/volto-form-block/commit/c65664461a934f541823be4973e257a3e3190373)) - -## [3.9.0](https://github.com/collective/volto-form-block/compare/v3.8.7...v3.9.0) (2024-06-20) - - -### Features - -* add missing german translations ([c40b1ea](https://github.com/collective/volto-form-block/commit/c40b1ea895b23990cdde29cc8b56c6de95039fed)) -* added header and footer mail fields ([#105](https://github.com/collective/volto-form-block/issues/105)) ([d74cf6c](https://github.com/collective/volto-form-block/commit/d74cf6c54c59a81d3498b2960dda443c35b7ad47)) - -### [3.8.7](https://github.com/collective/volto-form-block/compare/v3.8.6...v3.8.7) (2024-06-17) - - -### Bug Fixes - -* view message response [#96](https://github.com/collective/volto-form-block/issues/96) ([#103](https://github.com/collective/volto-form-block/issues/103)) ([7262025](https://github.com/collective/volto-form-block/commit/726202567e72e6e7540603e7439229042778323f)) - -### [3.8.6](https://github.com/collective/volto-form-block/compare/v3.8.5...v3.8.6) (2024-06-14) - - -### Bug Fixes - -* formState success ([8bbf87e](https://github.com/collective/volto-form-block/commit/8bbf87e28a339aab30ab9603eda06f85c2d51687)) - -### [3.8.5](https://github.com/collective/volto-form-block/compare/v3.8.4...v3.8.5) (2024-05-30) - - -### Bug Fixes - -* upgrade volto-subblocks to 2.1.0 ([ebc71a3](https://github.com/collective/volto-form-block/commit/ebc71a3aeade96efc33f3e7dcf27a13b2c0c3a5b)) - -### [3.8.4](https://github.com/collective/volto-form-block/compare/v3.8.3...v3.8.4) (2024-05-30) - - -### Bug Fixes - -* align-items start in CSS - Makes autoprefixer happy :/ ([#100](https://github.com/collective/volto-form-block/issues/100)) ([39ab173](https://github.com/collective/volto-form-block/commit/39ab173e6c561cbc92d0f5fef630b13535d5c9e2)) - -### [3.8.3](https://github.com/collective/volto-form-block/compare/v3.8.2...v3.8.3) (2024-05-16) - - -### Bug Fixes - -* error on form submit: Objects are not valid as a React child. ([#97](https://github.com/collective/volto-form-block/issues/97)) ([1816c1b](https://github.com/collective/volto-form-block/commit/1816c1b3d51f635f5e24843dc217a8dd33b8b2cc)) - - -### Maintenance - -* add the first few Dutch translations. ([#98](https://github.com/collective/volto-form-block/issues/98)) ([6132730](https://github.com/collective/volto-form-block/commit/6132730f361c30b346f6276ab90fb7004be10eb2)) -* eu and es translations ([#95](https://github.com/collective/volto-form-block/issues/95)) ([09c248f](https://github.com/collective/volto-form-block/commit/09c248faa9d177e8482d4342f0e1a86e0b3cacf7)) - -### [3.8.2](https://github.com/collective/volto-form-block/compare/v3.8.1...v3.8.2) (2024-04-26) - - -### Maintenance - -* removed print field id ([98278d1](https://github.com/collective/volto-form-block/commit/98278d18d2eb665d4c28e44f63da08c96a74fa9c)) - -### [3.8.1](https://github.com/collective/volto-form-block/compare/v3.8.0...v3.8.1) (2024-04-26) - - -### Bug Fixes - -* display field_id for more fields in sidebar ([e15e1ad](https://github.com/collective/volto-form-block/commit/e15e1ad071fedb11422804d3c2208109f3f54b64)) -* replace placeholder of empty fields with nothing in thamkyou message ([8e75c8b](https://github.com/collective/volto-form-block/commit/8e75c8b665476958d0ec9bab803b11d1cfdaff2b)) - -## [3.8.0](https://github.com/collective/volto-form-block/compare/v3.7.5...v3.8.0) (2024-04-18) - - -### Features - -* added bcc email validation with otp code ([#93](https://github.com/collective/volto-form-block/issues/93)) ([e2100be](https://github.com/collective/volto-form-block/commit/e2100be25ac307f7fc27a1d70de53a771badc9ea)) - -### [3.7.5](https://github.com/collective/volto-form-block/compare/v3.7.4...v3.7.5) (2024-04-17) - - -### Bug Fixes - -* replace message ([8982698](https://github.com/collective/volto-form-block/commit/8982698b4ebd191b6f27d6afe2612a80147e7143)) - -### [3.7.4](https://github.com/collective/volto-form-block/compare/v3.7.3...v3.7.4) (2024-04-16) - - -### Bug Fixes - -* fix field schema form sent_message and added customizable FormResult component ([6dd725b](https://github.com/collective/volto-form-block/commit/6dd725b7aa3d7a218a7426cfa3df9ec72c90b6a1)) -* prevent xss in form block reading sent data from BE response ([b4139d2](https://github.com/collective/volto-form-block/commit/b4139d2284102e6820b892e7e40eee7ffcd1a36d)) - - -### Maintenance - -* fix husky config ([6a47f33](https://github.com/collective/volto-form-block/commit/6a47f33fa8bd103c0b697336bd3ad59f480599ae)) - -### [3.7.3](https://github.com/collective/volto-form-block/compare/v3.7.2...v3.7.3) (2024-04-08) - - -### Maintenance - -* gitignore ([435d0d7](https://github.com/collective/volto-form-block/commit/435d0d793a1ae3a7670221cb4df5fd72254a4af8)) -* lazy loading components to improve bundle size ([#92](https://github.com/collective/volto-form-block/issues/92)) ([e791bf0](https://github.com/collective/volto-form-block/commit/e791bf032255459697b71ac3a06a2d50629c13d8)) - - - -### [3.7.2](https://github.com/collective/volto-form-block/compare/v3.7.1...v3.7.2) (2024-03-27) - - -### Bug Fixes - -* Fix 'error is null' when adding form block. ([06f8300](https://github.com/collective/volto-form-block/commit/06f830071396aeaa798c58459c068421bd47177e)) - -### [3.7.1](https://github.com/collective/volto-form-block/compare/v3.7.0...v3.7.1) (2024-03-19) - - -### Bug Fixes - -* empty props ([e03df2e](https://github.com/collective/volto-form-block/commit/e03df2e984d5338c106bf61f83c1428c08ef39dc)) - - -### Maintenance - -* removed console.log ([3022402](https://github.com/collective/volto-form-block/commit/302240223280c75dbb447697451b846ffb15e212)) - -## [3.7.0](https://github.com/collective/volto-form-block/compare/v3.5.2...v3.7.0) (2024-03-18) - - -### Features - -* added default validators for field default_from and default_to ([ba41002](https://github.com/collective/volto-form-block/commit/ba410028c45ef8472f6c68a6cefa28b4b1f34d71)) - - -### Bug Fixes - -* removed 'required' option for field type 'static_text ([32c4ef5](https://github.com/collective/volto-form-block/commit/32c4ef5e8851b29fbfddb95c0db7c86c01de4043)) - - -### Maintenance - -* removed unused translations ([164bd34](https://github.com/collective/volto-form-block/commit/164bd3422f1fe0493007e789412b5ca908fd6b8b)) - -### [3.5.2](https://github.com/collective/volto-form-block/compare/v3.5.1...v3.5.2) (2024-03-15) - - -### Bug Fixes - -* view form ([6b389bc](https://github.com/collective/volto-form-block/commit/6b389bc06ed7fd72f8f3287c230e0a7013544e42)) - -### [3.5.1](https://github.com/collective/volto-form-block/compare/v3.5.0...v3.5.1) (2024-03-15) - - -### Bug Fixes - -* view block ([18cfa82](https://github.com/collective/volto-form-block/commit/18cfa826ee0ff5296df844c4bcf7b1987e74b953)) - -## [3.5.0](https://github.com/collective/volto-form-block/compare/v3.4.1...v3.5.0) (2024-03-14) - - -### Features - -* Validate field config and fix multiple form in page ([#83](https://github.com/collective/volto-form-block/issues/83)) ([ca373b6](https://github.com/collective/volto-form-block/commit/ca373b685481988effff667f10461214766c5977)) - -### [3.4.1](https://github.com/collective/volto-form-block/compare/v3.4.0...v3.4.1) (2024-03-13) - - -### Bug Fixes - -* validator for mail ([eded840](https://github.com/collective/volto-form-block/commit/eded840689b891df98316261508cecfbbfbd63e1)) - -## [3.4.0](https://github.com/collective/volto-form-block/compare/v3.3.1...v3.4.0) (2024-03-13) - - -### Features - -* view error for each field, validate form config ([#82](https://github.com/collective/volto-form-block/issues/82)) ([23e710c](https://github.com/collective/volto-form-block/commit/23e710c0a74b3bda9a64e9e6d11e16d925847bab)) - -### [3.3.1](https://github.com/collective/volto-form-block/compare/v3.3.0...v3.3.1) (2024-02-29) - - -### Bug Fixes - -* remain in form when there's errors on sending form ([c6fe827](https://github.com/collective/volto-form-block/commit/c6fe82721906dfaac8588164a77ca145b16d0dbd)) - - - -## [3.3.0](https://github.com/collective/volto-form-block/compare/v3.2.0...v3.3.0) (2024-02-27) - - -### Features - -* validate email field ([6572342](https://github.com/collective/volto-form-block/commit/65723428812859e84a1661181c4f75aa7f0a947c)) - - -### Maintenance - -* lint/husky ([bb32a2f](https://github.com/collective/volto-form-block/commit/bb32a2fcd7a8350dcecfce3a8cdd07a0767a7c79)) -* updated lockfile ([ec16920](https://github.com/collective/volto-form-block/commit/ec16920763e49ae4691f562a90ba404b665830de)) - -## [3.2.0](https://github.com/collective/volto-form-block/compare/v3.1.0...v3.2.0) (2023-12-11) - - -### Features - -* added form reset button and an user customizable submit confirm message ([#75](https://github.com/collective/volto-form-block/issues/75)) ([0c83317](https://github.com/collective/volto-form-block/commit/0c833175e5e57e6c6a758fc04c4a09ff39142e98)) - -## [3.1.0](https://github.com/collective/volto-form-block/compare/v3.0.1...v3.1.0) (2023-05-29) - - -### Features - -* added hidden field type ([#53](https://github.com/collective/volto-form-block/issues/53)) ([5650ee5](https://github.com/collective/volto-form-block/commit/5650ee557a2fc6cbbf6a70bcf7df469a281b974a)) -* make attachment type field list configurable in config ([#59](https://github.com/collective/volto-form-block/issues/59)) ([55cfe9d](https://github.com/collective/volto-form-block/commit/55cfe9dcfc38ccafcec0bc9fcbd4aa0bd3b72b3b)) - - -### Bug Fixes - -* captcha provider selection widget ([ba9ecd2](https://github.com/collective/volto-form-block/commit/ba9ecd2d2ec5843b43c9d9d283faeb14b3d29f1e)) -* i18n ([3d0fd99](https://github.com/collective/volto-form-block/commit/3d0fd991e0e58dd4061ba2d3e08d7d2142cc2afd)) -* swap store / send description ([#66](https://github.com/collective/volto-form-block/issues/66)) ([b76c1ec](https://github.com/collective/volto-form-block/commit/b76c1ec93daf48103e1da4fb31bda91a56b57fba)) -* use string for field_type ([#64](https://github.com/collective/volto-form-block/issues/64)) ([f031914](https://github.com/collective/volto-form-block/commit/f03191430011c3f2554b68635c7cb1639f2aa061)) - -### [3.0.1](https://github.com/collective/volto-form-block/compare/v3.0.0...v3.0.1) (2023-02-06) - - -### Bug Fixes - -* add missing dep on volto-subblocks ([#49](https://github.com/collective/volto-form-block/issues/49)) ([90f605b](https://github.com/collective/volto-form-block/commit/90f605b9a2c7389e75bc9a4345a6b8c4d4cb7247)) -* field extenders should be applied in FormView ([#44](https://github.com/collective/volto-form-block/issues/44)) ([4d063c6](https://github.com/collective/volto-form-block/commit/4d063c6247fd504116c18efb42e47320265f6987)) - -## [3.0.0](https://github.com/collective/volto-form-block/compare/v2.8.1...v3.0.0) (2022-10-30) - - -### Changes - -* upgraded dependencies and babel config for volto 16 ([#47](https://github.com/collective/volto-form-block/issues/47)) ([5ec2bb6](https://github.com/collective/volto-form-block/commit/5ec2bb6201b59aaa424c6d83a57c97f254267007)) - -### [2.8.1](https://github.com/collective/volto-form-block/compare/v2.8.0...v2.8.1) (2022-10-19) - - -### Bug Fixes - -* fixed imports and codereview ([e6863eb](https://github.com/collective/volto-form-block/commit/e6863ebfc61b8afe6fb98e102b616983536509f4)) -* updated it translations ([4d683f3](https://github.com/collective/volto-form-block/commit/4d683f3d43fe29a9779dbbb770411b3834117e7c)) - -## [2.8.0](https://github.com/collective/volto-form-block/compare/v2.7.1...v2.8.0) (2022-10-07) - - -### Features - -* scroll the window to the top of the form after submitting it succesfully ([#43](https://github.com/collective/volto-form-block/issues/43)) ([3c26486](https://github.com/collective/volto-form-block/commit/3c26486ae305ed173e86025f9d3b36e5fc6ad1c0)) - - -### Bug Fixes - -* set norobots captcha as required ([9d73566](https://github.com/collective/volto-form-block/commit/9d73566df9b234e0c8da08b5dcc3240cc9f9670d)) - -### [2.7.1](https://github.com/collective/volto-form-block/compare/v2.7.0...v2.7.1) (2022-09-30) - - -### Bug Fixes - -* show only the error message and not the http error code ([d328505](https://github.com/collective/volto-form-block/commit/d3285057b40fa25b869edb76a4e64c9177291390)) - -## [2.7.0](https://github.com/collective/volto-form-block/compare/v2.6.1...v2.7.0) (2022-09-30) - - -### Features - -* do not reset the form when a backend error happens ([ff33951](https://github.com/collective/volto-form-block/commit/ff33951fa44951420341f25cdaddd625b3db5bac)) - -### [2.6.1](https://github.com/collective/volto-form-block/compare/v2.6.0...v2.6.1) (2022-09-21) - - -### Bug Fixes - -* removed semantic-ui grid class ([f8c5b65](https://github.com/collective/volto-form-block/commit/f8c5b65de964fc15ed2ded7939c710b277907e06)) - -## [2.6.0](https://github.com/collective/volto-form-block/compare/v2.5.0...v2.6.0) (2022-09-21) - - -### Features - -* added honeypot field type ([272e3c3](https://github.com/collective/volto-form-block/commit/272e3c3093c0dbc253f2a2406125cc497354cd01)) -* added honeypot widget captcha ([2723f52](https://github.com/collective/volto-form-block/commit/2723f5281fb918f2baf30940a746a956b85cc49c)) - - -### Bug Fixes - -* fix captcha widget ([b4d990c](https://github.com/collective/volto-form-block/commit/b4d990ca822d0c42e263194e3e91221fc7715dd2)) -* fix captcha widget manage token ([1a3c19b](https://github.com/collective/volto-form-block/commit/1a3c19bfa644147024347bc543f3cb8cc73e7f6d)) -* fix HoneypotWidget props ([cd294c4](https://github.com/collective/volto-form-block/commit/cd294c45b54920c6f0d0f15c70a9b33469bfa6a0)) -* fixed const variables and added row class ([300d6c9](https://github.com/collective/volto-form-block/commit/300d6c9c560163e2fec455c9e23bc8af4552fddc)) - - -### Maintenance - -* added captcha value of submit request ([1946a08](https://github.com/collective/volto-form-block/commit/1946a0839cda2e19693c21cc64c48c79395b32e7)) -* updated yarn.lock ([f49b32f](https://github.com/collective/volto-form-block/commit/f49b32fd7dec1942efdd4ed84dbe2d5ac2feeebd)) - -## [2.5.0](https://github.com/collective/volto-form-block/compare/v2.4.2...v2.5.0) (2022-09-05) - - -### Features - -* handled collective.volto.formsupport.captcha.providers vocabulary ([12060e7](https://github.com/collective/volto-form-block/commit/12060e77eaa863a5b8792ad2c604f034546f7e06)) - - -### Bug Fixes - -* fixed disabled submit button ([e1026bc](https://github.com/collective/volto-form-block/commit/e1026bcff8b36cf69b8dd648cff6b6b00cdf02e8)) -* send captcha to backend to make it effective ([15b4a4f](https://github.com/collective/volto-form-block/commit/15b4a4f9701baa5427d3048f53f55226f5bcde18)) -* send captcha to backend to make it effective ([a9f422b](https://github.com/collective/volto-form-block/commit/a9f422bc4f9f5d13f6b923d0eb26b785cd4308c1)) - - -### Maintenance - -* updated README ([1d76435](https://github.com/collective/volto-form-block/commit/1d764354a4332ba21509b9aceba133da6dcaa062)) -* updated README ([3dd04ca](https://github.com/collective/volto-form-block/commit/3dd04ca2a924ed07de6aef960990b2544c370dd3)) - -### [2.4.2](https://github.com/collective/volto-form-block/compare/v2.4.1...v2.4.2) (2022-08-05) - -### [2.4.1](https://github.com/collective/volto-form-block/compare/v2.4.0...v2.4.1) (2022-07-07) - - -### Bug Fixes - -* a11y screen reader for checkbox and radio grooups ([9433cc1](https://github.com/collective/volto-form-block/commit/9433cc1b36fc4019f25fed25ca8209e62dc9e511)) - -## [2.4.0](https://github.com/collective/volto-form-block/compare/v2.3.6...v2.4.0) (2022-07-07) - - -### Features - -* added a11y support for fields ([bce0433](https://github.com/collective/volto-form-block/commit/bce0433ed074a2108a594de3372929ee98954448)) - -### [2.3.6](https://github.com/collective/volto-form-block/compare/v2.3.5...v2.3.6) (2022-05-27) - - -### Maintenance - -* updated volto-subblocks ([c8d7095](https://github.com/collective/volto-form-block/commit/c8d7095c35d83b99723a9ff11edda6170edbfd74)) - -### [2.3.5](https://github.com/collective/volto-form-block/compare/v2.3.4...v2.3.5) (2022-05-24) - - -### Maintenance - -* updated volto-subblocks for lazyloding libraries ([311f29e](https://github.com/collective/volto-form-block/commit/311f29e070164869e16c0eda3fa77273468c050d)) - -### [2.3.4](https://github.com/collective/volto-form-block/compare/v2.3.3...v2.3.4) (2022-05-23) - - -### Maintenance - -* updated volto-subblocks for lazyloading libraries ([b817efd](https://github.com/collective/volto-form-block/commit/b817efd917add700260824b7ba1d4d11f8b873d5)) - -### [2.3.3](https://github.com/collective/volto-form-block/compare/v2.3.2...v2.3.3) (2022-05-17) - -### [2.3.2](https://github.com/collective/volto-form-block/compare/v2.3.1...v2.3.2) (2022-05-13) - - -### Bug Fixes - -* fixed name for static fields! ([8e4452f](https://github.com/collective/volto-form-block/commit/8e4452f9e2fff4008ad22663a181aa1e4c58ac70)) - -### [2.3.1](https://github.com/collective/volto-form-block/compare/v2.3.0...v2.3.1) (2022-05-11) - - -### Bug Fixes - -* fixed date format in send email ([758a64a](https://github.com/collective/volto-form-block/commit/758a64a41a283e0cbd01b4461f3eae0f36221058)) - -## [2.3.0](https://github.com/collective/volto-form-block/compare/v2.2.3...v2.3.0) (2022-03-25) - - -### Features - -* added use_as_bcc for 'email' field ([b46b1fa](https://github.com/collective/volto-form-block/commit/b46b1fa9c421fba9631151e66bdecdae61fcd423)) - -### [2.2.3](https://github.com/collective/volto-form-block/compare/v2.2.2...v2.2.3) (2022-01-28) - -### Maintenance - -* **i18n:** add german translations ([c9d7c98](https://github.com/collective/volto-form-block/pull/21/commits/c9d7c98b548137de4139a7f06bf187af228c0cfb)) - - -### [2.2.2](https://github.com/collective/volto-form-block/compare/v2.2.1...v2.2.2) (2022-01-27) - -### [2.2.1](https://github.com/collective/volto-form-block/compare/v2.1.2...v2.2.1) (2022-01-21) - - -### Bug Fixes - -* fix package.json ([b2d556d](https://github.com/collective/volto-form-block/commit/b2d556d5b4f8a7de2df5732c39394e081022141d)) - - -### Maintenance - -* removed comment ([4e3aa08](https://github.com/collective/volto-form-block/commit/4e3aa088f458d6b7417c7ee04ce15b7d3923a11d)) -* revert some fixes ([2107bee](https://github.com/collective/volto-form-block/commit/2107bee7f9d9ec34e24c2787b543bdd382da6b56)) - -### [2.1.2](https://github.com/collective/volto-form-block/compare/v2.1.1...v2.1.2) (2022-01-04) - - -### Bug Fixes - -* fixed ArrayWidget in sidebar ([ad43bbd](https://github.com/collective/volto-form-block/commit/ad43bbded5e061d7f595db5e0fda7eba54756c0d)) - -### [2.1.1](https://github.com/collective/volto-form-block/compare/v2.1.0...v2.1.1) (2021-11-25) - - -### Maintenance - -* **i18n:** add es translation ([86ebaba](https://github.com/collective/volto-form-block/commit/86ebaba68e6bc0de0866e43f8ee80135422f948c)) -* **i18n:** add eu translation ([c1ee795](https://github.com/collective/volto-form-block/commit/c1ee795dd92fe23c07ff6e13039b291e6497924e)) - -## [2.1.0](https://github.com/collective/volto-form-block/compare/v2.0.3...v2.1.0) (2021-10-25) - - -### Bug Fixes - -* readme title ([2d56ace](https://github.com/collective/volto-form-block/commit/2d56aced8a7ebd1bfbbbde1054694948f6b17396)) - - -### Maintenance - -* upgrade to volto 14, use @plone/script i18n ([3069217](https://github.com/collective/volto-form-block/commit/30692170860ebe50df5677d6992b209a8995fc10)) - -### [2.0.3](https://github.com/collective/volto-form-block/compare/v2.0.2...v2.0.3) (2021-10-19) - - -### Bug Fixes - -* fixed field name if label is duplicate ([734f7e6](https://github.com/collective/volto-form-block/commit/734f7e6b518756256ff0b8b3044e451100e6f9be)) - -### [2.0.2](https://github.com/collective/volto-form-block/compare/v2.0.1...v2.0.2) (2021-08-25) - - -### Bug Fixes - -* fix field name if no label is set ([a306050](https://github.com/collective/volto-form-block/commit/a306050313b1c945a10b0c97e64026d6154a395b)) - -### [2.0.1](https://github.com/collective/volto-form-block/compare/v2.0.0...v2.0.1) (2021-08-24) - - -### Bug Fixes - -* checkbox field validation ([532caae](https://github.com/collective/volto-form-block/commit/532caae1e0a1df6c2b84cf640f4aae55a9e15f91)) - -## [2.0.0](https://github.com/collective/volto-form-block/compare/v1.8.1...v2.0.0) (2021-08-20) - - -### ⚠ BREAKING CHANGES - -* add checkbox field, rename old checkbox and radio - -### Features - -* add checkbox field, rename old checkbox and radio ([669e88b](https://github.com/collective/volto-form-block/commit/669e88bd7a9dbc3b1e13b6f0581effbdda413ce9)) -* add static rich text field ([b5e127d](https://github.com/collective/volto-form-block/commit/b5e127d37dd573c9f99912154db8969e2945782f)) -* sidebar option for invisible hcaptcha ([e793acc](https://github.com/collective/volto-form-block/commit/e793accb985a3b06bef61c097f965d2c70d79309)) - - -### Bug Fixes - -* static text field styles ([6296dcb](https://github.com/collective/volto-form-block/commit/6296dcb665fe8aa66ccd3637756eddf6bbbad15d)) - - -### Changes - -* captcha components with loadable ([83d504b](https://github.com/collective/volto-form-block/commit/83d504b2cffd690b8db4f45b3e702108e457c582)) -* captcha token usage, button disabled condition ([4e7556c](https://github.com/collective/volto-form-block/commit/4e7556c2ab1bb584bd3cc434784aa21bbce6302d)) -* captcha widgets with loadable, form -> view ([0b0b13f](https://github.com/collective/volto-form-block/commit/0b0b13f639643f436bc0de51e87d1569cd364e21)) -* disable button logic and env vars ([d09dcce](https://github.com/collective/volto-form-block/commit/d09dcce9eb09257c65385758f2a851947c931d03)) -* row padded top ([940a3ec](https://github.com/collective/volto-form-block/commit/940a3ec9ff3da22e82c7533e929533a67aec1185)) - - -### Maintenance - -* add editorConfig ([470101d](https://github.com/collective/volto-form-block/commit/470101d8b82aa119e793a3355a8e7d9a5933134c)) -* add release-it dev ([485efc4](https://github.com/collective/volto-form-block/commit/485efc4ed132bc662d94da778ad9a3651a602449)) -* added exports ([4072c78](https://github.com/collective/volto-form-block/commit/4072c7842d4061b1cd2f631ee4e2a744f49a889d)) -* **i18n:** update translations ([060403c](https://github.com/collective/volto-form-block/commit/060403c0b952baeb85bc1ef6a1d64cc296161779)) -* remove redraft unused import ([66bbc7d](https://github.com/collective/volto-form-block/commit/66bbc7d41c7824538c2ad1a9cac0ffaed1a72929)) -* update editorConfig ([0783f63](https://github.com/collective/volto-form-block/commit/0783f6343ee122910688c91c048ee4b837a2e590)) -* update locales ([c60cf68](https://github.com/collective/volto-form-block/commit/c60cf6863be10be416f8a52f851c29104fd2622b)) - -### [1.8.1](https://github.com/collective/volto-form-block/compare/v1.8.0...v1.8.1) (2021-08-10) - - -### Bug Fixes - -* form validation prop ([6a1c96b](https://github.com/collective/volto-form-block/commit/6a1c96b6b95abf05b4184ac952488e548a2b7dfb)) - -## [1.8.0](https://github.com/collective/volto-form-block/compare/v1.7.0...v1.8.0) (2021-08-09) - - -### Features - -* add hcaptcha integration ([3ae4599](https://github.com/collective/volto-form-block/commit/3ae45995bef9ef11819d76b2ca1d7316eb79e24e)) - - -### Maintenance - -* **i18n:** fix italian translation ([b027874](https://github.com/collective/volto-form-block/commit/b027874f26b30e81c7df0810fa3d13c0a5dd206a)) -* update package.json tags ([9f94c72](https://github.com/collective/volto-form-block/commit/9f94c722b2db0cdb7dae24e88f0750ff02fce678)) - -## [1.7.0](https://github.com/collective/volto-form-block/compare/v1.6.0...v1.7.0) (2021-08-05) - - -### Features - -* add validation fn for additionalFields ([61409f0](https://github.com/collective/volto-form-block/commit/61409f0b72c77dd7f93fd5a71c5d8ed1633f8bda)) -* additionalFields from config ([29cacb1](https://github.com/collective/volto-form-block/commit/29cacb115c499654a7e79343a971ccd4fc5a0e48)) - - -### Bug Fixes - -* additionalFields validation + static field className ([0d3e2b8](https://github.com/collective/volto-form-block/commit/0d3e2b81dfdbe48d06cc3e21504cfbe71c760c05)) - - -### Changes - -* update readme + translations ([62b25c2](https://github.com/collective/volto-form-block/commit/62b25c21c0705b17ae000ce2ea5364a186d89d9c)) - -## [1.6.0](https://github.com/collective/volto-form-block/compare/v1.5.2...v1.6.0) (2021-07-05) - - -### Features - -* add title and description ([0b7be9f](https://github.com/collective/volto-form-block/commit/0b7be9f4372c617dbcc0bcf38e8233c0662d7526)) - - -### Bug Fixes - -* typo in readme ([29119b4](https://github.com/collective/volto-form-block/commit/29119b4db4cd4109fc728c8e548a5d85800f187c)) - -### [1.5.2](https://github.com/collective/volto-form-block/compare/v1.5.1...v1.5.2) (2021-05-13) - - -### Maintenance - -* add release-it config, commitlint ([52deb93](https://github.com/collective/volto-form-block/commit/52deb939721b83b5369738e143757bf0c7ea0cb3)) - -### Changelog - -All notable changes to this project will be documented in this file. Dates are displayed in UTC. - -Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - -#### [v1.5.1](https://github.com/collective/volto-form-block/compare/v1.5.0...v1.5.1) - -- Add Brazilian Portuguese translations. [`#3`](https://github.com/collective/volto-form-block/pull/3) - -#### [v1.5.0](https://github.com/collective/volto-form-block/compare/v1.4.4...v1.5.0) - -> 8 April 2021 - -- feat: add email field 'use as reply to' option [`#2`](https://github.com/collective/volto-form-block/pull/2) -- Release 1.5.0 [`4c17ad7`](https://github.com/collective/volto-form-block/commit/4c17ad77f4ba755a3ee9414587cd2c961cb0d401) -- refactor: change useAsReplyTo in snake case [`6fbb95d`](https://github.com/collective/volto-form-block/commit/6fbb95d1e995211d48f30be3aed2a3ebd11dfdde) - -#### [v1.4.4](https://github.com/collective/volto-form-block/compare/v1.4.3...v1.4.4) - -> 24 March 2021 - -- chore: update translations [`6cf2b5a`](https://github.com/collective/volto-form-block/commit/6cf2b5acf155a1b92073973add90794dcf5f6122) -- Release 1.4.4 [`36c69d9`](https://github.com/collective/volto-form-block/commit/36c69d93bfe6ed50503fc97d06bef96d88b1aa85) - -#### [v1.4.3](https://github.com/collective/volto-form-block/compare/v1.4.2...v1.4.3) - -> 24 March 2021 - -- Release 1.4.3 [`feccc66`](https://github.com/collective/volto-form-block/commit/feccc66e517605b5fd9a12e4bbc5d897f4a66cbe) -- fix: remove console.log [`8853ce0`](https://github.com/collective/volto-form-block/commit/8853ce0505189b62cab597122594a0723510e5cd) - -#### [v1.4.2](https://github.com/collective/volto-form-block/compare/v1.4.1...v1.4.2) - -> 23 March 2021 - -- chore(i18n): update translations [`980a0b8`](https://github.com/collective/volto-form-block/commit/980a0b861ab4f6d3550e5d641874287a71cd89a5) -- Release 1.4.2 [`5234eff`](https://github.com/collective/volto-form-block/commit/5234eff28b1a9db1b1e4178a4f3d11fc64664746) - -#### [v1.4.1](https://github.com/collective/volto-form-block/compare/v1.4.0...v1.4.1) - -> 20 March 2021 - -- docs: add features in readme and yt demos [`d63e926`](https://github.com/collective/volto-form-block/commit/d63e92678cc2f2e08f4bec87af363ac296e94936) -- Release 1.4.1 [`ab522a1`](https://github.com/collective/volto-form-block/commit/ab522a158ac3970482318a41e217f30d70d05c0d) -- docs: update readme [`c104224`](https://github.com/collective/volto-form-block/commit/c104224a0d8c4244a201c1cf2985398767c5e3c0) -- docs: update readme [`a789970`](https://github.com/collective/volto-form-block/commit/a7899705d376a6d118e9d44dd657bce9a2b7db43) -- chore(i18n): update translations [`e82192b`](https://github.com/collective/volto-form-block/commit/e82192b43f65fe7e364446a8910de3d2d4ca3726) - -#### [v1.4.0](https://github.com/collective/volto-form-block/compare/v1.3.5...v1.4.0) - -> 19 March 2021 - -- Release 1.4.0 [`b89405d`](https://github.com/collective/volto-form-block/commit/b89405d7b84488159994663a4e6ee56b319b44a7) -- refactor: attachment info styles [`2904849`](https://github.com/collective/volto-form-block/commit/290484910165a0f246f680bec5cbdc916d0e4437) -- refactor: fix translation, add attachment info [`73dd6e1`](https://github.com/collective/volto-form-block/commit/73dd6e1e3cdc77c9880b69386aa4136887593da7) -- feat: reset form state when navigating [`cfc4f37`](https://github.com/collective/volto-form-block/commit/cfc4f3712aea25d0051548971c36e676fd5e340b) -- fix: attachment info styles [`00ab8bb`](https://github.com/collective/volto-form-block/commit/00ab8bbe1e504fd9b070fa06786d11f78c839617) - -#### [v1.3.5](https://github.com/collective/volto-form-block/compare/v1.3.4...v1.3.5) - -> 19 March 2021 - -- refactor: add file attachment info text [`277640a`](https://github.com/collective/volto-form-block/commit/277640a5c90f47729b6a928f0b0e4cfd431093fa) -- Release 1.3.5 [`ff2e272`](https://github.com/collective/volto-form-block/commit/ff2e272f31945b496828e85f85f0f4210979d577) - -#### [v1.3.4](https://github.com/collective/volto-form-block/compare/v1.3.3...v1.3.4) - -> 19 March 2021 - -- Release 1.3.4 [`85c511c`](https://github.com/collective/volto-form-block/commit/85c511cc561d9f789dd671b188fd956dd0aa9f13) -- chore(i18n): add translations [`9d59f0c`](https://github.com/collective/volto-form-block/commit/9d59f0c6585badc04d07ec76e3a90dad6bb6ace2) - -#### [v1.3.3](https://github.com/collective/volto-form-block/compare/v1.3.2...v1.3.3) - -> 19 March 2021 - -- Release 1.3.3 [`9d90ce5`](https://github.com/collective/volto-form-block/commit/9d90ce588cccd5daf05d6ff23bbcc3fcfa394f5d) -- fix: translations [`327d43a`](https://github.com/collective/volto-form-block/commit/327d43a3b9ef81a28aaa435ac7943dda59c603ec) - -#### [v1.3.2](https://github.com/collective/volto-form-block/compare/v1.3.1...v1.3.2) - -> 19 March 2021 - -- Release 1.3.2 [`9b8d0ac`](https://github.com/collective/volto-form-block/commit/9b8d0acdb2ed2ecf4f796bc44e417b4497a368a4) -- fix: form errors handling [`4c64932`](https://github.com/collective/volto-form-block/commit/4c64932b89217ba75040ebbef99ee1816acfe008) - -#### [v1.3.1](https://github.com/collective/volto-form-block/compare/v1.3.0...v1.3.1) - -> 18 March 2021 - -- Release 1.3.1 [`f2cfec1`](https://github.com/collective/volto-form-block/commit/f2cfec14d6fa8942c6ddf8eca55f5c0e01012feb) -- chore(i18n): updated translations [`d0b1e09`](https://github.com/collective/volto-form-block/commit/d0b1e09c1a4090b35ba5f83f9afe62ff200b7b9d) - -#### [v1.3.0](https://github.com/collective/volto-form-block/compare/v1.2.2...v1.3.0) - -> 18 March 2021 - -- feat: add multiple value checkbox widget [`0f86816`](https://github.com/collective/volto-form-block/commit/0f868164d80bb250b6fe8a29685c40b5930c80da) -- Release 1.3.0 [`aa8ad2b`](https://github.com/collective/volto-form-block/commit/aa8ad2b21396b4e7b374aae57b4284cf13e30c75) - -#### [v1.2.2](https://github.com/collective/volto-form-block/compare/v1.2.1...v1.2.2) - -> 18 March 2021 - -- refactor: add cancel translation [`608d3bd`](https://github.com/collective/volto-form-block/commit/608d3bd28660f0b2f5c80f5d9486076b9fd32088) -- Release 1.2.2 [`ae30355`](https://github.com/collective/volto-form-block/commit/ae303556044822a0f726d82d194b8c6136d7eb49) - -#### [v1.2.1](https://github.com/collective/volto-form-block/compare/v1.2.0...v1.2.1) - -> 18 March 2021 - -- fix: form reset [`84c6087`](https://github.com/collective/volto-form-block/commit/84c608737159cd8b7694d2ae4bed194bb671f253) -- Release 1.2.1 [`cb63ff1`](https://github.com/collective/volto-form-block/commit/cb63ff1851643233e609a0fc52731130c714c281) -- refactor: add autocomplete off [`5147c5f`](https://github.com/collective/volto-form-block/commit/5147c5f1e913b6a998f452c24aa67bf99157a93e) - -#### [v1.2.0](https://github.com/collective/volto-form-block/compare/v1.1.2...v1.2.0) - -> 18 March 2021 - -- feat: add reset form [`d07a79f`](https://github.com/collective/volto-form-block/commit/d07a79f7cc06688ef538cdb01c201b174c23eb69) -- chore(i18n): updated translations [`8115403`](https://github.com/collective/volto-form-block/commit/81154034f48284d0bcbe9fc0221d555536e2abf9) -- Release 1.2.0 [`1b3fb8f`](https://github.com/collective/volto-form-block/commit/1b3fb8ff64a60ea1cbf4667a7d8ee0436f8c90fd) -- chore(i18n): updated translations [`e7f4864`](https://github.com/collective/volto-form-block/commit/e7f4864b1e53012ee7a2d920c2d7a462aed89584) - -#### [v1.1.2](https://github.com/collective/volto-form-block/compare/v1.1.1...v1.1.2) - -> 17 March 2021 - -- fix: import paths [`9fde60d`](https://github.com/collective/volto-form-block/commit/9fde60dbecb81dbf2844ae0069bb1804e46a668b) -- Release 1.1.2 [`83b8ae8`](https://github.com/collective/volto-form-block/commit/83b8ae8ca1ff0a1ddd7688712b412b38d450794a) - -#### [v1.1.1](https://github.com/collective/volto-form-block/compare/v1.1.0...v1.1.1) - -> 16 March 2021 - -- refactor: improved translations [`5351b1f`](https://github.com/collective/volto-form-block/commit/5351b1f08dbd70f6b954a05bf215e6ca7b699597) -- Release 1.1.1 [`e9ca9bb`](https://github.com/collective/volto-form-block/commit/e9ca9bbf078828ba3b6279ef4e874900ac14fbe3) - -#### [v1.1.0](https://github.com/collective/volto-form-block/compare/v1.0.0...v1.1.0) - -> 16 March 2021 - -- feat: add static fields rendering [`da6ae8d`](https://github.com/collective/volto-form-block/commit/da6ae8dd0729b511a1de87a39fab0ad14037cb32) -- Release 1.1.0 [`1e76e9b`](https://github.com/collective/volto-form-block/commit/1e76e9b451d1514ed6f57e587b37253a223ef8e8) -- feat: add static fields [`746e62e`](https://github.com/collective/volto-form-block/commit/746e62e1eadbf1316f271fc762fd62b980e4d278) -- fix: add field_type for static fields [`85ed53f`](https://github.com/collective/volto-form-block/commit/85ed53f1676d3b19452152b069df8e5a69929ce3) - -#### v1.0.0 - -> 15 March 2021 - -- feat: add form block [`8857ec5`](https://github.com/collective/volto-form-block/commit/8857ec5f96069586113b9ac623f9e902b6a1ce5c) -- chore(i18n): add translations [`58fd2d0`](https://github.com/collective/volto-form-block/commit/58fd2d04f45c4cd24ed37564112132ceabeac98d) -- feat: add export/clear buttons [`9dc8545`](https://github.com/collective/volto-form-block/commit/9dc85458c02dc35b7cc8e085a7d0657622e26218) -- refactor(i18n): add translations, used en default [`be2f7d0`](https://github.com/collective/volto-form-block/commit/be2f7d05619db87f71a2fd87ced5415911cff3d2) -- chore: add addon scripts [`842b242`](https://github.com/collective/volto-form-block/commit/842b242cb0da7ae4232dc98e4ab601e7f82ffb77) -- chore: removed unused module [`9e2038a`](https://github.com/collective/volto-form-block/commit/9e2038a2f9d065faa2581e00e08f154049310207) -- first commit [`db2c10d`](https://github.com/collective/volto-form-block/commit/db2c10d209c6e93adb850babf7ddd6544b97e6d4) -- fix: form fields [`e69764c`](https://github.com/collective/volto-form-block/commit/e69764c018a2c527b749faee339a0967b9471f17) -- fix: field styles and fileWidget props [`daa1d22`](https://github.com/collective/volto-form-block/commit/daa1d22e7a4e8e8da24139daf99f953da0fec600) -- refactor: add confirm message [`e321e76`](https://github.com/collective/volto-form-block/commit/e321e7659ee69267217c3393689bbec735c3dfc3) -- fix: required fields label [`05da825`](https://github.com/collective/volto-form-block/commit/05da825bb51a6dafcc5917b37d855b12a68b5baf) -- feat: submit form with formsupport [`b27b736`](https://github.com/collective/volto-form-block/commit/b27b736552a995831f3ecd5d384c1592059f0c81) -- docs: fix jsdoc [`b776472`](https://github.com/collective/volto-form-block/commit/b776472e3dfdcb70bedaafee21d83d8d47cfa346) -- Release 1.0.0 [`2e3e54a`](https://github.com/collective/volto-form-block/commit/2e3e54a58fb8f2cfa5792f38f0698567552a604a) -- chore: add dependencies [`24a83bc`](https://github.com/collective/volto-form-block/commit/24a83bc30f73a50290acc833a047d4684c187db9) -- chore: add addon scripts [`33b5ad6`](https://github.com/collective/volto-form-block/commit/33b5ad66ab292da9124d0083e403b113645dfad8) -- Update README.md [`231fa90`](https://github.com/collective/volto-form-block/commit/231fa907def440a67cfbc74bf21977461d9b94a2) \ No newline at end of file + diff --git a/frontend/packages/volto-form-block/package.json b/frontend/packages/volto-form-block/package.json index 5dd534c..b85b93f 100644 --- a/frontend/packages/volto-form-block/package.json +++ b/frontend/packages/volto-form-block/package.json @@ -1,22 +1,20 @@ { "name": "@plone/volto-form-block", "version": "1.0.0-alpha.0", - "description": "Volto block to build a form", - "main": "src/index.js", + "description": "Form Block add-on for Plone CMS.", + "main": "src/index.ts", "license": "MIT", "keywords": [ "volto-addon", "volto", "plone", - "react", - "block", - "form" + "react" ], - "author": "Plone Community", + "author": "Plone Foundation", "homepage": "https://github.com/plone/form-block#readme", "repository": { "type": "git", - "url": "git@github.com:plone/form-block.git", + "url": "git@github.com:plone/form-block", "directory": "frontend/packages/volto-form-block" }, "publishConfig": { @@ -37,9 +35,11 @@ }, "peerDependencies": { "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "react-intl": "^3.12.1" }, "devDependencies": { + "@plone/registry": "workspace:*", "@plone/scripts": "^3.6.1", "@plone/types": "workspace:*", "@types/lodash": "^4.14.201", diff --git a/frontend/packages/volto-form-block/src/config/settings.ts b/frontend/packages/volto-form-block/src/config/settings.ts new file mode 100644 index 0000000..7258290 --- /dev/null +++ b/frontend/packages/volto-form-block/src/config/settings.ts @@ -0,0 +1,5 @@ +import type { ConfigType } from '@plone/registry'; + +export default function install(config: ConfigType) { + return config; +} diff --git a/frontend/packages/volto-form-block/src/index.js b/frontend/packages/volto-form-block/src/index.ts similarity index 81% rename from frontend/packages/volto-form-block/src/index.js rename to frontend/packages/volto-form-block/src/index.ts index 56130cb..756d243 100644 --- a/frontend/packages/volto-form-block/src/index.js +++ b/frontend/packages/volto-form-block/src/index.ts @@ -1,3 +1,6 @@ +import type { ConfigType } from '@plone/registry'; +import installSettings from './config/settings'; + import { defineMessages } from 'react-intl'; import loadable from '@loadable/component'; import formSVG from '@plone/volto/icons/form.svg'; @@ -56,7 +59,31 @@ defineMessages({ }, }); -const applyConfig = (config) => { +declare module '@plone/types' { + export interface BlocksConfigData { + schemaForm: BlockConfigBase; + } + + export interface BlockConfigBase { + widgets?: { + [key: string]: React.ComponentType; + }; + component?: React.ComponentType; + buttonComponent?: React.ComponentType; + captchaProvidersVocabulary?: string; + mailTemplatesVocabulary?: string; + disableEnter?: boolean; + filterFactory?: string[]; + additionalFactory?: { value: string; label: string }[]; + filterFactorySend?: string[]; + defaultSender?: string; + defaultSenderName?: string; + } +} + +export default function applyConfig(config: ConfigType) { + installSettings(config); + config.widgets.widget.honeypot = HoneypotCaptchaWidget; config.widgets.widget['norobots-captcha'] = NorobotsCaptchaWidget; config.widgets.widget['recaptcha'] = GoogleReCaptchaWidget; @@ -108,10 +135,6 @@ const applyConfig = (config) => { defaultSenderName: 'Plone', restricted: false, mostUsed: true, - security: { - addPermission: [], - view: [], - }, sidebarTab: 1, }, }; @@ -133,6 +156,4 @@ const applyConfig = (config) => { ); return config; -}; - -export default applyConfig; +} diff --git a/frontend/packages/volto-form-block/tsconfig.json b/frontend/packages/volto-form-block/tsconfig.json index 1874161..51f3038 100644 --- a/frontend/packages/volto-form-block/tsconfig.json +++ b/frontend/packages/volto-form-block/tsconfig.json @@ -13,7 +13,8 @@ "lib": ["es2022", "dom", "dom.iterable"], "jsx": "react-jsx", "paths": { - "@plone/volto/*": ["../../core/packages/volto/src/*"] + "@plone/volto/*": ["../../core/packages/volto/src/*"], + "@plone/volto-form-block/*": ["./src/*"] } }, "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"], diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 29d76e1..798a5e1 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -1464,7 +1464,13 @@ importers: react-google-recaptcha-v3: specifier: ^1.8.0 version: 1.11.0(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + react-intl: + specifier: ^3.12.1 + version: 3.12.1(@types/react@18.3.26)(react@18.2.0) devDependencies: + '@plone/registry': + specifier: workspace:* + version: link:../../core/packages/registry '@plone/scripts': specifier: ^3.6.1 version: 3.10.3 @@ -16002,7 +16008,11 @@ snapshots: jest-runner: 26.6.3 jest-runtime: 26.6.3 transitivePeerDependencies: + - bufferutil + - canvas - supports-color + - ts-node + - utf-8-validate '@jest/transform@26.6.2': dependencies: @@ -23831,11 +23841,7 @@ snapshots: pretty-format: 26.6.2 throat: 5.0.0 transitivePeerDependencies: - - bufferutil - - canvas - supports-color - - ts-node - - utf-8-validate jest-leak-detector@26.6.2: dependencies: diff --git a/frontend/pnpm-workspace.yaml b/frontend/pnpm-workspace.yaml index f9c0485..7dcfc08 100644 --- a/frontend/pnpm-workspace.yaml +++ b/frontend/pnpm-workspace.yaml @@ -2,3 +2,4 @@ packages: # all packages in direct subdirs of packages/ - 'core/packages/*' - 'packages/*' + - 'packages/*/packages/*' diff --git a/news/.changelog_template.jinja b/news/.changelog_template.jinja new file mode 100644 index 0000000..b35bff3 --- /dev/null +++ b/news/.changelog_template.jinja @@ -0,0 +1,15 @@ +{% if sections[""] %} +{% for category, val in definitions.items() if category in sections[""] %} + +### {{ definitions[category]['name'] }} + +{% for text, values in sections[""][category].items() %} +- {{ text }} {{ values|join(', ') }} +{% endfor %} + +{% endfor %} +{% else %} +No significant changes. + + +{% endif %} \ No newline at end of file diff --git a/repository.toml b/repository.toml new file mode 100644 index 0000000..60d776d --- /dev/null +++ b/repository.toml @@ -0,0 +1,33 @@ +[repository] +name = "form-block" +changelog = "CHANGELOG.md" +version = "version.txt" +container_images_prefix = "plone/form-block" +compose = ["docker-compose.yml"] + +[repository.towncrier] +section = "Project" +settings = "towncrier.toml" + +[backend.package] +name = "collective.volto.formsupport" +path = "backend" +code_path = "src/collective/volto/formsupport" +changelog = "backend/CHANGELOG.md" +towncrier_settings = "backend/pyproject.toml" +base_package = "Products.CMFPlone" +publish = true + +[frontend.package] +name = "volto-form-block" +path = "frontend/packages/volto-form-block" +code_path = "src" +changelog = "frontend/packages/volto-form-block/CHANGELOG.md" +towncrier_settings = "frontend/packages/volto-form-block/towncrier.toml" +base_package = "@plone/volto" +publish = true + +[cookieplone] +template = "monorepo_addon" +template_version = "562ef7e9ad24d2568566d74ca6edb15a9a506df3" +generated_date = "2025-11-14 13:00:05" diff --git a/towncrier.toml b/towncrier.toml new file mode 100644 index 0000000..b7a7b85 --- /dev/null +++ b/towncrier.toml @@ -0,0 +1,33 @@ +[tool.towncrier] +filename = "CHANGELOG.md" +directory = "news/" +title_format = "## {version} ({project_date})" +underlines = ["", "", ""] +template = "./news/.changelog_template.jinja" +start_string = "\n" +issue_format = "[#{issue}](https://github.com/plone/form-block/pull/{issue})" + +[[tool.towncrier.type]] +directory = "breaking" +name = "Breaking" +showcontent = true + +[[tool.towncrier.type]] +directory = "feature" +name = "Feature" +showcontent = true + +[[tool.towncrier.type]] +directory = "bugfix" +name = "Bugfix" +showcontent = true + +[[tool.towncrier.type]] +directory = "internal" +name = "Internal" +showcontent = true + +[[tool.towncrier.type]] +directory = "documentation" +name = "Documentation" +showcontent = true \ No newline at end of file diff --git a/version.txt b/version.txt index 3eefcb9..e9780dc 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.0.0 +1.0.0a0 \ No newline at end of file