Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
feeb495
created filepond component
skydiver Aug 6, 2020
9242120
register new component
skydiver Aug 6, 2020
4580bc3
added backend controller
skydiver Aug 6, 2020
90e6b3f
passing upload field name to backend
skydiver Aug 6, 2020
b94e1fd
create temp file if needed
skydiver Aug 6, 2020
a148710
linting
skydiver Aug 7, 2020
67e4554
show disabled uploads warning
skydiver Aug 7, 2020
1121c1d
storing files and relation
skydiver Dec 13, 2020
c2d2257
keep original upload filename
skydiver Dec 13, 2020
b3bc783
remove old ajax upload component
skydiver Dec 13, 2020
9f2c074
extract filepond code to shared partial
skydiver Dec 13, 2020
ec25ac1
removed unused settings
skydiver Dec 13, 2020
97dee5d
code cleanup
skydiver Dec 13, 2020
cba5f93
code cleanup
skydiver Dec 13, 2020
71e8d8f
refactoring email classes
skydiver Dec 14, 2020
5d87743
refactored email classes
skydiver Dec 14, 2020
9fd7336
code cleanup
skydiver Dec 14, 2020
2ed445e
added new param to set sender name on autoresponse email
skydiver Dec 14, 2020
3e1c4d1
disable submit button while uploading file
skydiver Dec 26, 2020
b991b02
added type hint to methods
skydiver Dec 26, 2020
b1af63f
upload file type validation
skydiver Dec 26, 2020
2b9e41d
Migration to WinterCMS (#2)
skydiver May 26, 2021
f825758
fixed wrong import
skydiver May 26, 2021
fe7289f
added upload size check
skydiver May 27, 2021
c36298c
tweaks related to uploads
skydiver May 27, 2021
f9f101c
new setting: upload file size
skydiver May 28, 2021
0e11078
validate upload file size
skydiver May 28, 2021
a4339be
bugfix: enable submit on upload error
skydiver May 28, 2021
4177410
move hardcoded strings to language file
skydiver May 29, 2021
54defeb
use global file size limit
skydiver May 29, 2021
61f73d7
version bump
skydiver May 29, 2021
7acee10
fix import
skydiver May 29, 2021
30504ef
export download urls
skydiver May 29, 2021
5497bec
added new setting to include attached files
skydiver May 29, 2021
2fed51d
upadted readme file
skydiver May 29, 2021
afb0562
renamed package name
skydiver May 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ about: Create a bug report for Magic Forms
Use issues to report errors / bugs only.

Do you have questions?
* Read the docs: https://skydiver.github.io/october-plugin-forms/docs/introduction/
* Start a discussion: https://github.com/skydiver/october-plugin-forms/discussions
* Read the docs: https://github.com/skydiver/wn-magic-forms/
* Start a discussion: https://github.com/skydiver/wn-magic-forms/discussions

-->
-->
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/skydiver/october-plugin-forms/discussions
about: Ask questions and discuss with other community members
url: https://github.com/skydiver/wn-magic-forms/discussions
about: Ask questions and discuss with other community members
193 changes: 101 additions & 92 deletions Plugin.php
Original file line number Diff line number Diff line change
@@ -1,107 +1,116 @@
<?php

namespace Martin\Forms;
namespace Martin\Forms;

use Backend, Lang, Validator;
use System\Classes\PluginBase;
use System\Classes\SettingsManager;
use Martin\Forms\Classes\BackendHelpers;
use Martin\Forms\Classes\GDPR;
use Martin\Forms\Classes\ReCaptchaValidator;
use Martin\Forms\Classes\UnreadRecords;
use Martin\Forms\Models\Settings;
use Backend\Facades\Backend;
use Martin\Forms\Classes\GDPR;
use System\Classes\PluginBase;
use Martin\Forms\Models\Settings;
use System\Classes\SettingsManager;
use Illuminate\Support\Facades\Lang;
use Martin\Forms\Classes\UnreadRecords;
use Martin\Forms\Classes\BackendHelpers;
use Winter\Storm\Support\Facades\Validator;

class Plugin extends PluginBase {

public function pluginDetails() {
return [
'name' => 'martin.forms::lang.plugin.name',
'description' => 'martin.forms::lang.plugin.description',
'author' => 'Martin M.',
'icon' => 'icon-bolt',
'homepage' => 'https://github.com/skydiver/'
];
}
class Plugin extends PluginBase
{
public function pluginDetails()
{
return [
'name' => 'martin.forms::lang.plugin.name',
'description' => 'martin.forms::lang.plugin.description',
'author' => 'Martin M.',
'icon' => 'icon-bolt',
'homepage' => 'https://github.com/skydiver/'
];
}

public function registerNavigation() {
if(Settings::get('global_hide_button', false)) { return; }
return [
'forms' => [
'label' => 'martin.forms::lang.menu.label',
'icon' => 'icon-bolt',
'iconSvg' => 'plugins/martin/forms/assets/imgs/icon.svg',
'url' => BackendHelpers::getBackendURL(['martin.forms.access_records' => 'martin/forms/records', 'martin.forms.access_exports' => 'martin/forms/exports'], 'martin.forms.access_records'),
'permissions' => ['martin.forms.*'],
'sideMenu' => [
'records' => [
'label' => 'martin.forms::lang.menu.records.label',
'icon' => 'icon-database',
'url' => Backend::url('martin/forms/records'),
'permissions' => ['martin.forms.access_records'],
'counter' => UnreadRecords::getTotal(),
'counterLabel' => 'Un-Read Messages'
],
'exports' => [
'label' => 'martin.forms::lang.menu.exports.label',
'icon' => 'icon-download',
'url' => Backend::url('martin/forms/exports'),
'permissions' => ['martin.forms.access_exports']
],
]
]
];
public function registerNavigation()
{
if (Settings::get('global_hide_button', false)) {
return;
}

public function registerSettings() {
return [
'config' => [
'label' => 'martin.forms::lang.menu.label',
'description' => 'martin.forms::lang.menu.settings',
'category' => SettingsManager::CATEGORY_CMS,
'icon' => 'icon-bolt',
'class' => 'Martin\Forms\Models\Settings',
'permissions' => ['martin.forms.access_settings'],
'order' => 500
return [
'forms' => [
'label' => 'martin.forms::lang.menu.label',
'icon' => 'icon-bolt',
'iconSvg' => 'plugins/martin/forms/assets/imgs/icon.svg',
'url' => BackendHelpers::getBackendURL(['martin.forms.access_records' => 'martin/forms/records', 'martin.forms.access_exports' => 'martin/forms/exports'], 'martin.forms.access_records'),
'permissions' => ['martin.forms.*'],
'sideMenu' => [
'records' => [
'label' => 'martin.forms::lang.menu.records.label',
'icon' => 'icon-database',
'url' => Backend::url('martin/forms/records'),
'permissions' => ['martin.forms.access_records'],
'counter' => UnreadRecords::getTotal(),
'counterLabel' => 'Un-Read Messages'
],
'exports' => [
'label' => 'martin.forms::lang.menu.exports.label',
'icon' => 'icon-download',
'url' => Backend::url('martin/forms/exports'),
'permissions' => ['martin.forms.access_exports']
],
]
];
}

public function registerPermissions() {
return [
'martin.forms.access_settings' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.access_settings'],
'martin.forms.access_records' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.access_records'],
'martin.forms.access_exports' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.access_exports'],
'martin.forms.gdpr_cleanup' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.gdpr_cleanup'],
];
}
]
];
}

public function registerComponents() {
return [
'Martin\Forms\Components\GenericForm' => 'genericForm',
'Martin\Forms\Components\UploadForm' => 'uploadForm',
'Martin\Forms\Components\EmptyForm' => 'emptyForm',
];
}
public function registerSettings()
{
return [
'config' => [
'label' => 'martin.forms::lang.menu.label',
'description' => 'martin.forms::lang.menu.settings',
'category' => SettingsManager::CATEGORY_CMS,
'icon' => 'icon-bolt',
'class' => 'Martin\Forms\Models\Settings',
'permissions' => ['martin.forms.access_settings'],
'order' => 500
]
];
}

public function registerMailTemplates() {
return [
'martin.forms::mail.notification' => Lang::get('martin.forms::lang.mails.form_notification.description'),
'martin.forms::mail.autoresponse' => Lang::get('martin.forms::lang.mails.form_autoresponse.description'),
];
}
public function registerPermissions()
{
return [
'martin.forms.access_settings' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.access_settings'],
'martin.forms.access_records' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.access_records'],
'martin.forms.access_exports' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.access_exports'],
'martin.forms.gdpr_cleanup' => ['tab' => 'martin.forms::lang.permissions.tab', 'label' => 'martin.forms::lang.permissions.gdpr_cleanup'],
];
}

public function register() {
$this->app->resolving('validator', function($validator) {
Validator::extend('recaptcha', 'Martin\Forms\Classes\ReCaptchaValidator@validateReCaptcha');
});
}
public function registerComponents()
{
return [
'Martin\Forms\Components\GenericForm' => 'genericForm',
'Martin\Forms\Components\FilePondForm' => 'filepondForm',
'Martin\Forms\Components\EmptyForm' => 'emptyForm',
];
}

public function registerSchedule($schedule) {
$schedule->call(function () {
$records = GDPR::cleanRecords();
})->daily();
}
public function registerMailTemplates()
{
return [
'martin.forms::mail.notification' => Lang::get('martin.forms::lang.mails.form_notification.description'),
'martin.forms::mail.autoresponse' => Lang::get('martin.forms::lang.mails.form_autoresponse.description'),
];
}

public function register()
{
$this->app->resolving('validator', function () {
Validator::extend('recaptcha', 'Martin\Forms\Classes\ReCaptchaValidator@validateReCaptcha');
});
}

?>
public function registerSchedule($schedule)
{
$schedule->call(function () {
GDPR::cleanRecords();
})->daily();
}
}
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
# Magic Forms for OctoberCMS
Create easy (and almost magic) AJAX forms.

![](https://banners.beyondco.de/Magic%20Forms%20for%20WinterCMS.png?theme=light&packageManager=composer+require&packageName=martin%2Fwn-forms-plugin&pattern=architect&style=style_1&description=Create+easy+%28and+almost+magic%29+forms&md=1&showWatermark=0&fontSize=100px&images=lightning-bolt)


## Why Magic Forms?
Expand All @@ -11,7 +9,6 @@ Sometimes we need to add or remove fields, change validations, store data and at
So, the objective was to find a way to just put the HTML elements on the page, skip the repetitive task of coding and (with some kind of magic) store this data on a database or send by mail.



## Features
* Create any type of form: contact, feedback, registration, uploads, etc
* Write only HTML
Expand All @@ -27,10 +24,9 @@ So, the objective was to find a way to just put the HTML elements on the page, s
* reCAPTCHA validation
* Support for Translate plugin
* Inline errors with fields (read documentation for more info)
* AJAX file uploads (BETA, available since v1.3.0)

* File uploads using Filepond


## Documentation
Checkout our docs at:
> https://skydiver.github.io/october-plugin-forms/
> https://magicforms.vercel.app/
Loading