From dacd9cdcd4454b43f561e17000affcdfbca7c6f4 Mon Sep 17 00:00:00 2001 From: Vit S Date: Fri, 24 Jul 2015 22:57:54 +0400 Subject: [PATCH 1/5] add buttonsVisible suggestion (issue #9198) --- framework/grid/ActionColumn.php | 34 +++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/framework/grid/ActionColumn.php b/framework/grid/ActionColumn.php index e4265cab06..d6d20e05b2 100644 --- a/framework/grid/ActionColumn.php +++ b/framework/grid/ActionColumn.php @@ -81,6 +81,28 @@ class ActionColumn extends Column * ``` */ public $buttons = []; + /** @var array visibility conditions for each button. The array keys are the button names (without curly brackets), + * and the values are the conditions whether this button is visible.Can be boolean value or callback. Defaults to true. + * The callbacks should use the following signature: + * + * ```php + * [ + * 'update' => function ($model) { + * return $model->status === 'editable'; + * }, + * ], + * ``` + * + * Or you can pass a boolean expression: + * + * ```php + * [ + * 'update' => \Yii::$app->user->can('update'), + * ], + * ``` + */ + public $buttonsVisible = []; + /** * @var callable a callback that creates a button URL using the specified model information. * The signature of the callback should be the same as that of [[createUrl()]]. @@ -170,9 +192,17 @@ class ActionColumn extends Column { return preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($model, $key, $index) { $name = $matches[1]; - if (isset($this->buttons[$name])) { - $url = $this->createUrl($name, $model, $key, $index); + if (isset($this->buttonsVisible[$name])) { + $visible = is_callable($this->buttonsVisible[$name]) + ? call_user_func($this->buttonsVisible[$name], $model) + : $this->buttonsVisible[$name]; + } else { + $visible = true; + } + + if ($visible && isset($this->buttons[$name])) { + $url = $this->createUrl($name, $model, $key, $index); return call_user_func($this->buttons[$name], $url, $model, $key); } else { return ''; From 6698b8154b2f780af4a74ceff8552795a124244b Mon Sep 17 00:00:00 2001 From: Vit S Date: Fri, 24 Jul 2015 23:19:11 +0400 Subject: [PATCH 2/5] add tests for buttonsVisible suggestion (issue #9198) --- tests/framework/grid/ActionColumnTest.php | 63 +++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tests/framework/grid/ActionColumnTest.php diff --git a/tests/framework/grid/ActionColumnTest.php b/tests/framework/grid/ActionColumnTest.php new file mode 100644 index 0000000000..a5f4cf860d --- /dev/null +++ b/tests/framework/grid/ActionColumnTest.php @@ -0,0 +1,63 @@ + + * + * @group grid + */ +class ActionColumnTest extends \yiiunit\TestCase +{ + public function testRenderDataCell() + { + $column = new ActionColumn(); + $column->urlCreator = function($model, $key, $index) { + return 'http://test.com'; + }; + $column->template = '{update}'; + $column->buttons = [ + 'update' => function($url, $model, $key) { + return 'update_button'; + } + ]; + + //test default visible button + $columnContents = $column->renderDataCell(['id' => 1], 1, 0); + $this->assertContains('update_button', $columnContents); + + //test visible button + $column->buttonsVisible = [ + 'update' => true + ]; + $columnContents = $column->renderDataCell(['id' => 1], 1, 0); + $this->assertContains('update_button', $columnContents); + + //test visible button (condition is callback) + $column->buttonsVisible = [ + 'update' => function($model){return $model['id'] == 1;} + ]; + $columnContents = $column->renderDataCell(['id' => 1], 1, 0); + $this->assertContains('update_button', $columnContents); + + //test invisible button + $column->buttonsVisible = [ + 'update' => false + ]; + $columnContents = $column->renderDataCell(['id' => 1], 1, 0); + $this->assertNotContains('update_button', $columnContents); + + //test invisible button (condition is callback) + $column->buttonsVisible = [ + 'update' => function($model){return $model['id'] != 1;} + ]; + $columnContents = $column->renderDataCell(['id' => 1], 1, 0); + $this->assertNotContains('update_button', $columnContents); + + } +} \ No newline at end of file From 9b978ec78786704f3b5aa2cfc554e896903b4d58 Mon Sep 17 00:00:00 2001 From: Vit S Date: Fri, 24 Jul 2015 23:23:20 +0400 Subject: [PATCH 3/5] update changelog (issue #9198) --- composer.lock | 204 ++++++++++++++++++++--------------------- framework/CHANGELOG.md | 1 + 2 files changed, 100 insertions(+), 105 deletions(-) diff --git a/composer.lock b/composer.lock index a650fe1b81..de4bbcb4fa 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "67a0cfdccceaeeae75cab6c8d62f6983", + "hash": "9bd4bd09a19cefdbb5a55d91cf65c583", "packages": [ { "name": "bower-asset/jquery", @@ -164,8 +164,7 @@ }, "license": [ "MIT" - ], - "time": "2015-03-08 21:03:11" + ] }, { "name": "cebe/markdown", @@ -277,16 +276,16 @@ "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-composer.git", - "reference": "c7f59a6db76ae12aef4ddd244b0d02ab76b8a0b8" + "reference": "6b2a2b3bb83d4b3dd791f76e64c48973ce01bac6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/c7f59a6db76ae12aef4ddd244b0d02ab76b8a0b8", - "reference": "c7f59a6db76ae12aef4ddd244b0d02ab76b8a0b8", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/6b2a2b3bb83d4b3dd791f76e64c48973ce01bac6", + "reference": "6b2a2b3bb83d4b3dd791f76e64c48973ce01bac6", "shasum": "" }, "require": { - "composer-plugin-api": "1.0.0" + "composer-plugin-api": "^1.0" }, "type": "composer-plugin", "extra": { @@ -316,7 +315,7 @@ "extension installer", "yii2" ], - "time": "2015-04-29 09:00:02" + "time": "2015-06-11 19:55:58" } ], "packages-dev": [ @@ -359,12 +358,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "b70d22758c0813ea5fef9c22480caadd3a2b6a56" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/b70d22758c0813ea5fef9c22480caadd3a2b6a56", - "reference": "b70d22758c0813ea5fef9c22480caadd3a2b6a56", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -405,20 +404,20 @@ "constructor", "instantiate" ], - "time": "2015-05-13 13:33:36" + "time": "2015-06-14 21:17:01" }, { "name": "phpdocumentor/reflection-docblock", - "version": "dev-master", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "ae15da2ce234d3ffe5d7fafcdad19c7f1acf3568" + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ae15da2ce234d3ffe5d7fafcdad19c7f1acf3568", - "reference": "ae15da2ce234d3ffe5d7fafcdad19c7f1acf3568", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", + "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", "shasum": "" }, "require": { @@ -428,8 +427,8 @@ "phpunit/phpunit": "~4.0" }, "suggest": { - "erusev/parsedown": "~1.0", - "league/commonmark": "*" + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" }, "type": "library", "extra": { @@ -454,7 +453,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-05-12 07:21:12" + "time": "2015-02-03 12:10:50" }, { "name": "phpspec/prophecy", @@ -462,12 +461,12 @@ "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "5a355f91730c845301a9e28f91c8a5053353c496" + "reference": "5700f75b23b0dd3495c0f495fe33a5e6717ee160" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/5a355f91730c845301a9e28f91c8a5053353c496", - "reference": "5a355f91730c845301a9e28f91c8a5053353c496", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/5700f75b23b0dd3495c0f495fe33a5e6717ee160", + "reference": "5700f75b23b0dd3495c0f495fe33a5e6717ee160", "shasum": "" }, "require": { @@ -514,20 +513,20 @@ "spy", "stub" ], - "time": "2015-05-20 16:00:43" + "time": "2015-06-30 10:26:46" }, { "name": "phpunit/php-code-coverage", - "version": "2.1.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c" + "reference": "1ba1290e47c3275be779967de1516e2989b6e130" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/28a6b34e91d789b2608072ab3c82eaae7cdb973c", - "reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1ba1290e47c3275be779967de1516e2989b6e130", + "reference": "1ba1290e47c3275be779967de1516e2989b6e130", "shasum": "" }, "require": { @@ -550,7 +549,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1.x-dev" + "dev-master": "2.2.x-dev" } }, "autoload": { @@ -576,7 +575,7 @@ "testing", "xunit" ], - "time": "2015-06-03 07:01:01" + "time": "2015-07-13 11:25:16" }, { "name": "phpunit/php-file-iterator", @@ -584,12 +583,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", - "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", "shasum": "" }, "require": { @@ -623,20 +622,20 @@ "filesystem", "iterator" ], - "time": "2015-04-02 05:19:05" + "time": "2015-06-21 13:08:43" }, { "name": "phpunit/php-text-template", - "version": "1.2.0", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", "shasum": "" }, "require": { @@ -645,20 +644,17 @@ "type": "library", "autoload": { "classmap": [ - "Text/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -667,20 +663,20 @@ "keywords": [ "template" ], - "time": "2014-01-30 17:20:04" + "time": "2015-06-21 13:50:34" }, { "name": "phpunit/php-timer", - "version": "1.0.5", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", "shasum": "" }, "require": { @@ -689,13 +685,10 @@ "type": "library", "autoload": { "classmap": [ - "PHP/" + "src/" ] }, "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], "license": [ "BSD-3-Clause" ], @@ -711,7 +704,7 @@ "keywords": [ "timer" ], - "time": "2013-08-02 07:42:54" + "time": "2015-06-21 08:01:12" }, { "name": "phpunit/php-token-stream", @@ -719,12 +712,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "eab81d02569310739373308137284e0158424330" + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330", - "reference": "eab81d02569310739373308137284e0158424330", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", "shasum": "" }, "require": { @@ -760,20 +753,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-04-08 04:46:07" + "time": "2015-06-19 03:43:16" }, { "name": "phpunit/phpunit", - "version": "dev-master", + "version": "4.8.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f796a70200be4db1cec9fddf8129a971345c0e46" + "reference": "e1cc5855b0dde3d6efa2df0350c72b84aa84771d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f796a70200be4db1cec9fddf8129a971345c0e46", - "reference": "f796a70200be4db1cec9fddf8129a971345c0e46", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e1cc5855b0dde3d6efa2df0350c72b84aa84771d", + "reference": "e1cc5855b0dde3d6efa2df0350c72b84aa84771d", "shasum": "" }, "require": { @@ -787,7 +780,7 @@ "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0", + "phpunit/php-timer": ">=1.0.6", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", @@ -832,26 +825,27 @@ "testing", "xunit" ], - "time": "2015-06-03 08:18:54" + "time": "2015-07-13 11:33:07" }, { "name": "phpunit/phpunit-mock-objects", - "version": "dev-master", + "version": "2.3.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7" + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/253c005852591fd547fc18cd5b7b43a1ec82d8f7", - "reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", "shasum": "" }, "require": { "doctrine/instantiator": "~1.0,>=1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -887,7 +881,7 @@ "mock", "xunit" ], - "time": "2015-05-29 05:19:18" + "time": "2015-07-10 06:54:24" }, { "name": "sebastian/comparator", @@ -895,12 +889,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" + "reference": "dee3fd1828677b2182c076ad2caecbb5c7bdbf1c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", - "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dee3fd1828677b2182c076ad2caecbb5c7bdbf1c", + "reference": "dee3fd1828677b2182c076ad2caecbb5c7bdbf1c", "shasum": "" }, "require": { @@ -951,7 +945,7 @@ "compare", "equality" ], - "time": "2015-01-29 16:28:08" + "time": "2015-07-19 12:54:49" }, { "name": "sebastian/diff", @@ -959,12 +953,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6899b3e33bfbd386d88b5eea5f65f563e8793051", + "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051", "shasum": "" }, "require": { @@ -1003,7 +997,7 @@ "keywords": [ "diff" ], - "time": "2015-02-22 15:13:53" + "time": "2015-06-22 14:15:55" }, { "name": "sebastian/environment", @@ -1011,12 +1005,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" + "reference": "bc66c3bbe6e5822c34395049e110566491cafa3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", - "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/bc66c3bbe6e5822c34395049e110566491cafa3b", + "reference": "bc66c3bbe6e5822c34395049e110566491cafa3b", "shasum": "" }, "require": { @@ -1053,7 +1047,7 @@ "environment", "hhvm" ], - "time": "2015-01-01 10:01:08" + "time": "2015-06-21 13:07:52" }, { "name": "sebastian/exporter", @@ -1061,12 +1055,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "84839970d05254c73cde183a721c7af13aede943" + "reference": "7ae5513327cb536431847bcc0c10edba2701064e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", - "reference": "84839970d05254c73cde183a721c7af13aede943", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", + "reference": "7ae5513327cb536431847bcc0c10edba2701064e", "shasum": "" }, "require": { @@ -1119,7 +1113,7 @@ "export", "exporter" ], - "time": "2015-01-27 07:23:06" + "time": "2015-06-21 07:55:53" }, { "name": "sebastian/global-state", @@ -1127,12 +1121,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "007c441df427cf0e175372fcbb9d196bce7eb743" + "reference": "23af31f402993cfd94e99cbc4b782e9a78eb0e97" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/007c441df427cf0e175372fcbb9d196bce7eb743", - "reference": "007c441df427cf0e175372fcbb9d196bce7eb743", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23af31f402993cfd94e99cbc4b782e9a78eb0e97", + "reference": "23af31f402993cfd94e99cbc4b782e9a78eb0e97", "shasum": "" }, "require": { @@ -1170,7 +1164,7 @@ "keywords": [ "global state" ], - "time": "2015-01-20 04:09:31" + "time": "2015-06-21 15:11:22" }, { "name": "sebastian/recursion-context", @@ -1178,12 +1172,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252" + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", - "reference": "3989662bbb30a29d20d9faa04a846af79b276252", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", + "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", "shasum": "" }, "require": { @@ -1223,20 +1217,20 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-01-24 09:48:32" + "time": "2015-06-21 08:04:50" }, { "name": "sebastian/version", - "version": "1.0.5", + "version": "1.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", - "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", "shasum": "" }, "type": "library", @@ -1258,32 +1252,32 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-02-24 06:35:25" + "time": "2015-06-21 13:59:46" }, { "name": "symfony/yaml", - "version": "2.8.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "2396832f6f9ab2b8f62f00b5d3f2e722fc773d65" + "reference": "6a39d07f534ad980872a864d339ff979173467cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/2396832f6f9ab2b8f62f00b5d3f2e722fc773d65", - "reference": "2396832f6f9ab2b8f62f00b5d3f2e722fc773d65", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/6a39d07f534ad980872a864d339ff979173467cf", + "reference": "6a39d07f534ad980872a864d339ff979173467cf", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.5.9" }, "require-dev": { - "symfony/phpunit-bridge": "~2.7|~3.0.0" + "symfony/phpunit-bridge": "~2.8|~3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1307,7 +1301,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-05-12 15:16:46" + "time": "2015-07-01 20:40:29" } ], "aliases": [], diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index aa009de596..f21e79d775 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -50,6 +50,7 @@ Yii Framework 2 Change Log - Enh #9072: `yii\web\ErrorAction` displays 404 error instead of blank page on direct access (klimov-paul) - Enh #9149: Print directory migrationPath in a `yii migrate` command error. (RusAlex) - Enh #9177: Added password hash cost setting to Security component (freezy-sk) +- Enh #9198: Added parameter buttonsVisible for `yii\grid\ActionColimn` (fornit1917) - Chg #6354: `ErrorHandler::logException()` will now log the whole exception object instead of only its string representation (cebe) - Chg #8556: Extracted `yii\web\User::getAuthManager()` method (samdark) - Chg #9181: `yii\helpers\BaseStringHelper::truncateHtml()` is now using `runtime` directory for `HTMLPurifier` cache (webdevsega) From 6710c8cbd3ba550f7df725c63117b7a80a8c70eb Mon Sep 17 00:00:00 2001 From: Vit S Date: Fri, 24 Jul 2015 23:36:33 +0400 Subject: [PATCH 4/5] revert composer.lock --- composer.lock | 204 ++++++++++++++++++++++++++------------------------ 1 file changed, 105 insertions(+), 99 deletions(-) diff --git a/composer.lock b/composer.lock index de4bbcb4fa..a650fe1b81 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "9bd4bd09a19cefdbb5a55d91cf65c583", + "hash": "67a0cfdccceaeeae75cab6c8d62f6983", "packages": [ { "name": "bower-asset/jquery", @@ -164,7 +164,8 @@ }, "license": [ "MIT" - ] + ], + "time": "2015-03-08 21:03:11" }, { "name": "cebe/markdown", @@ -276,16 +277,16 @@ "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-composer.git", - "reference": "6b2a2b3bb83d4b3dd791f76e64c48973ce01bac6" + "reference": "c7f59a6db76ae12aef4ddd244b0d02ab76b8a0b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/6b2a2b3bb83d4b3dd791f76e64c48973ce01bac6", - "reference": "6b2a2b3bb83d4b3dd791f76e64c48973ce01bac6", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/c7f59a6db76ae12aef4ddd244b0d02ab76b8a0b8", + "reference": "c7f59a6db76ae12aef4ddd244b0d02ab76b8a0b8", "shasum": "" }, "require": { - "composer-plugin-api": "^1.0" + "composer-plugin-api": "1.0.0" }, "type": "composer-plugin", "extra": { @@ -315,7 +316,7 @@ "extension installer", "yii2" ], - "time": "2015-06-11 19:55:58" + "time": "2015-04-29 09:00:02" } ], "packages-dev": [ @@ -358,12 +359,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "b70d22758c0813ea5fef9c22480caadd3a2b6a56" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/b70d22758c0813ea5fef9c22480caadd3a2b6a56", + "reference": "b70d22758c0813ea5fef9c22480caadd3a2b6a56", "shasum": "" }, "require": { @@ -404,20 +405,20 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-05-13 13:33:36" }, { "name": "phpdocumentor/reflection-docblock", - "version": "2.0.4", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8" + "reference": "ae15da2ce234d3ffe5d7fafcdad19c7f1acf3568" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/d68dbdc53dc358a816f00b300704702b2eaff7b8", - "reference": "d68dbdc53dc358a816f00b300704702b2eaff7b8", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/ae15da2ce234d3ffe5d7fafcdad19c7f1acf3568", + "reference": "ae15da2ce234d3ffe5d7fafcdad19c7f1acf3568", "shasum": "" }, "require": { @@ -427,8 +428,8 @@ "phpunit/phpunit": "~4.0" }, "suggest": { - "dflydev/markdown": "~1.0", - "erusev/parsedown": "~1.0" + "erusev/parsedown": "~1.0", + "league/commonmark": "*" }, "type": "library", "extra": { @@ -453,7 +454,7 @@ "email": "mike.vanriel@naenius.com" } ], - "time": "2015-02-03 12:10:50" + "time": "2015-05-12 07:21:12" }, { "name": "phpspec/prophecy", @@ -461,12 +462,12 @@ "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "5700f75b23b0dd3495c0f495fe33a5e6717ee160" + "reference": "5a355f91730c845301a9e28f91c8a5053353c496" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/5700f75b23b0dd3495c0f495fe33a5e6717ee160", - "reference": "5700f75b23b0dd3495c0f495fe33a5e6717ee160", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/5a355f91730c845301a9e28f91c8a5053353c496", + "reference": "5a355f91730c845301a9e28f91c8a5053353c496", "shasum": "" }, "require": { @@ -513,20 +514,20 @@ "spy", "stub" ], - "time": "2015-06-30 10:26:46" + "time": "2015-05-20 16:00:43" }, { "name": "phpunit/php-code-coverage", - "version": "dev-master", + "version": "2.1.x-dev", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "1ba1290e47c3275be779967de1516e2989b6e130" + "reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1ba1290e47c3275be779967de1516e2989b6e130", - "reference": "1ba1290e47c3275be779967de1516e2989b6e130", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/28a6b34e91d789b2608072ab3c82eaae7cdb973c", + "reference": "28a6b34e91d789b2608072ab3c82eaae7cdb973c", "shasum": "" }, "require": { @@ -549,7 +550,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "2.1.x-dev" } }, "autoload": { @@ -575,7 +576,7 @@ "testing", "xunit" ], - "time": "2015-07-13 11:25:16" + "time": "2015-06-03 07:01:01" }, { "name": "phpunit/php-file-iterator", @@ -583,12 +584,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0" + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6150bf2c35d3fc379e50c7602b75caceaa39dbf0", - "reference": "6150bf2c35d3fc379e50c7602b75caceaa39dbf0", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a923bb15680d0089e2316f7a4af8f437046e96bb", + "reference": "a923bb15680d0089e2316f7a4af8f437046e96bb", "shasum": "" }, "require": { @@ -622,20 +623,20 @@ "filesystem", "iterator" ], - "time": "2015-06-21 13:08:43" + "time": "2015-04-02 05:19:05" }, { "name": "phpunit/php-text-template", - "version": "1.2.1", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", + "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", "shasum": "" }, "require": { @@ -644,17 +645,20 @@ "type": "library", "autoload": { "classmap": [ - "src/" + "Text/" ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], "license": [ "BSD-3-Clause" ], "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", + "email": "sb@sebastian-bergmann.de", "role": "lead" } ], @@ -663,20 +667,20 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2014-01-30 17:20:04" }, { "name": "phpunit/php-timer", - "version": "dev-master", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b" + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b", - "reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", "shasum": "" }, "require": { @@ -685,10 +689,13 @@ "type": "library", "autoload": { "classmap": [ - "src/" + "PHP/" ] }, "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], "license": [ "BSD-3-Clause" ], @@ -704,7 +711,7 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2013-08-02 07:42:54" }, { "name": "phpunit/php-token-stream", @@ -712,12 +719,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9" + "reference": "eab81d02569310739373308137284e0158424330" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/7a9b0969488c3c54fd62b4d504b3ec758fd005d9", - "reference": "7a9b0969488c3c54fd62b4d504b3ec758fd005d9", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/eab81d02569310739373308137284e0158424330", + "reference": "eab81d02569310739373308137284e0158424330", "shasum": "" }, "require": { @@ -753,20 +760,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-06-19 03:43:16" + "time": "2015-04-08 04:46:07" }, { "name": "phpunit/phpunit", - "version": "4.8.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "e1cc5855b0dde3d6efa2df0350c72b84aa84771d" + "reference": "f796a70200be4db1cec9fddf8129a971345c0e46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/e1cc5855b0dde3d6efa2df0350c72b84aa84771d", - "reference": "e1cc5855b0dde3d6efa2df0350c72b84aa84771d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f796a70200be4db1cec9fddf8129a971345c0e46", + "reference": "f796a70200be4db1cec9fddf8129a971345c0e46", "shasum": "" }, "require": { @@ -780,7 +787,7 @@ "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", + "phpunit/php-timer": "~1.0", "phpunit/phpunit-mock-objects": "~2.3", "sebastian/comparator": "~1.1", "sebastian/diff": "~1.2", @@ -825,27 +832,26 @@ "testing", "xunit" ], - "time": "2015-07-13 11:33:07" + "time": "2015-06-03 08:18:54" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42" + "reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/18dfbcb81d05e2296c0bcddd4db96cade75e6f42", - "reference": "18dfbcb81d05e2296c0bcddd4db96cade75e6f42", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/253c005852591fd547fc18cd5b7b43a1ec82d8f7", + "reference": "253c005852591fd547fc18cd5b7b43a1ec82d8f7", "shasum": "" }, "require": { "doctrine/instantiator": "~1.0,>=1.0.2", "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" + "phpunit/php-text-template": "~1.2" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -881,7 +887,7 @@ "mock", "xunit" ], - "time": "2015-07-10 06:54:24" + "time": "2015-05-29 05:19:18" }, { "name": "sebastian/comparator", @@ -889,12 +895,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "dee3fd1828677b2182c076ad2caecbb5c7bdbf1c" + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/dee3fd1828677b2182c076ad2caecbb5c7bdbf1c", - "reference": "dee3fd1828677b2182c076ad2caecbb5c7bdbf1c", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1dd8869519a225f7f2b9eb663e225298fade819e", + "reference": "1dd8869519a225f7f2b9eb663e225298fade819e", "shasum": "" }, "require": { @@ -945,7 +951,7 @@ "compare", "equality" ], - "time": "2015-07-19 12:54:49" + "time": "2015-01-29 16:28:08" }, { "name": "sebastian/diff", @@ -953,12 +959,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051" + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6899b3e33bfbd386d88b5eea5f65f563e8793051", - "reference": "6899b3e33bfbd386d88b5eea5f65f563e8793051", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", + "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", "shasum": "" }, "require": { @@ -997,7 +1003,7 @@ "keywords": [ "diff" ], - "time": "2015-06-22 14:15:55" + "time": "2015-02-22 15:13:53" }, { "name": "sebastian/environment", @@ -1005,12 +1011,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "bc66c3bbe6e5822c34395049e110566491cafa3b" + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/bc66c3bbe6e5822c34395049e110566491cafa3b", - "reference": "bc66c3bbe6e5822c34395049e110566491cafa3b", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e", + "reference": "5a8c7d31914337b69923db26c4221b81ff5a196e", "shasum": "" }, "require": { @@ -1047,7 +1053,7 @@ "environment", "hhvm" ], - "time": "2015-06-21 13:07:52" + "time": "2015-01-01 10:01:08" }, { "name": "sebastian/exporter", @@ -1055,12 +1061,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "84839970d05254c73cde183a721c7af13aede943" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/84839970d05254c73cde183a721c7af13aede943", + "reference": "84839970d05254c73cde183a721c7af13aede943", "shasum": "" }, "require": { @@ -1113,7 +1119,7 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2015-01-27 07:23:06" }, { "name": "sebastian/global-state", @@ -1121,12 +1127,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "23af31f402993cfd94e99cbc4b782e9a78eb0e97" + "reference": "007c441df427cf0e175372fcbb9d196bce7eb743" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/23af31f402993cfd94e99cbc4b782e9a78eb0e97", - "reference": "23af31f402993cfd94e99cbc4b782e9a78eb0e97", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/007c441df427cf0e175372fcbb9d196bce7eb743", + "reference": "007c441df427cf0e175372fcbb9d196bce7eb743", "shasum": "" }, "require": { @@ -1164,7 +1170,7 @@ "keywords": [ "global state" ], - "time": "2015-06-21 15:11:22" + "time": "2015-01-20 04:09:31" }, { "name": "sebastian/recursion-context", @@ -1172,12 +1178,12 @@ "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + "reference": "3989662bbb30a29d20d9faa04a846af79b276252" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/3989662bbb30a29d20d9faa04a846af79b276252", + "reference": "3989662bbb30a29d20d9faa04a846af79b276252", "shasum": "" }, "require": { @@ -1217,20 +1223,20 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21 08:04:50" + "time": "2015-01-24 09:48:32" }, { "name": "sebastian/version", - "version": "1.0.6", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", + "reference": "ab931d46cd0d3204a91e1b9a40c4bc13032b58e4", "shasum": "" }, "type": "library", @@ -1252,32 +1258,32 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-02-24 06:35:25" }, { "name": "symfony/yaml", - "version": "dev-master", + "version": "2.8.x-dev", "source": { "type": "git", "url": "https://github.com/symfony/Yaml.git", - "reference": "6a39d07f534ad980872a864d339ff979173467cf" + "reference": "2396832f6f9ab2b8f62f00b5d3f2e722fc773d65" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/6a39d07f534ad980872a864d339ff979173467cf", - "reference": "6a39d07f534ad980872a864d339ff979173467cf", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/2396832f6f9ab2b8f62f00b5d3f2e722fc773d65", + "reference": "2396832f6f9ab2b8f62f00b5d3f2e722fc773d65", "shasum": "" }, "require": { - "php": ">=5.5.9" + "php": ">=5.3.9" }, "require-dev": { - "symfony/phpunit-bridge": "~2.8|~3.0" + "symfony/phpunit-bridge": "~2.7|~3.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-master": "2.8-dev" } }, "autoload": { @@ -1301,7 +1307,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-07-01 20:40:29" + "time": "2015-05-12 15:16:46" } ], "aliases": [], From bdddcc54adc67e8e52c50047ee14bc2a92151480 Mon Sep 17 00:00:00 2001 From: Vit S Date: Mon, 25 Jan 2016 22:56:44 +0300 Subject: [PATCH 5/5] code review fixes --- framework/CHANGELOG.md | 2 +- framework/grid/ActionColumn.php | 22 +++++++++++----------- tests/framework/grid/ActionColumnTest.php | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/framework/CHANGELOG.md b/framework/CHANGELOG.md index 090092e92b..8cca25b02d 100644 --- a/framework/CHANGELOG.md +++ b/framework/CHANGELOG.md @@ -180,7 +180,7 @@ Yii Framework 2 Change Log - Enh #9072: `yii\web\ErrorAction` displays 404 error instead of blank page on direct access (klimov-paul) - Enh #9149: Print directory migrationPath in a `yii migrate` command error. (RusAlex) - Enh #9177: Added password hash cost setting to Security component (freezy-sk) -- Enh #9198: Added parameter buttonsVisible for `yii\grid\ActionColimn` (fornit1917) +- Enh #9198: Added parameter visibleButtons for `yii\grid\ActionColimn` (fornit1917) - Enh #9239: Better handling of `Json` errors (grzegorzkurtyka, samdark) - Enh #9246: Added `yii\web\UrlRule::getParamRules()` (df2) - Enh #9249: Added `hashCallback` in `yii\web\AssetManager` to allow custom hash generation for asset directory (petrabarus) diff --git a/framework/grid/ActionColumn.php b/framework/grid/ActionColumn.php index dd41d7dd3e..3c2119e60e 100644 --- a/framework/grid/ActionColumn.php +++ b/framework/grid/ActionColumn.php @@ -86,12 +86,13 @@ class ActionColumn extends Column */ public $buttons = []; /** @var array visibility conditions for each button. The array keys are the button names (without curly brackets), - * and the values are the conditions whether this button is visible.Can be boolean value or callback. Defaults to true. - * The callbacks should use the following signature: + * and the values are are the boolean true/false or the anonymous function. The button will be shown, + * when its name is not specified in this array. + * The callbacks must use the following signature: * * ```php * [ - * 'update' => function ($model) { + * 'update' => function ($model, $key, $index) { * return $model->status === 'editable'; * }, * ], @@ -105,8 +106,7 @@ class ActionColumn extends Column * ], * ``` */ - public $buttonsVisible = []; - + public $visibleButtons = []; /** * @var callable a callback that creates a button URL using the specified model information. * The signature of the callback should be the same as that of [[createUrl()]]. @@ -197,15 +197,15 @@ class ActionColumn extends Column return preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) use ($model, $key, $index) { $name = $matches[1]; - if (isset($this->buttonsVisible[$name])) { - $visible = is_callable($this->buttonsVisible[$name]) - ? call_user_func($this->buttonsVisible[$name], $model) - : $this->buttonsVisible[$name]; + if (isset($this->visibleButtons[$name])) { + $isVisible = $this->visibleButtons[$name] instanceof \Closure + ? call_user_func($this->visibleButtons[$name], $model, $key, $index) + : $this->visibleButtons[$name]; } else { - $visible = true; + $isVisible = true; } - if ($visible && isset($this->buttons[$name])) { + if ($isVisible && isset($this->buttons[$name])) { $url = $this->createUrl($name, $model, $key, $index); return call_user_func($this->buttons[$name], $url, $model, $key); } else { diff --git a/tests/framework/grid/ActionColumnTest.php b/tests/framework/grid/ActionColumnTest.php index a5f4cf860d..a4243062a6 100644 --- a/tests/framework/grid/ActionColumnTest.php +++ b/tests/framework/grid/ActionColumnTest.php @@ -32,29 +32,29 @@ class ActionColumnTest extends \yiiunit\TestCase $this->assertContains('update_button', $columnContents); //test visible button - $column->buttonsVisible = [ + $column->visibleButtons = [ 'update' => true ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); $this->assertContains('update_button', $columnContents); //test visible button (condition is callback) - $column->buttonsVisible = [ - 'update' => function($model){return $model['id'] == 1;} + $column->visibleButtons = [ + 'update' => function($model, $key, $index){return $model['id'] == 1;} ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); $this->assertContains('update_button', $columnContents); //test invisible button - $column->buttonsVisible = [ + $column->visibleButtons = [ 'update' => false ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); $this->assertNotContains('update_button', $columnContents); //test invisible button (condition is callback) - $column->buttonsVisible = [ - 'update' => function($model){return $model['id'] != 1;} + $column->visibleButtons = [ + 'update' => function($model, $key, $index){return $model['id'] != 1;} ]; $columnContents = $column->renderDataCell(['id' => 1], 1, 0); $this->assertNotContains('update_button', $columnContents);