Skip to content

Commit 73523d1

Browse files
committed
Merge branch 'release/1.2.0'
2 parents d0921ae + 664d278 commit 73523d1

29 files changed

+281
-1015
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,22 @@ name: "Continuous Integration"
22

33
on:
44
push:
5+
branches:
6+
- "hotfix/**"
7+
- "release/**"
8+
- "develop"
9+
- "master"
10+
pull_request:
11+
branches:
12+
- "hotfix/**"
13+
- "release/**"
14+
- "develop"
15+
- "master"
516

617
jobs:
718

8-
tests:
19+
test:
20+
921
strategy:
1022
fail-fast: false
1123
matrix:
@@ -31,5 +43,61 @@ jobs:
3143
php_version: ${{ matrix.php-version }}
3244
php_extensions: intl
3345
- run: |
46+
./vendor/bin/phpunit -c phpunit.xml.dist
47+
48+
tidy:
49+
50+
name: "Annotate & Tidy"
51+
needs: [test]
52+
runs-on: 'ubuntu-latest'
53+
steps:
54+
- uses: actions/checkout@v3
55+
- uses: php-actions/composer@v6
56+
with:
57+
command: update
58+
--with silverstripe/framework:^5.0
59+
php_version: 8.1
60+
php_extensions: xdebug intl
61+
- name: Generate Code Coverage
62+
run: |
63+
XDEBUG_MODE=coverage \
3464
./vendor/bin/phpunit -c phpunit.xml.dist \
3565
--coverage-clover ./coverage.xml
66+
- name: Annotate with Metrics
67+
run: |
68+
find src -name "*.php" | xargs ./vendor/bin/metrics annotate ./coverage.xml
69+
- name: Refactor with Rector
70+
run: |
71+
./vendor/bin/rector process src
72+
- name: Tidy Source Code
73+
run: |
74+
find tests -name "*.php" | xargs ./vendor/bin/phptidy.php replace
75+
find src -name "*.php" | xargs ./vendor/bin/phptidy.php replace
76+
- name: Push Back Changes
77+
run: |
78+
git diff --exit-code src || ( \
79+
git config user.name github-actions && \
80+
git config user.email [email protected] && \
81+
git add src && \
82+
git commit -m "tidy" && \
83+
git fetch --unshallow origin ${{ github.head_ref || github.ref_name }} && \
84+
git push origin HEAD:${{ github.head_ref || github.ref_name }} \
85+
)
86+
87+
merge:
88+
89+
name: "Merge Changes"
90+
if: github.event_name == 'push'
91+
needs: [test]
92+
runs-on: 'ubuntu-latest'
93+
steps:
94+
- uses: actions/checkout@v3
95+
- run: |
96+
false || ( \
97+
git config user.name github-actions && \
98+
git config user.email [email protected] && \
99+
git fetch --unshallow origin ${{ github.ref_name }} develop && \
100+
git checkout develop && \
101+
git merge origin/${{ github.ref_name }} && \
102+
git push \
103+
)

.github/workflows/t.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
resources
22
composer.lock
33
vendor
4+
*~

.phptidy-config.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
$default_package = 'silverstripe-userform-utils';
4+
$add_operator_space = true;
5+
$fix_round_bracket_space = true;
6+
$add_file_docblock = false;
7+
$add_function_docblocks = true;
8+
$add_doctags = false;
9+
$fix_docblock_format = true;
10+
$fix_docblock_space = true;

README.md

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
# Silverstripe UserForms Utils
22

3-
A collection of utilities for the Silverstripe CMS UserForms module. This
4-
includes a shortcode to insert a user form into any content area and a user form
5-
widget.
3+
A collection of enhancements & utilities for the Silverstripe CMS
4+
[UserForms](https://github.com/silverstripe/silverstripe-userforms) module.
5+
6+
These include:
7+
8+
- a *shortcode* with which to insert a user form into any content area;
9+
- a *form widget* that presents a user form (requires
10+
[silverstripe/widgets](https://github.com/silverstripe/silverstripe-widgets));
11+
- various new *form fields*.
612

713
## Installation
814

915
```sh
1016
composer require "logicbrush/silverstripe-userforms-utils"
1117
```
1218

13-
## General Usage
19+
## Shortcode
1420

1521
To use the form shortcode we insert `[userform id="x"]` in a HTMLText area where
1622
`x` is the user form page ID.
@@ -23,3 +29,35 @@ when using the shortcode. This can be turned off by setting the following in a
2329
Logicbrush\UserFormsUtils\Shortcodes\UserFormShortcodeProvider:
2430
block_default_userforms_requirements: true
2531
```
32+
## Form Widget
33+
34+
Upon installation, the form widget will be available for insertion into any
35+
sidebar area using the CMS interface.
36+
37+
You have the ability to customize display with the following options:
38+
39+
- **Select a form** - Choose the User Form page to be displayed.
40+
- **Introductory text** - Specify arbitrary text that precedes the display of
41+
the form in the sidebar.
42+
- **Show form title?** - Choose whether to display the title of the form page.
43+
- **Show form content?** - Chose whether to display the content of the form
44+
page.
45+
46+
## Form Fields
47+
48+
This module provides a selection of new field types to use with your user forms.
49+
50+
### HTML5 Date Field
51+
52+
A field that utilizes the native HTML5 `date` input type. This enables
53+
browser-based input control and validation.
54+
55+
### US State Dropdown Field
56+
57+
A field that provides a dropdown of all US States, including DC.
58+
59+
### Signature Field
60+
61+
A field that collects a signature. Implemented using
62+
[jSignature](https://willowsystems.github.io/jSignature/#/about/).
63+

TODO.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# A list of things to do, in taskpaper format...
2+
3+
Version 1.2.0:
4+
- Documentation updates @done(24-09-28 10:25)
5+
6+
Archive:

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"phpunit/phpunit": "^9.5",
2828
"silverstripe/sqlite3": "*",
2929
"logicbrush/metrics": "*",
30-
"cmrcx/phptidy": "*"
30+
"cmrcx/phptidy": "*",
31+
"rector/rector": "^1.2"
3132
},
3233
"extra": {
3334
"expose": [

public/_resources/.htaccess

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Block .method file
2+
<Files .method>
3+
Require all denied
4+
</Files>
5+
6+
# Prevent file listings
7+
<IfModule mod_dir.c>
8+
DirectoryIndex disabled
9+
DirectorySlash On
10+
</IfModule>

public/_resources/.method

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto

public/_resources/client

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../client

0 commit comments

Comments
 (0)