From 3f0c04523c7cd67c1cacb6450543dc6b25484c8e Mon Sep 17 00:00:00 2001 From: Bram de Leeuw Date: Tue, 26 Apr 2016 10:39:45 +0200 Subject: [PATCH 1/5] added missing semicolons Added two missing semicolons --- code/model/editableformfields/EditableFileField.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/model/editableformfields/EditableFileField.php b/code/model/editableformfields/EditableFileField.php index 83bb1cc..2fe8954 100755 --- a/code/model/editableformfields/EditableFileField.php +++ b/code/model/editableformfields/EditableFileField.php @@ -50,9 +50,9 @@ class EditableFileField extends EditableFormField { public function getFormField() { if(isset(Config::inst()->get('EditableFileField', 'use_uploadfield')) && Config::inst()->get('EditableFileField', 'use_uploadfield')) { - $field = Upload::create($this->Name, $this->EscapedTitle) + $field = Upload::create($this->Name, $this->EscapedTitle); } else { - $field = FileField::create($this->Name, $this->EscapedTitle) + $field = FileField::create($this->Name, $this->EscapedTitle); } $field->setFieldHolderTemplate('UserFormsField_holder') From f029bfcc61f4cc7680c5456fe6199358c73b2843 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Thu, 28 Apr 2016 18:05:19 +1200 Subject: [PATCH 2/5] Partial revert of #458 Fix travis configuration --- .travis.yml | 26 +++++-------------- .../editableformfields/EditableFileField.php | 10 +++---- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4b005c7..6367e79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,24 +4,20 @@ sudo: false language: php -php: - - 5.3 - - 5.4 - - 5.5 - - 5.6 - - 7.0 - -env: - - DB=MYSQL CORE_RELEASE=3.1 - matrix: include: + - php: 5.3 + env: DB=MYSQL CORE_RELEASE=3.1 + - php: 5.4 + env: DB=MYSQL CORE_RELEASE=3.2 + - php: 5.5 + env: DB=MYSQL CORE_RELEASE=3.3 - php: 5.6 env: DB=MYSQL CORE_RELEASE=3 - php: 5.6 env: DB=MYSQL CORE_RELEASE=3.1 SECUREASSETS=1 - php: 5.6 - env: DB=PGSQL CORE_RELEASE=3.1 + env: DB=PGSQL CORE_RELEASE=3.3 before_script: - git clone git://github.com/silverstripe-labs/silverstripe-travis-support.git ~/travis-support @@ -35,11 +31,3 @@ script: - git remote rm origin - git remote add origin git@github.com:silverstripe/silverstripe-userforms.git - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - -branches: - only: - - master - -matrix: - allow_failures: - - php: 7.0 diff --git a/code/model/editableformfields/EditableFileField.php b/code/model/editableformfields/EditableFileField.php index 2fe8954..37fa70d 100755 --- a/code/model/editableformfields/EditableFileField.php +++ b/code/model/editableformfields/EditableFileField.php @@ -49,12 +49,10 @@ class EditableFileField extends EditableFormField { } public function getFormField() { - if(isset(Config::inst()->get('EditableFileField', 'use_uploadfield')) && Config::inst()->get('EditableFileField', 'use_uploadfield')) { - $field = Upload::create($this->Name, $this->EscapedTitle); - } else { - $field = FileField::create($this->Name, $this->EscapedTitle); - } - + $field = FileField::create($this->Name, $this->EscapedTitle) + ->setFieldHolderTemplate('UserFormsField_holder') + ->setTemplate('UserFormsFileField'); + $field->setFieldHolderTemplate('UserFormsField_holder') ->setTemplate('UserFormsFileField'); From 14b7c65859362f0cfee18d11d9ca14b363e4b2be Mon Sep 17 00:00:00 2001 From: muskie9 Date: Thu, 14 Jul 2016 09:29:25 -0500 Subject: [PATCH 3/5] BUGFIX progress bar button text change breaks buttons fixes #488 --- code/forms/UserForm.php | 8 ++++++++ code/model/UserDefinedForm.php | 1 + docs/en/installation.md | 11 ++++++++++- javascript/UserForm.js | 4 ++-- templates/Includes/UserFormProgress.ss | 2 +- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/code/forms/UserForm.php b/code/forms/UserForm.php index 2b69da5..09f4233 100644 --- a/code/forms/UserForm.php +++ b/code/forms/UserForm.php @@ -173,4 +173,12 @@ class UserForm extends Form { return $attrs; } + + /** + * @return string + */ + public function getButtonText() { + return $this->config()->get('button_text'); + } + } diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index 2592526..0edee64 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -311,6 +311,7 @@ SQL; public function getCMSValidator() { return new UserFormValidator(); } + } /** diff --git a/docs/en/installation.md b/docs/en/installation.md index d3a5600..23c3593 100644 --- a/docs/en/installation.md +++ b/docs/en/installation.md @@ -83,4 +83,13 @@ UserDefinedForm: email_template_directory: your/template/path/ ```` -Any SilverStripe templates placed in your `email_template_directory` directory will be available for use with submission emails. \ No newline at end of file +Any SilverStripe templates placed in your `email_template_directory` directory will be available for use with submission emails. + +### Custom Multi-Step button Text + +If you want to change the button text when using the Multi-Step/Page Break feature, simply add the following to your `config.yml`: + +```` +UserForm: + button_text: 'Your Text Here' +```` \ No newline at end of file diff --git a/javascript/UserForm.js b/javascript/UserForm.js index 5e7eac6..bab46a2 100644 --- a/javascript/UserForm.js +++ b/javascript/UserForm.js @@ -464,7 +464,7 @@ jQuery(function ($) { this.$buttons.each(function (i, stepButton) { $(stepButton).on('click', function (e) { e.preventDefault(); - self.$el.trigger('userform.progress.changestep', [parseInt($(this).text(), 10)]); + self.$el.trigger('userform.progress.changestep', [parseInt($(this).data('step'), 10)]); }); }); @@ -548,7 +548,7 @@ jQuery(function ($) { var $element = $(element), $item = $element.parent(); - if (parseInt($element.text(), 10) === stepNumber && $element.is(':visible')) { + if (parseInt($element.data('step'), 10) === stepNumber && $element.is(':visible')) { $item.addClass('current viewed'); $element.removeAttr('disabled'); diff --git a/templates/Includes/UserFormProgress.ss b/templates/Includes/UserFormProgress.ss index 0097ce3..0eebf13 100644 --- a/templates/Includes/UserFormProgress.ss +++ b/templates/Includes/UserFormProgress.ss @@ -9,7 +9,7 @@ <% loop $Steps %>
  • <%-- Remove js-align class to remove javascript positioning --%> - +
  • <% end_loop %> From 08646ad45eb9093942bafa743e0c73a6da57bb84 Mon Sep 17 00:00:00 2001 From: muskie9 Date: Thu, 21 Jul 2016 01:08:03 -0500 Subject: [PATCH 4/5] BUGFIX no Sort value applie to EditableOption on write --- code/model/editableformfields/EditableOption.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/model/editableformfields/EditableOption.php b/code/model/editableformfields/EditableOption.php index 16812f5..7cce556 100644 --- a/code/model/editableformfields/EditableOption.php +++ b/code/model/editableformfields/EditableOption.php @@ -114,4 +114,15 @@ class EditableOption extends DataObject { public function canUnpublish($member = null) { return $this->canDelete($member); } + + /** + * + */ + protected function onBeforeWrite() { + if (!$this->Sort) { + $this->Sort = EditableOption::get()->max('Sort') + 1; + } + + parent::onBeforeWrite(); + } } From 76483188dc781394ed4b602a4192c21f121d104e Mon Sep 17 00:00:00 2001 From: Nic Horstmeier Date: Tue, 20 Sep 2016 19:26:47 -0500 Subject: [PATCH 5/5] BUGFIX EditableFormHeading doesn't properly handle numeric values fixes #510 --- code/model/editableformfields/EditableFormHeading.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/model/editableformfields/EditableFormHeading.php b/code/model/editableformfields/EditableFormHeading.php index 03a1176..f85d18d 100755 --- a/code/model/editableformfields/EditableFormHeading.php +++ b/code/model/editableformfields/EditableFormHeading.php @@ -56,7 +56,8 @@ class EditableFormHeading extends EditableFormField { } public function getFormField() { - $labelField = new HeaderField($this->Name, $this->EscapedTitle, $this->Level); + $labelField = HeaderField::create($this->EscapedTitle) + ->setHeadingLevel($this->Level); $labelField->addExtraClass('FormHeading'); $labelField->setAttribute('data-id', $this->Name); $this->doUpdateFormField($labelField);