From 492d3cfd27d88bace856b7e0a8f6ed3cae3b30ed Mon Sep 17 00:00:00 2001 From: Gonzalo Alonso Date: Sun, 26 Jun 2016 11:57:56 -0300 Subject: [PATCH 01/12] Soporte para Symfony 3 --- composer.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 75ff649..1628acd 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "stephanecollot/datetimepicker-bundle", - "version": "1.0.1", + "name": "mwsimple/datetimepicker-bundle", + "version": "2.0.0", "description": "Symfony bundle for Bootstrap DateTime picker", "keywords": ["symfony", "bootstrap", "bundle", "picker", "datepicker", "timepicker"], "type": "symfony-bundle", @@ -11,9 +11,9 @@ } ], "require": { - "php": ">=5.3", - "symfony/framework-bundle": "2.*", - "symfony/symfony": "2.*" + "php": ">=5.5.9", + "symfony/framework-bundle": "~2.8 || ~3.0", + "symfony/symfony": "3.*" }, "autoload": { "psr-0": { From 1fbea2d6132fa833fd7299d06582e104424dadd2 Mon Sep 17 00:00:00 2001 From: Gonzalo Alonso Date: Sun, 26 Jun 2016 12:29:32 -0300 Subject: [PATCH 02/12] cambio nombre form type --- .../{DatetimeType.php => SCDatetimeType.php} | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) rename Form/Type/{DatetimeType.php => SCDatetimeType.php} (89%) diff --git a/Form/Type/DatetimeType.php b/Form/Type/SCDatetimeType.php similarity index 89% rename from Form/Type/DatetimeType.php rename to Form/Type/SCDatetimeType.php index be802aa..eba454d 100644 --- a/Form/Type/DatetimeType.php +++ b/Form/Type/SCDatetimeType.php @@ -16,12 +16,13 @@ use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\Extension\Core\Type\DateTimeType; /** -* DatetimeType +* SCDatetimeType * */ -class DatetimeType extends AbstractType +class SCDatetimeType extends AbstractType { /** * @@ -46,7 +47,7 @@ class DatetimeType extends AbstractType * * @param array $options */ - public function __construct(array $options) + public function __construct(array $options = array()) { $this->options = $options; @@ -69,7 +70,7 @@ public function buildView(FormView $view, FormInterface $form, array $options) if(!isset($pickerOptions['format'])) $pickerOptions['format'] = 'mm/dd/yyyy HH:ii'; - if ($pickerOptions['formatter'] == 'php'){ + if (isset($pickerOptions['formatter']) && $pickerOptions['formatter'] == 'php'){ $pickerOptions['format'] = DatetimeType::convertIntlFormaterToMalot( $pickerOptions['format'] ); } @@ -91,13 +92,13 @@ public function configureOptions(OptionsResolver $resolver) 'format' => function (Options $options, $value) use ($configs) { $pickerOptions = array_merge($configs, $options['pickerOptions']); - if ($pickerOptions['formatter'] == 'php'){ + if (isset($pickerOptions['formatter']) && $pickerOptions['formatter'] == 'php'){ if (isset($pickerOptions['format'])){ return $pickerOptions['format']; } else { return 'mm/dd/yyyy HH:ii'; } - } elseif ($pickerOptions['formatter'] == 'js'){ + } elseif (isset($pickerOptions['formatter']) && $pickerOptions['formatter'] == 'js'){ if (isset($pickerOptions['format'])){ return DatetimeType::convertMalotToIntlFormater( $pickerOptions['format'] ); } else { @@ -159,12 +160,12 @@ public static function convertMalotToIntlFormater($formatter) */ public function getParent() { - return \Symfony\Component\Form\Extension\Core\Type\DateTimeType::class; + return DateTimeType::class; } public function getName() { - return 'collot_datetime'; + return $this->getBlockPrefix(); } public function getBlockPrefix() From f9c5ca34dbda1b2075a37cf6d403ae585dcc1ace Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 27 Jun 2016 15:21:41 -0300 Subject: [PATCH 03/12] fix symfony 3 and render form_stylesheet only child.vars.pickerOptions --- Form/Type/SCDatetimeType.php | 15 +++++++-------- Resources/config/datetime.xml | 2 +- Resources/views/Form/stylesheet_layout.html.twig | 4 +++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Form/Type/SCDatetimeType.php b/Form/Type/SCDatetimeType.php index eba454d..f50de8c 100644 --- a/Form/Type/SCDatetimeType.php +++ b/Form/Type/SCDatetimeType.php @@ -16,7 +16,6 @@ use Symfony\Component\Form\FormView; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolver; -use Symfony\Component\Form\Extension\Core\Type\DateTimeType; /** * SCDatetimeType @@ -70,8 +69,8 @@ public function buildView(FormView $view, FormInterface $form, array $options) if(!isset($pickerOptions['format'])) $pickerOptions['format'] = 'mm/dd/yyyy HH:ii'; - if (isset($pickerOptions['formatter']) && $pickerOptions['formatter'] == 'php'){ - $pickerOptions['format'] = DatetimeType::convertIntlFormaterToMalot( $pickerOptions['format'] ); + if ($pickerOptions['formatter'] == 'php'){ + $pickerOptions['format'] = SCDatetimeType::convertIntlFormaterToMalot( $pickerOptions['format'] ); } $view->vars = array_replace($view->vars, array( @@ -92,17 +91,17 @@ public function configureOptions(OptionsResolver $resolver) 'format' => function (Options $options, $value) use ($configs) { $pickerOptions = array_merge($configs, $options['pickerOptions']); - if (isset($pickerOptions['formatter']) && $pickerOptions['formatter'] == 'php'){ + if ($pickerOptions['formatter'] == 'php'){ if (isset($pickerOptions['format'])){ return $pickerOptions['format']; } else { return 'mm/dd/yyyy HH:ii'; } - } elseif (isset($pickerOptions['formatter']) && $pickerOptions['formatter'] == 'js'){ + } elseif ($pickerOptions['formatter'] == 'js'){ if (isset($pickerOptions['format'])){ - return DatetimeType::convertMalotToIntlFormater( $pickerOptions['format'] ); + return SCDatetimeType::convertMalotToIntlFormater( $pickerOptions['format'] ); } else { - return DatetimeType::convertMalotToIntlFormater( 'mm/dd/yyyy HH:ii' ); + return SCDatetimeType::convertMalotToIntlFormater( 'mm/dd/yyyy HH:ii' ); } } }, @@ -160,7 +159,7 @@ public static function convertMalotToIntlFormater($formatter) */ public function getParent() { - return DateTimeType::class; + return \Symfony\Component\Form\Extension\Core\Type\DateTimeType::class; } public function getName() diff --git a/Resources/config/datetime.xml b/Resources/config/datetime.xml index ee5517d..9b2e7b8 100644 --- a/Resources/config/datetime.xml +++ b/Resources/config/datetime.xml @@ -10,7 +10,7 @@ - + %sc_datetimepicker.form.options% diff --git a/Resources/views/Form/stylesheet_layout.html.twig b/Resources/views/Form/stylesheet_layout.html.twig index 548cbbb..ca52a8f 100644 --- a/Resources/views/Form/stylesheet_layout.html.twig +++ b/Resources/views/Form/stylesheet_layout.html.twig @@ -1,7 +1,9 @@ {% block form_stylesheet %} {% spaceless %} {% for child in form %} - {{ form_stylesheet(child) }} + {% if child.vars.pickerOptions is defined %} + {{ form_stylesheet(child) }} + {% endif %} {% endfor %} {% endspaceless %} {% endblock form_stylesheet %} From 42ffbff6ca1a2bc8675298de4bcd2d3fa17630c3 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 27 Jun 2016 15:29:36 -0300 Subject: [PATCH 04/12] stephanecollot composer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1628acd..bb714ef 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "mwsimple/datetimepicker-bundle", + "name": "stephanecollot/datetimepicker-bundle", "version": "2.0.0", "description": "Symfony bundle for Bootstrap DateTime picker", "keywords": ["symfony", "bootstrap", "bundle", "picker", "datepicker", "timepicker"], From 8d5aa97bdfcc0550c54c2a7be86a36131c1e8716 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 27 Jun 2016 15:35:40 -0300 Subject: [PATCH 05/12] travis sf 2.8 --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2588c77..2bf45d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ language: php php: - - 5.3 - - 5.4 + - 5.5 env: - - SYMFONY_VERSION=v2.3.3 + - SYMFONY_VERSION=v2.8 - SYMFONY_VERSION=origin/master before_script: From fd956d292323acfef58a9138cbba0b1725dfba60 Mon Sep 17 00:00:00 2001 From: Gonzalo Alonso Date: Mon, 27 Jun 2016 19:53:36 -0300 Subject: [PATCH 06/12] use SCDatetimeType::class SCDatetimeType::class symfony 3 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 251770e..26d5b99 100644 --- a/README.md +++ b/README.md @@ -59,14 +59,16 @@ $ php app/console assets:install web/ ``` php add('createdAt', 'collot_datetime') + ->add('createdAt', SCDatetimeType::class) // full options - ->add('updatedAt', 'collot_datetime', array( 'pickerOptions' => + ->add('updatedAt', SCDatetimeType::class, array( 'pickerOptions' => array('format' => 'mm/dd/yyyy', 'weekStart' => 0, 'startDate' => date('m/d/Y'), //example From 8abb20e3fb63054193e82803c4873c49db00e26f Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 4 Jul 2016 08:13:45 -0300 Subject: [PATCH 07/12] Fix --- Form/Type/{SCDatetimeType.php => DatetimeType.php} | 12 ++++++------ Resources/config/datetime.xml | 2 +- composer.json | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) rename Form/Type/{SCDatetimeType.php => DatetimeType.php} (91%) diff --git a/Form/Type/SCDatetimeType.php b/Form/Type/DatetimeType.php similarity index 91% rename from Form/Type/SCDatetimeType.php rename to Form/Type/DatetimeType.php index f50de8c..5dc0ea4 100644 --- a/Form/Type/SCDatetimeType.php +++ b/Form/Type/DatetimeType.php @@ -1,7 +1,7 @@ vars = array_replace($view->vars, array( @@ -99,9 +99,9 @@ public function configureOptions(OptionsResolver $resolver) } } elseif ($pickerOptions['formatter'] == 'js'){ if (isset($pickerOptions['format'])){ - return SCDatetimeType::convertMalotToIntlFormater( $pickerOptions['format'] ); + return DatetimeType::convertMalotToIntlFormater( $pickerOptions['format'] ); } else { - return SCDatetimeType::convertMalotToIntlFormater( 'mm/dd/yyyy HH:ii' ); + return DatetimeType::convertMalotToIntlFormater( 'mm/dd/yyyy HH:ii' ); } } }, diff --git a/Resources/config/datetime.xml b/Resources/config/datetime.xml index 9b2e7b8..ee5517d 100644 --- a/Resources/config/datetime.xml +++ b/Resources/config/datetime.xml @@ -10,7 +10,7 @@ - + %sc_datetimepicker.form.options% diff --git a/composer.json b/composer.json index bb714ef..47848d6 100644 --- a/composer.json +++ b/composer.json @@ -11,9 +11,9 @@ } ], "require": { - "php": ">=5.5.9", + "php": ">=5.3.9", "symfony/framework-bundle": "~2.8 || ~3.0", - "symfony/symfony": "3.*" + "symfony/symfony": "~2.8 || ~3.0" }, "autoload": { "psr-0": { From e324861304d756f972412d77a9b9ef5262709aa9 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 4 Jul 2016 08:30:24 -0300 Subject: [PATCH 08/12] revert version to 1.0.1 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 47848d6..bee1939 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "stephanecollot/datetimepicker-bundle", - "version": "2.0.0", + "version": "1.0.1", "description": "Symfony bundle for Bootstrap DateTime picker", "keywords": ["symfony", "bootstrap", "bundle", "picker", "datepicker", "timepicker"], "type": "symfony-bundle", From b21b75e32a8d695def3252a61f951fefc64d4ce1 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 4 Jul 2016 08:32:00 -0300 Subject: [PATCH 09/12] travis revert --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2bf45d1..f780e09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: php php: + - 5.3 + - 5.4 - 5.5 env: From 41623d104ac8c4357d770c45b39230f88e1f0483 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 4 Jul 2016 08:33:47 -0300 Subject: [PATCH 10/12] doc --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 26d5b99..cb99418 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ public function registerBundles() { $bundles = array( // ... - new SC\DatetimepickerBundle\SCDatetimepickerBundle(), + new SC\DatetimepickerBundle\DatetimepickerBundle(), ); } ``` @@ -59,16 +59,16 @@ $ php app/console assets:install web/ ``` php add('createdAt', SCDatetimeType::class) + ->add('createdAt', DatetimeType::class) // full options - ->add('updatedAt', SCDatetimeType::class, array( 'pickerOptions' => + ->add('updatedAt', DatetimeType::class, array( 'pickerOptions' => array('format' => 'mm/dd/yyyy', 'weekStart' => 0, 'startDate' => date('m/d/Y'), //example From c3ec313ab4ac04ef4372dfe9317c19bcff8d10c1 Mon Sep 17 00:00:00 2001 From: Gonzalo Date: Mon, 4 Jul 2016 08:45:47 -0300 Subject: [PATCH 11/12] fix SCDatetimepickerBundle --- Form/Type/DatetimeType.php | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Form/Type/DatetimeType.php b/Form/Type/DatetimeType.php index 5dc0ea4..bf4bdd9 100644 --- a/Form/Type/DatetimeType.php +++ b/Form/Type/DatetimeType.php @@ -1,7 +1,7 @@ Date: Mon, 4 Jul 2016 08:54:34 -0300 Subject: [PATCH 12/12] style revert --- Resources/views/Form/stylesheet_layout.html.twig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Resources/views/Form/stylesheet_layout.html.twig b/Resources/views/Form/stylesheet_layout.html.twig index ca52a8f..548cbbb 100644 --- a/Resources/views/Form/stylesheet_layout.html.twig +++ b/Resources/views/Form/stylesheet_layout.html.twig @@ -1,9 +1,7 @@ {% block form_stylesheet %} {% spaceless %} {% for child in form %} - {% if child.vars.pickerOptions is defined %} - {{ form_stylesheet(child) }} - {% endif %} + {{ form_stylesheet(child) }} {% endfor %} {% endspaceless %} {% endblock form_stylesheet %}