Skip to content

Commit

Permalink
Release v2.0.0 (#1)
Browse files Browse the repository at this point in the history
* created filepond component

* register new component

* added backend controller

credits to: https://github.com/Sopamo/laravel-filepond/

* passing upload field name to backend

* create temp file if needed

* linting

* show disabled uploads warning

* storing files and relation

* keep original upload filename

* remove old ajax upload component

* extract filepond code to shared partial

* removed unused settings

* code cleanup

* code cleanup

* refactoring email classes

* refactored email classes

* code cleanup

* added new param to set sender name on autoresponse email

* disable submit button while uploading file

* added type hint to methods

* upload file type validation

* Migration to WinterCMS (#2)

* update references to Winter

* update Winter imports

* update references to Winter

* update references to Winter

* fixed wrong import

* added upload size check

* tweaks related to uploads

* new setting: upload file size

* validate upload file size

* bugfix: enable submit on upload error

* move hardcoded strings to language file

* use global file size limit

* version bump

* fix import

* export download urls

* added new setting to include attached files

* upadted readme file

* renamed package name
  • Loading branch information
skydiver authored May 29, 2021
1 parent 47e17fc commit 805f3af
Show file tree
Hide file tree
Showing 54 changed files with 1,287 additions and 5,022 deletions.
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

0 comments on commit 805f3af

Please sign in to comment.