Skip to content

Commit

Permalink
Revert "Merge pull request #42 from damanikrish/allow-custom-rules"
Browse files Browse the repository at this point in the history
This reverts commit 58404d3, reversing
changes made to 28bdbf6.
  • Loading branch information
bramstroker committed Sep 13, 2016
1 parent 58404d3 commit 00b39a7
Show file tree
Hide file tree
Showing 65 changed files with 1,651 additions and 2,298 deletions.
27 changes: 0 additions & 27 deletions .editorconfig

This file was deleted.

2 changes: 0 additions & 2 deletions .gitignore
Expand Up @@ -5,5 +5,3 @@ vendor
composer.lock
composer.phar
/.project
.idea/
build/
43 changes: 0 additions & 43 deletions .php_cs

This file was deleted.

52 changes: 14 additions & 38 deletions .travis.yml
@@ -1,43 +1,19 @@
sudo: false

language: php

cache:
directories:
- $HOME/.composer/
- $HOME/.local

matrix:
fast_finish: true
include:
- php: 5.6
env:
- EXECUTE_TEST_COVERALLS=true
- PATH="$HOME/.local/bin:$PATH"
- php: 5.6
env:
- EXECUTE_TEST_COVERALLS=true
- PATH="$HOME/.local/bin:$PATH"
- php: 7
- php: hhvm
allow_failures:
- php: hhvm

notifications:
email: false

before_install:
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
- composer self-update
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then composer require --dev --no-update satooshi/php-coveralls ; fi

install:
- travis_retry composer install --no-interaction --ignore-platform-reqs

php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

before_script:
- composer self-update
- composer install --prefer-source --dev

script:
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/phpunit --coverage-clover clover.xml ; fi
- if [[ $EXECUTE_TEST_COVERALLS != 'true' ]]; then ./vendor/bin/phpunit ; fi
- if [[ $EXECUTE_CS_CHECK == 'true' ]]; then ./vendor/bin/php-cs-fixer fix -v --diff --dry-run ; fi
- mkdir -p build/logs
- phpunit

after_script:
- if [[ $EXECUTE_TEST_COVERALLS == 'true' ]]; then ./vendor/bin/coveralls ; fi
- php vendor/bin/coveralls -v
27 changes: 9 additions & 18 deletions Module.php
Expand Up @@ -9,20 +9,11 @@
*/
namespace StrokerForm;

use StrokerForm\Controller\AjaxController;
use StrokerForm\Factory\AjaxControllerFactory;
use StrokerForm\Factory\FormElementFactory;
use StrokerForm\Factory\FormManagerFactory;
use StrokerForm\Factory\FormPrepareFactory;
use StrokerForm\Factory\ModuleOptionsFactory;
use StrokerForm\Factory\Renderer\JqueryValidate\RendererFactory as jQueryRendererFactory;
use StrokerForm\Factory\RendererFactory;
use StrokerForm\Options\ModuleOptions;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;
use Zend\ModuleManager\Feature\ControllerProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\ModuleManager\Feature\ViewHelperProviderInterface;

class Module implements
AutoloaderProviderInterface,
Expand Down Expand Up @@ -52,10 +43,10 @@ public function getServiceConfig()
{
return array(
'factories' => array(
ModuleOptions::class => ModuleOptionsFactory::class,
FormManager::class => FormManagerFactory::class,
'stroker_form.renderer' => RendererFactory::class,
'stroker_form.renderer.jqueryvalidate' => jQueryRendererFactory::class,
'StrokerForm\Options\ModuleOptions' => 'StrokerForm\Factory\ModuleOptionsFactory',
'StrokerForm\FormManager' => 'StrokerForm\Factory\FormManagerFactory',
'stroker_form.renderer' => 'StrokerForm\Factory\RendererFactory',
'stroker_form.renderer.jqueryvalidate' => 'StrokerForm\Factory\Renderer\JqueryValidate\RendererFactory',
),
);
}
Expand All @@ -75,7 +66,7 @@ public function getControllerConfig()
{
return array(
'factories' => array(
AjaxController::class => AjaxControllerFactory::class
'StrokerForm\Controller\Ajax' => 'StrokerForm\Factory\AjaxControllerFactory'
),
);
}
Expand All @@ -87,8 +78,8 @@ public function getViewHelperConfig()
{
return array(
'factories' => array(
'form_element' => FormElementFactory::class,
'strokerFormPrepare' => FormPrepareFactory::class
'form_element' => 'StrokerForm\Factory\FormElementFactory',
'strokerFormPrepare' => 'StrokerForm\Factory\FormPrepareFactory'
)
);
}
Expand Down
25 changes: 2 additions & 23 deletions assets/jquery_validate/js/custom_rules.js
@@ -1,24 +1,3 @@
$.validator.addMethod("in_array", function(value, element, haystack) {
var check = ($.inArray(value, haystack) !== -1);

if(!check) {
try {
value = parseInt(value, 10);
} catch(err) {
return check;
}

check = ($.inArray(value, haystack) !== -1);
}

return check;
});

$.validator.addMethod(
"regex",
function(value, element, pattern) {
var check = false;
var regexp = new RegExp(pattern);
return this.optional(element) || regexp.test(value);
}
);
return (haystack.indexOf(value) !== -1);
});
16 changes: 8 additions & 8 deletions assets/jquery_validate/js/jquery.validate.bootstrap.js
@@ -1,6 +1,6 @@
$.extend($.validator.prototype, {
showLabel: function (element, message) {
var label = this.errorsFor(element);
showLabel: function(element, message) {
var label = this.errorsFor( element );

if (label.length == 0) {
var railsGenerated = $(element).next('span.help-inline');
Expand All @@ -19,7 +19,7 @@ $.extend($.validator.prototype, {
} else {
// create label
label = $('<' + this.settings.errorElement + '/>')
.attr({'for': this.idOrName(element), generated: true})
.attr({'for': this.idOrName(element), generated: true})
.addClass(this.settings.errorClass)
.addClass('help-inline')
.html(message || '');
Expand Down Expand Up @@ -54,7 +54,7 @@ $.extend($.validator.defaults, {
highlight: function (element, errorClass, validClass) {
if (element.type === 'radio') {
this.findByName(element.name).closest('div.control-group').removeClass(validClass).addClass(errorClass);
} else {
}else {
$(element).closest('div.control-group').removeClass(validClass).addClass(errorClass);
}
},
Expand All @@ -67,23 +67,23 @@ $.extend($.validator.defaults, {
$(element).next('span.help-inline').text('');
}
},
errorPlacement: function (error, element) {
errorPlacement: function(error, element) {
var isInputAppend = ($(element).parent('div.input-append').length > 0);
var isRadio = ($(element).attr('type') == 'radio');
var iMultiCheckbox = ($(element).attr('type') == 'checkbox' && $(element).attr('name').endsWith('[]'));
if (isRadio || iMultiCheckbox) {
afterElement = $(element).closest('div.controls').children('label').filter(':last');
error.insertAfter(afterElement);
} else if (isInputAppend) {
}else if (isInputAppend) {
appendElement = $(element).next('span.add-on');
error.insertAfter(appendElement);
} else {
}else {
error.insertAfter(element);
}
}
});

String.prototype.endsWith = function (pattern) {
String.prototype.endsWith = function(pattern) {
var d = this.length - pattern.length;
return d >= 0 && this.lastIndexOf(pattern) === d;
};

0 comments on commit 00b39a7

Please sign in to comment.