From 2ae5c23d484a7b616a1dfdc5bd9dfe746980e466 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Fri, 11 Oct 2013 20:41:59 -0400 Subject: [PATCH 1/2] minor doc fix. --- docs/guide/active-record.md | 4 +++- docs/guide/validation.md | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/guide/active-record.md b/docs/guide/active-record.md index fc98f98..7d0c744 100644 --- a/docs/guide/active-record.md +++ b/docs/guide/active-record.md @@ -175,7 +175,9 @@ $customer->delete(); Customer::updateAllCounters(array('age' => 1)); ``` -Notice that you can always use the `save` method, and ActiveRecord will automatically perform an INSERT for new records and an UPDATE for existing ones. +> Info: The `save()` method will either perform an `INSERT` or `UPDATE` SQL statement, depending + on whether the ActiveRecord being saved is new or not by checking `ActiveRecord::isNewRecord`. + Data Input and Validation ------------------------- diff --git a/docs/guide/validation.md b/docs/guide/validation.md index 0322573..c555913 100644 --- a/docs/guide/validation.md +++ b/docs/guide/validation.md @@ -38,7 +38,7 @@ Compares the specified attribute value with another value and validates if they Verifies if the attribute represents a date, time or datetime in a proper format. -- `format` the date format that the value being validated should follow accodring to [[http://www.php.net/manual/en/datetime.createfromformat.php]]. _('Y-m-d')_ +- `format` the date format that the value being validated should follow according to [[http://www.php.net/manual/en/datetime.createfromformat.php]]. _('Y-m-d')_ - `timestampAttribute` the name of the attribute to receive the parsing result. ### `default`: [[DefaultValueValidator]] @@ -179,4 +179,4 @@ if ($validator->validateValue($email)) { } ``` -TBD: refer to http://www.yiiframework.com/wiki/56/ for the format \ No newline at end of file +TBD: refer to http://www.yiiframework.com/wiki/56/ for the format From bc743a32b78d48f824dcbf4eff0601b7b23fff63 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 12 Oct 2013 20:52:41 -0400 Subject: [PATCH 2/2] Fixes #968: clientOptions should not be ignored when enabling internationalization. --- extensions/jui/yii/jui/DatePicker.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/extensions/jui/yii/jui/DatePicker.php b/extensions/jui/yii/jui/DatePicker.php index c275190..ea05579 100644 --- a/extensions/jui/yii/jui/DatePicker.php +++ b/extensions/jui/yii/jui/DatePicker.php @@ -9,6 +9,7 @@ namespace yii\jui; use Yii; use yii\helpers\Html; +use yii\helpers\Json; /** * DatePicker renders an datepicker jQuery UI widget. @@ -61,11 +62,19 @@ class DatePicker extends InputWidget public function run() { echo $this->renderWidget() . "\n"; - $this->registerWidget('datepicker', DatePickerAsset::className()); if ($this->language !== false) { $view = $this->getView(); DatePickerRegionalAsset::register($view); - $view->registerJs("$('#{$this->options['id']}').datepicker('option', $.datepicker.regional['{$this->language}']);"); + // do not pass in any options when creating the widget + // set the options later so that the options can be combined with regional options + $options = $this->clientOptions; + $this->clientOptions = array(); + $this->registerWidget('datepicker', DatePickerAsset::className()); + $this->clientOptions = $options; + $options = Json::encode($options); + $view->registerJs("$('#{$this->options['id']}').datepicker('option', $.extend({}, $.datepicker.regional['{$this->language}'], $options));"); + } else { + $this->registerWidget('datepicker', DatePickerAsset::className()); } }