Skip to content

Commit

Permalink
Feature: add support to the Visual Form Builder (#65)
Browse files Browse the repository at this point in the history
* feature: add initial support to form builder

* feature: add sample block

* feature: add ConvertDonationFormBlocksToFieldsApi class

* feature: add add-on settings in the form builder interface

* feature: add sample options to the add-on settings page

* refactor: rename color option type

* refactor: rename color option type

* chore: update yoast polyfills

* doc: update unreleased tags

* chore: add comments related to the compiled assets files

* refactor: add notice about limitations related to the form settings extension

* refactor: change sample block icon

* refactor: replace strings

* refactor: replace give-addon with ADDON_TEXTDOMAIN

* refactor: remove test folder

* feature: rename new files using namespace

* fix: wrong paths

* refactor: rename and remove old strings

* doc: update Asset Compilation section

* chore: ignore full language folder

* chore: update form builder library

* doc: fix tag name
  • Loading branch information
glaubersilva authored May 24, 2024
1 parent 58bde85 commit 1f44c14
Show file tree
Hide file tree
Showing 33 changed files with 32,804 additions and 10,058 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ cache
node_modules
public
.storybook-static
build

# Composer
vendor

# Assert directory
# Assets directory
assets/dist

# POT File
languages
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ plugin for WordPress.

### Asset Compilation
To compile your CSS & JS assets, run one of the following:
- `npm run dev` — Compiles all assets for development one time
- `npm run watch` — Compiles all assets for development one time and then watches for changes, supporting [BrowserSync](https://laravel-mix.com/docs/5.0/browsersync)
- `npm run hot` — Compiles all assets for development one time and then watches for [hot replacement](https://laravel-mix.com/docs/5.0/hot-module-replacement)
- `npm run dev` — Compiles all assets for production one time

- `npm run dev` — Compiles all assets (except Form Extension assets) for development one time
- `npm run watch` — Compiles all assets (except Form Extension assets) for development one time and then watches for
changes, supporting [BrowserSync](https://laravel-mix.com/docs/5.0/browsersync)
- `npm run dev:form-extension` — Compiles Form Extension assets for development one time
- `npm run watch:form-extension` — Compiles Form Extension assets for development one time and then watches for changes,
supporting [BrowserSync](https://laravel-mix.com/docs/5.0/browsersync)
- `npm run start` — Compiles all assets for development one time and then watches for changes

## Concepts

Expand Down Expand Up @@ -53,8 +57,11 @@ No domain code should reference (and therefore depend on) the `src/Addon` direct
keeps the dependency unidirectional.

#### Note for developers
If running `npm run dev` throws an error then check whether the `images` folder exists in your addon directory under `src/Addon/resources`.
1. If the `images` folder does not exist then create one.

If running `npm run dev` throws an error then check whether the `images` folder exists in your addon directory
under `src/Addon/resources`.

1. If the `images` folder does not exist then create one.
2. If the `images` folder isn't required then remove the code from `webpack.config.js`.

---
Expand Down
3 changes: 0 additions & 3 deletions babel.config.js

This file was deleted.

15 changes: 15 additions & 0 deletions build.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,21 @@
__DIR__ . "/tests/Unit/$domain"
);

rename(
__DIR__ . '/src/FormExtension/FormBuilder/ViewModels/GiveAddonViewModel.php',
__DIR__ . "/src/FormExtension/FormBuilder/ViewModels/{$namespace}ViewModel.php"
);

rename(
__DIR__ . '/src/FormExtension/FormBuilder/resources/js/types/GiveAddonSettingsProps.ts',
__DIR__ . "/src/FormExtension/FormBuilder/resources/js/types/{$namespace}SettingsProps.ts"
);

rename(
__DIR__ . '/src/FormExtension/FormBuilder/resources/js/interfaces/IGiveAddonFormBuilder.ts',
__DIR__ . "/src/FormExtension/FormBuilder/resources/js/interfaces/I{$namespace}FormBuilder.ts"
);

unlink(__FILE__);

echo(PHP_EOL . PHP_EOL . 'All set!');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"require-dev": {
"kjohnson/since-unreleased": "^1.0.0",
"phpunit/phpunit": "^5",
"yoast/phpunit-polyfills": "^1.0",
"yoast/phpunit-polyfills": "^1.1.0",
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3",
Expand Down
96 changes: 68 additions & 28 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions give-addon-boilerplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use GiveAddon\Addon\Activation;
use GiveAddon\Addon\Environment;
use GiveAddon\Domain\AddonServiceProvider;
use GiveAddon\FormExtension\FormExtensionServiceProvider;

/**
* Plugin Name: ADDON_NAME
Expand Down Expand Up @@ -50,6 +51,7 @@ function () {
// Check Give min required version.
if (Environment::giveMinRequiredVersionCheck()) {
give()->registerServiceProvider(AddonServiceProvider::class);
give()->registerServiceProvider(FormExtensionServiceProvider::class);
}
}
);
Expand Down
1 change: 1 addition & 0 deletions globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
declare module '*.svg';
declare module '*.module.css';
declare module '*.module.scss';
declare var wp: any;
Loading

0 comments on commit 1f44c14

Please sign in to comment.