mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Merge pull request #676 from creative-commoners/pulls/5.0/vendorise-my-baby
Convert to vendor module, remove secure assets suggestion
This commit is contained in:
commit
57cd0b961d
@ -2,7 +2,7 @@ language: php
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- COMPOSER_ROOT_VERSION=4.0.x-dev
|
- COMPOSER_ROOT_VERSION=5.0.x-dev
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
@ -8,7 +8,6 @@ use SilverStripe\Assets\Upload;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Email\Email;
|
use SilverStripe\Control\Email\Email;
|
||||||
use SilverStripe\Control\HTTP;
|
use SilverStripe\Control\HTTP;
|
||||||
use SilverStripe\Core\Manifest\Module;
|
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\i18n\i18n;
|
use SilverStripe\i18n\i18n;
|
||||||
@ -45,28 +44,26 @@ class UserDefinedFormController extends PageController
|
|||||||
|
|
||||||
$page = $this->data();
|
$page = $this->data();
|
||||||
|
|
||||||
$userforms = ModuleLoader::getModule('silverstripe/userforms');
|
|
||||||
$admin = ModuleLoader::getModule('silverstripe/admin');
|
|
||||||
// load the css
|
// load the css
|
||||||
if (!$page->config()->get('block_default_userforms_css')) {
|
if (!$page->config()->get('block_default_userforms_css')) {
|
||||||
Requirements::css($userforms->getRelativeResourcePath('client/dist/styles/userforms.css'));
|
Requirements::css('silverstripe/userforms:client/dist/styles/userforms.css');
|
||||||
}
|
}
|
||||||
|
|
||||||
// load the jquery
|
// load the jquery
|
||||||
if (!$page->config()->get('block_default_userforms_js')) {
|
if (!$page->config()->get('block_default_userforms_js')) {
|
||||||
Requirements::javascript('//code.jquery.com/jquery-1.7.2.min.js');
|
Requirements::javascript('//code.jquery.com/jquery-1.7.2.min.js');
|
||||||
Requirements::javascript(
|
Requirements::javascript(
|
||||||
$userforms->getRelativeResourcePath('client/thirdparty/jquery-validate/jquery.validate.min.js')
|
'silverstripe/userforms:client/thirdparty/jquery-validate/jquery.validate.min.js'
|
||||||
);
|
);
|
||||||
Requirements::add_i18n_javascript($userforms->getRelativeResourcePath('client/lang'));
|
Requirements::add_i18n_javascript('silverstripe/userforms:client/lang');
|
||||||
Requirements::javascript($userforms->getRelativeResourcePath('client/dist/js/userforms.js'));
|
Requirements::javascript('silverstripe/userforms:client/dist/js/userforms.js');
|
||||||
|
|
||||||
$this->addUserFormsValidatei18n($userforms);
|
$this->addUserFormsValidatei18n();
|
||||||
|
|
||||||
// Bind a confirmation message when navigating away from a partially completed form.
|
// Bind a confirmation message when navigating away from a partially completed form.
|
||||||
if ($page::config()->get('enable_are_you_sure')) {
|
if ($page::config()->get('enable_are_you_sure')) {
|
||||||
Requirements::javascript(
|
Requirements::javascript(
|
||||||
$userforms->getRelativeResourcePath('client/thirdparty/jquery.are-you-sure/jquery.are-you-sure.js')
|
'silverstripe/userforms:client/thirdparty/jquery.are-you-sure/jquery.are-you-sure.js'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,11 +73,11 @@ class UserDefinedFormController extends PageController
|
|||||||
* Add the necessary jQuery validate i18n translation files, either by locale or by langauge,
|
* Add the necessary jQuery validate i18n translation files, either by locale or by langauge,
|
||||||
* e.g. 'en_NZ' or 'en'. This adds "methods_abc.min.js" as well as "messages_abc.min.js" from the
|
* e.g. 'en_NZ' or 'en'. This adds "methods_abc.min.js" as well as "messages_abc.min.js" from the
|
||||||
* jQuery validate thirdparty library.
|
* jQuery validate thirdparty library.
|
||||||
*
|
|
||||||
* @param Module $module
|
|
||||||
*/
|
*/
|
||||||
protected function addUserFormsValidatei18n(Module $module)
|
protected function addUserFormsValidatei18n()
|
||||||
{
|
{
|
||||||
|
$module = ModuleLoader::getModule('silverstripe/userforms');
|
||||||
|
|
||||||
$candidates = [
|
$candidates = [
|
||||||
i18n::getData()->langFromLocale(i18n::config()->get('default_locale')),
|
i18n::getData()->langFromLocale(i18n::config()->get('default_locale')),
|
||||||
i18n::config()->get('default_locale'),
|
i18n::config()->get('default_locale'),
|
||||||
@ -91,8 +88,10 @@ class UserDefinedFormController extends PageController
|
|||||||
foreach ($candidates as $candidate) {
|
foreach ($candidates as $candidate) {
|
||||||
foreach (['messages', 'methods'] as $candidateType) {
|
foreach (['messages', 'methods'] as $candidateType) {
|
||||||
$localisationCandidate = "client/thirdparty/jquery-validate/localization/{$candidateType}_{$candidate}.min.js";
|
$localisationCandidate = "client/thirdparty/jquery-validate/localization/{$candidateType}_{$candidate}.min.js";
|
||||||
if ($module->hasResource($localisationCandidate)) {
|
|
||||||
Requirements::javascript($module->getRelativeResourcePath($localisationCandidate));
|
$resource = $module->getResource($localisationCandidate);
|
||||||
|
if ($resource->exists()) {
|
||||||
|
Requirements::javascript($resource->getRelativePath());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace SilverStripe\UserForms\Extension;
|
namespace SilverStripe\UserForms\Extension;
|
||||||
|
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\Tab;
|
use SilverStripe\Forms\Tab;
|
||||||
use SilverStripe\Forms\GridField\GridField;
|
use SilverStripe\Forms\GridField\GridField;
|
||||||
@ -66,8 +65,7 @@ class UserFormFieldEditorExtension extends DataExtension
|
|||||||
*/
|
*/
|
||||||
public function getFieldEditorGrid()
|
public function getFieldEditorGrid()
|
||||||
{
|
{
|
||||||
$module = ModuleLoader::getModule('silverstripe/userforms');
|
Requirements::javascript('silverstripe/userforms:client/dist/js/userforms-cms.js');
|
||||||
Requirements::javascript($module->getRelativeResourcePath('client/dist/js/userforms-cms.js'));
|
|
||||||
|
|
||||||
$fields = $this->owner->Fields();
|
$fields = $this->owner->Fields();
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@ use SilverStripe\CMS\Controllers\CMSMain;
|
|||||||
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
use SilverStripe\CMS\Controllers\CMSPageEditController;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Email\Email;
|
use SilverStripe\Control\Email\Email;
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Forms\FieldGroup;
|
use SilverStripe\Forms\FieldGroup;
|
||||||
@ -187,9 +186,7 @@ class EmailRecipient extends DataObject
|
|||||||
*/
|
*/
|
||||||
public function getCMSFields()
|
public function getCMSFields()
|
||||||
{
|
{
|
||||||
Requirements::javascript(
|
Requirements::javascript('silverstripe/userforms:client/dist/js/userforms-cms.js');
|
||||||
ModuleLoader::getModule('silverstripe/userforms')->getRelativeResourcePath('client/dist/js/userforms-cms.js')
|
|
||||||
);
|
|
||||||
|
|
||||||
// Determine optional field values
|
// Determine optional field values
|
||||||
$form = $this->getFormParent();
|
$form = $this->getFormParent();
|
||||||
|
@ -4,7 +4,6 @@ namespace SilverStripe\UserForms;
|
|||||||
|
|
||||||
use Colymba\BulkManager\BulkManager;
|
use Colymba\BulkManager\BulkManager;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\CompositeField;
|
use SilverStripe\Forms\CompositeField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
@ -167,10 +166,7 @@ trait UserForm
|
|||||||
*/
|
*/
|
||||||
public function getCMSFields()
|
public function getCMSFields()
|
||||||
{
|
{
|
||||||
Requirements::css(
|
Requirements::css('silverstripe/userforms:client/dist/styles/userforms-cms.css');
|
||||||
ModuleLoader::getModule('silverstripe/userforms')
|
|
||||||
->getRelativeResourcePath('client/dist/styles/userforms-cms.css')
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->beforeUpdateCMSFields(function ($fields) {
|
$this->beforeUpdateCMSFields(function ($fields) {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "silverstripe/userforms",
|
"name": "silverstripe/userforms",
|
||||||
"description": "UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code",
|
"description": "UserForms enables CMS users to create dynamic forms via a drag and drop interface and without getting involved in any PHP code",
|
||||||
"type": "silverstripe-module",
|
"type": "silverstripe-vendormodule",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"silverstripe",
|
"silverstripe",
|
||||||
"userforms"
|
"userforms"
|
||||||
@ -48,13 +48,18 @@
|
|||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
"colymba/gridfield-bulk-editing-tools": "Allows for bulk management of form submissions",
|
"colymba/gridfield-bulk-editing-tools": "Allows for bulk management of form submissions",
|
||||||
"silverstripe/secureassets": "Enables files uploaded via userforms to be secured from public access",
|
|
||||||
"silverstripe/gridfieldqueuedexport": "Export large submission as CSV through queued jobs in the background"
|
"silverstripe/gridfieldqueuedexport": "Export large submission as CSV through queued jobs in the background"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "5.0.x-dev"
|
"dev-master": "5.0.x-dev"
|
||||||
}
|
},
|
||||||
|
"expose": [
|
||||||
|
"client/dist",
|
||||||
|
"client/lang",
|
||||||
|
"client/thirdparty",
|
||||||
|
"images"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"minimum-stability": "dev"
|
"minimum-stability": "dev"
|
||||||
|
Loading…
Reference in New Issue
Block a user