Commit 3d6109d1 by Nobuo Kihara

Merge branch 'master' into docs-guide-ja-structure-views-rev

parents 259eb1ae 1961957f
......@@ -238,7 +238,7 @@ A view name is resolved into the corresponding view file path according to the f
* If the view is rendered with a [[yii\base\View::context|context]] and the context implements [[yii\base\ViewContextInterface]],
the view file path is formed by prefixing the [[yii\base\ViewContextInterface::getViewPath()|view path]] of the
context to the view name. This mainly applies to the views rendered within controllers and widgets. For example,
`site/about` will be resolved into `@app/views/site/about.php` if the context is the controller `SiteController`.
`about` will be resolved into `@app/views/site/about.php` if the context is the controller `SiteController`.
* If a view is rendered within another view, the directory containing the other view file will be prefixed to
the new view name to form the actual view file path. For example, `item` will be resolved into `@app/views/post/item.php`
if it is being rendered in the view `@app/views/post/index.php`.
......
......@@ -16,9 +16,11 @@ Yii Framework 2 Change Log
- Enh #6852: Added `yii\helpers\BaseHtmlPurifier::helpers()` in order to be able to configure `HtmlPurifier` helper globally via subclassing (Alex-Code)
- Enh #6882: Added `yii\web\ErrorHandler::getTypeUrl()` in order to allow providing custom types/classes/methods URLs for subclasses (brandonkelly)
- Enh #6896: Added `yii\log\FileTarget::$enableRotation` to allow disabling log rotation when external tools are configured for this (cebe)
- Enh #7008: Removed extra white space in GridView filter cell (uran1980)
- Enh #7051: Added support for preventing swapping values between different cookies (pavimus, qiangxue)
- Chg #5690: adjusted paths in message config generated by `yii message/config` to reflect directory structure better (mikehaertl, samdark)
- Chg #6661: Hyperlinks that are enclosed within an exist form will use the same form for submission if they specify both of the `href` and `data-method` attributes (qiangxue)
- Chg #7094: Console confirmation must be answered correctly. To return `true`: `y` or `yes`. To return `false`: `n` or `not`. Any other input the question will be asked again (thiagotalma)
2.0.2 January 11, 2015
----------------------
......
......@@ -159,15 +159,15 @@ class DataColumn extends Column
if ($this->filter !== false && $model instanceof Model && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
if ($model->hasErrors($this->attribute)) {
Html::addCssClass($this->filterOptions, 'has-error');
$error = Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
$error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
} else {
$error = '';
}
if (is_array($this->filter)) {
$options = array_merge(['prompt' => ''], $this->filterInputOptions);
return Html::activeDropDownList($model, $this->attribute, $this->filter, $options) . ' ' . $error;
return Html::activeDropDownList($model, $this->attribute, $this->filter, $options) . $error;
} else {
return Html::activeTextInput($model, $this->attribute, $this->filterInputOptions) . ' ' . $error;
return Html::activeTextInput($model, $this->attribute, $this->filterInputOptions) . $error;
}
} else {
return parent::renderFilterCellContent();
......
......@@ -769,10 +769,22 @@ class BaseConsole
*/
public static function confirm($message, $default = false)
{
while (true) {
static::stdout($message . ' (yes|no) [' . ($default ? 'yes' : 'no') . ']:');
$input = trim(static::stdin());
return empty($input) ? $default : !strncasecmp($input, 'y', 1);
if (empty($input)) {
return $default;
}
if (!strcasecmp ($input, 'y') || !strcasecmp ($input, 'yes') ) {
return true;
}
if (!strcasecmp ($input, 'n') || !strcasecmp ($input, 'no') ) {
return false;
}
}
}
/**
......
......@@ -26,9 +26,6 @@ namespace yii\helpers;
*
* For more details please refer to [HTMLPurifier documentation](http://htmlpurifier.org/).
*
* Note that you should add `ezyang/htmlpurifier` to your composer.json `require` section and run `composer install`
* before using it.
*
* @author Alexander Makarov <sam@rmcreative.ru>
* @since 2.0
*/
......
......@@ -4,4 +4,5 @@
*/
return [
'The dog runs fast.' => 'Собака бегает быстро.',
'There {n, plural, =0{no cats} =1{one cat} other{are # cats}} on lying on the sofa!' => 'На диване {n, plural, =0{нет кошек} =1{лежит одна кошка} one{лежит # кошка} few{лежит # кошки} many{лежит # кошек} other{лежит # кошки}}!',
];
<?php
namespace yiiunit\extensions\bootstrap;
use yii\bootstrap\Collapse;
class CollapseTest extends BootstrapTestCase
{
public function testRender()
{
Collapse::$counter = 0;
$output = Collapse::widget([
'items' => [
[
'label' => 'Collapsible Group Item #1',
'content' => 'test content1',
],
[
'label' => '<h1>Collapsible Group Item #2</h1>',
'content' => '<h2>test content2</h2>',
'contentOptions' => [
'class' => 'testContentOptions2'
],
'options' => [
'class' => 'testClass2',
'id' => 'testId2'
],
'encode' => true
],
[
'label' => '<h1>Collapsible Group Item #3</h1>',
'content' => '<h2>test content3</h2>',
'contentOptions' => [
'class' => 'testContentOptions3'
],
'options' => [
'class' => 'testClass3',
'id' => 'testId3'
],
'encode' => false
],
[
'label' => '<h1>Collapsible Group Item #4</h1>',
'content' => '<h1>test content4</h1>',
],
]
]);
$this->assertEquals(<<<HTML
<div id="w0" class="panel-group">
<div class="panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a class="collapse-toggle" href="#w0-collapse1" data-toggle="collapse" data-parent="#w0">Collapsible Group Item #1</a>
</h4></div>
<div id="w0-collapse1" class="panel-collapse collapse"><div class="panel-body">test content1</div>
</div></div>
<div id="testId2" class="testClass2 panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a class="collapse-toggle" href="#w0-collapse2" data-toggle="collapse" data-parent="#w0">&lt;h1&gt;Collapsible Group Item #2&lt;/h1&gt;</a>
</h4></div>
<div id="w0-collapse2" class="testContentOptions2 panel-collapse collapse"><div class="panel-body"><h2>test content2</h2></div>
</div></div>
<div id="testId3" class="testClass3 panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a class="collapse-toggle" href="#w0-collapse3" data-toggle="collapse" data-parent="#w0"><h1>Collapsible Group Item #3</h1></a>
</h4></div>
<div id="w0-collapse3" class="testContentOptions3 panel-collapse collapse"><div class="panel-body"><h2>test content3</h2></div>
</div></div>
<div class="panel panel-default"><div class="panel-heading"><h4 class="panel-title"><a class="collapse-toggle" href="#w0-collapse4" data-toggle="collapse" data-parent="#w0">&lt;h1&gt;Collapsible Group Item #4&lt;/h1&gt;</a>
</h4></div>
<div id="w0-collapse4" class="panel-collapse collapse"><div class="panel-body"><h1>test content4</h1></div>
</div></div>
</div>
HTML
, $output);
}
}
......@@ -127,6 +127,23 @@ class I18NTest extends TestCase
}
/**
* https://github.com/yiisoft/yii2/issues/7093
*/
public function testRussianPlurals()
{
$this->assertEquals('На диване лежит 6 кошек!', $this->i18n->translate('test', 'There {n, plural, =0{no cats} =1{one cat} other{are # cats}} on lying on the sofa!', ['n' => 6], 'ru'));
}
public function testUsingSourceLanguageForMissingTranslation()
{
\Yii::$app->sourceLanguage = 'ru';
\Yii::$app->language = 'en';
$msg = '{n, plural, =0{Нет комментариев} =1{# комментарий} one{# комментарий} few{# комментария} many{# комментариев} other{# комментария}}';
$this->assertEquals('5 комментариев', \Yii::t('app', $msg, ['n' => 5]));
}
/**
* https://github.com/yiisoft/yii2/issues/2519
*/
public function testMissingTranslationEvent()
......
......@@ -84,6 +84,10 @@ class UrlManagerTest extends TestCase
$url = $manager->createUrl(['post/index', 'page' => 1]);
$this->assertEquals('/post/index?page=1', $url);
// rules with defaultAction
$url = $manager->createUrl(['/post', 'page' => 1]);
$this->assertEquals('/post?page=1', $url);
// pretty URL with rules and suffix
$manager = new UrlManager([
'enablePrettyUrl' => true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment