diff --git a/.gitattributes b/.gitattributes index feef00d..5fb509b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,17 +22,15 @@ *.gif binary *.ttf binary -# Ignore all test and documentation for archive +# Ignore some meta files when creating an archive of this repository +# We do not ignore any content, because this repo represents the +# `yiisoft/yii2-dev` package, which is expected to ship all tests and docs. /.github export-ignore /.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore /.scrutinizer.yml export-ignore /.travis.yml export-ignore -/phpunit.xml.dist export-ignore -/tests export-ignore -/docs export-ignore -/build export-ignore # Avoid merge conflicts in CHANGELOG # https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/ diff --git a/build/controllers/ReleaseController.php b/build/controllers/ReleaseController.php index cf2b8eb..ef49be8 100644 --- a/build/controllers/ReleaseController.php +++ b/build/controllers/ReleaseController.php @@ -212,13 +212,15 @@ class ReleaseController extends Controller $this->stdout("\n"); $this->stdout("Before you make a release briefly go over the changes and check if you spot obvious mistakes:\n\n", Console::BOLD); + $gitDir = reset($what) === 'framework' ? 'framework/' : ''; + $gitVersion = $versions[reset($what)]; if (strncmp('app-', reset($what), 4) !== 0) { - $this->stdout("- no accidentally added CHANGELOG lines for other versions than this one?\n"); + $this->stdout("- no accidentally added CHANGELOG lines for other versions than this one?\n\n git diff $gitVersion.. ${gitDir}CHANGELOG.md\n\n"); $this->stdout("- are all new `@since` tags for this relase version?\n"); } + $this->stdout("- other issues with code changes?\n\n git diff -w $gitVersion.. ${gitDir}\n\n"); $travisUrl = reset($what) === 'framework' ? '' : '-'.reset($what); $this->stdout("- are unit tests passing on travis? https://travis-ci.org/yiisoft/yii2$travisUrl/builds\n"); - $this->stdout("- other issues with code changes?\n"); $this->stdout("- also make sure the milestone on github is complete and no issues or PRs are left open.\n\n"); $this->printWhatUrls($what, $versions); $this->stdout("\n"); @@ -527,6 +529,12 @@ class ReleaseController extends Controller $this->stdout("\n\nThe following steps are left for you to do manually:\n\n"); $nextVersion2 = $this->getNextVersions($nextVersion, self::PATCH); // TODO support other versions $this->stdout("- wait for your changes to be propagated to the repo and create a tag $version on https://github.com/yiisoft/yii2-framework\n\n"); + $this->stdout(" git clone git@github.com:yiisoft/yii2-framework.git\n"); + $this->stdout(" cd yii2-framework/\n"); + $this->stdout(" export RELEASECOMMIT=$(git log --oneline |grep $version |grep -Po \"^[0-9a-f]+\")\n"); + $this->stdout(" git tag -s $version -m \"version $version\" \$RELEASECOMMIT\n"); + $this->stdout(" git tag --verify $version\n"); + $this->stdout(" git push --tags\n\n"); $this->stdout("- close the $version milestone on github and open new ones for {$nextVersion['framework']} and {$nextVersion2['framework']}: https://github.com/yiisoft/yii2/milestones\n"); $this->stdout("- create a release on github.\n"); $this->stdout("- release news and announcement.\n"); @@ -861,7 +869,13 @@ class ReleaseController extends Controller if ($state === 'changelog' && isset($lines[$l+1]) && strncmp($lines[$l+1], '---', 3) === 0) { $state = 'end'; } - ${$state}[] = $line; + // add continued lines to the last item to keep them together + if (!empty(${$state}) && trim($line !== '') && strpos($line, '- ') !== 0) { + end(${$state}); + ${$state}[key(${$state})] .= "\n" . $line; + } else { + ${$state}[] = $line; + } } return [$start, $changelog, $end]; } @@ -879,7 +893,7 @@ class ReleaseController extends Controller $i = 0; ArrayHelper::multisort($changelog, function($line) use (&$i) { - if (preg_match('/^- (Chg|Enh|Bug|New)( #\d+(, #\d+)*)?: .+$/', $line, $m)) { + if (preg_match('/^- (Chg|Enh|Bug|New)( #\d+(, #\d+)*)?: .+/', $line, $m)) { $o = ['Bug' => 'C', 'Enh' => 'D', 'Chg' => 'E', 'New' => 'F']; return $o[$m[1]] . ' ' . (!empty($m[2]) ? $m[2] : 'AAAA' . $i++); } diff --git a/composer.json b/composer.json index 5e66838..1dbc1f3 100644 --- a/composer.json +++ b/composer.json @@ -76,6 +76,7 @@ "ezyang/htmlpurifier": "~4.6", "cebe/markdown": "~1.0.0 | ~1.1.0", "bower-asset/jquery": "2.2.*@stable | 2.1.*@stable | 1.11.*@stable | 1.12.*@stable", + "bower-asset/jquery.inputmask": "~3.2.2 | ~3.3.3", "bower-asset/punycode": "1.3.*", "bower-asset/yii2-pjax": "~2.0.1" }, diff --git a/docs/guide-ja/README.md b/docs/guide-ja/README.md index b9af4c4..ad31716 100644 --- a/docs/guide-ja/README.md +++ b/docs/guide-ja/README.md @@ -178,14 +178,14 @@ RESTful ウェブサービス ウィジェット ------------ -* GridView: **未定** デモページへリンク -* ListView: **未定** デモページへリンク -* DetailView: **未定** デモページへリンク -* ActiveForm: **未定** デモページへリンク -* Pjax: **未定** デモページへリンク -* Menu: **未定** デモページへリンク -* LinkPager: **未定** デモページへリンク -* LinkSorter: **未定** デモページへリンク +* [GridView](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html) +* [ListView](http://www.yiiframework.com/doc-2.0/yii-widgets-listview.html) +* [DetailView](http://www.yiiframework.com/doc-2.0/yii-widgets-detailview.html) +* [ActiveForm](http://www.yiiframework.com/doc-2.0/guide-input-forms.html#activerecord-based-forms-activeform) +* [Pjax](http://www.yiiframework.com/doc-2.0/yii-widgets-pjax.html) +* [Menu](http://www.yiiframework.com/doc-2.0/yii-widgets-menu.html) +* [LinkPager](http://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html) +* [LinkSorter](http://www.yiiframework.com/doc-2.0/yii-widgets-linksorter.html) * [Bootstrap ウィジェット](https://github.com/yiisoft/yii2-bootstrap/blob/master/docs/guide-ja/README.md) * [jQuery UI ウィジェット](https://github.com/yiisoft/yii2-jui/blob/master/docs/guide-ja/README.md) diff --git a/docs/guide-ja/concept-components.md b/docs/guide-ja/concept-components.md index 16dae37..794a784 100644 --- a/docs/guide-ja/concept-components.md +++ b/docs/guide-ja/concept-components.md @@ -9,7 +9,7 @@ * [ビヘイビア](concept-behaviors.md) 個々にでも、組み合わせでも、これらの機能は Yii のクラスのカスタマイズ性と使いやすさをとても高めてくれます。たとえば、[[yii\jui\DatePicker|日付選択]] を行うユーザインターフェース·コンポーネントは、 -対話型の日付選択UIを生成するとき、[ビュー](structure-view.md) で次のように使用することができます: +対話型の日付選択UIを生成するとき、[ビュー](structure-views.md) で次のように使用することができます: ```php use yii\jui\DatePicker; diff --git a/docs/guide-ja/db-migrations.md b/docs/guide-ja/db-migrations.md index e8c2ccc..a347f0e 100644 --- a/docs/guide-ja/db-migrations.md +++ b/docs/guide-ja/db-migrations.md @@ -183,7 +183,7 @@ class m150101_185401_create_news_table extends Migration ### テーブルの作成 -```php +``` yii migrate/create create_post_table ``` @@ -217,7 +217,7 @@ class m150811_220037_create_post_table extends Migration テーブルのフィールドも直接に生成したい場合は、`--fields` オプションでフィールドを指定します。 -```php +``` yii migrate/create create_post_table --fields="title:string,body:text" ``` @@ -254,7 +254,7 @@ class m150811_220037_create_post_table extends Migration さらに多くのフィールド・パラメータを指定することも出来ます。 -```php +``` yii migrate/create create_post_table --fields="title:string(12):notNull:unique,body:text" ``` @@ -296,7 +296,7 @@ class m150811_220037_create_post_table extends Migration バージョン 2.0.8 からは、`foreignKey` キーワードを使って外部キーを生成することができます。 -```php +``` yii migrate/create create_post_table --fields="author_id:integer:notNull:foreignKey(user),category_id:integer:defaultValue(1):foreignKey,title:string,body:text" ``` @@ -417,7 +417,7 @@ class m160328_040430_create_post_table extends Migration ### テーブルを削除する -```php +``` yii migrate/create drop_post_table --fields="title:string(12):notNull:unique,body:text" ``` @@ -448,7 +448,7 @@ class m150811_220037_drop_post_table extends Migration カラムを追加するためには、次のようにします。 -```php +``` yii migrate/create add_position_column_to_post_table --fields="position:integer" ``` @@ -469,11 +469,17 @@ class m150811_220037_add_position_column_to_post_table extends Migration } ``` +次のようにして複数のカラムを指定することも出来ます。 + +``` +yii migrate/create add_xxx_column_yyy_column_to_zzz_table --fields="xxx:integer,yyy:text" +``` + ### カラムを削除する マイグレーションの名前が `drop_xxx_column_from_yyy_table` の形式である場合、ファイルの内容は、必要となる `addColumn` と `dropColumn` を含むことになります。 -```php +``` yii migrate/create drop_position_column_from_post_table --fields="position:integer" ``` @@ -498,7 +504,7 @@ class m150811_220037_drop_position_column_from_post_table extends Migration マイグレーションの名前が `create_junction_table_for_xxx_and_yyy_tables` の形式である場合は、中間テーブルを作成するのに必要となるコードが生成されます。 -```php +``` yii migrate/create create_junction_table_for_post_and_tag_tables --fields="created_at:dateTime" ``` @@ -869,11 +875,12 @@ return [ もう、`migrationTable` のコマンドラインオプションを使ってテーブルを指定する必要はなくなります。 -### Namespaced Migrations +### 名前空間を持つマイグレーション -Since 2.0.10 you can use namespaces for the migration classes. You can specify the list of the migration namespaces via -[[yii\console\controllers\MigrateController::migrationNamespaces|migrationNamespaces]]. Using of the namespaces for -migration classes allows you usage of the several source locations for the migrations. For example: +2.0.10 以降では、マイグレーションのクラスに名前空間を適用することが出来ます。 +マイグレーションの名前空間のリストをを [[yii\console\controllers\MigrateController::migrationNamespaces|migrationNamespaces]] によって指定することが出来ます。 +マイグレーションのクラスに名前空間を使うと、マイグレーションのソースについて、複数の配置場所を使用することが出来ます。 +例えば、 ```php return [ @@ -881,36 +888,35 @@ return [ 'migrate' => [ 'class' => 'yii\console\controllers\MigrateController', 'migrationNamespaces' => [ - 'app\migrations', // Common migrations for the whole application - 'module\migrations', // Migrations for the specific project's module - 'some\extension\migrations', // Migrations for the specific extension + 'app\migrations', // アプリケーション全体のための共通のマイグレーション + 'module\migrations', // プロジェクトの特定のモジュールのためのマイグレーション + 'some\extension\migrations', // 特定のエクステンションのためのマイグレーション ], ], ], ]; ``` -> Note: migrations applied from different namespaces will create a **single** migration history, e.g. you might be - unable to apply or revert migrations from particular namespace only. +> Note: 異なる名前空間に属するマイグレーションを適用しても、**単一の** マイグレーション履歴が生成されます。 +> つまり、特定の名前空間に属するマイグレーションだけを適用したり元に戻したりすることは出来ません。 -While operating namespaced migrations: creating new, reverting and so on, you should specify full namespace before -migration name. Note that backslash (`\`) symbol is usually considered a special character in the shell, so you need -to escape it properly to avoid shell errors or incorrect behavior. For example: +名前空間を持つマイグレーションを操作するときは、新規作成時も、元に戻すときも、マイグレーション名の前にフルパスの名前空間を指定しなければなりません。 +バックスラッシュ (`\`) のシンボルは、通常、シェルでは特殊文字として扱われますので、シェルのエラーや誤った動作を防止するために、適切にエスケープしなければならないことに注意して下さい。 +例えば、 ``` yii migrate/create 'app\\migrations\\createUserTable' ``` -> Note: migrations specified via [[yii\console\controllers\MigrateController::migrationPath|migrationPath]] can not - contain a namespace, namespaced migration can be applied only via [[yii\console\controllers\MigrateController::migrationNamespaces]] - property. +> Note: [[yii\console\controllers\MigrateController::migrationPath|migrationPath]] によって指定されたマイグレーションは、名前空間を持つことが出来ません。 + 名前空間を持つマイグレーションは [[yii\console\controllers\MigrateController::migrationNamespaces]] プロパティを通じてのみ適用可能です。 ### 分離されたマイグレーション -Sometimes using single migration history for all project migrations is not desirable. For example: you may install some -'blog' extension, which contains fully separated functionality and contain its own migrations, which should not affect -the ones dedicated to main project functionality. +プロジェクトのマイグレーション全体に単一のマイグレーション履歴を使用することが望ましくない場合もあります。 +例えば、完全に独立した機能性とそれ自身のためのマイグレーションを持つような 'blog' エクステンションをインストールする場合には、 +メインのプロジェクトの機能専用のマイグレーションに影響を与えたくないでしょう。 これらをお互いに完全に分離して適用かつ追跡したい場合は、別々の名前空間とマイグレーション履歴テーブルを使う 複数のマイグレーションコマンドを構成することが出来ます。 diff --git a/docs/guide-ja/intro-yii.md b/docs/guide-ja/intro-yii.md index 8322afc..b56c87f 100644 --- a/docs/guide-ja/intro-yii.md +++ b/docs/guide-ja/intro-yii.md @@ -46,7 +46,7 @@ Yii は現在、利用可能な二つのメジャーバージョン、すなわ 必要条件と前提条件 ------------------ -Yii 2.0 は PHP 5.4.0 以上を必要とします。 +Yii 2.0 は PHP 5.4.0 以上を必要とし、PHP 7 の最新バージョンで最高の力を発揮します。 個々の機能に対する詳細な必要条件は、全ての Yii リリースに含まれている必要条件チェッカを走らせることによって知ることが出来ます。 Yii を使うためには、オブジェクト指向プログラミング (OOP) の基本的な知識が必要です。 diff --git a/docs/guide-ja/output-client-scripts.md b/docs/guide-ja/output-client-scripts.md index 36c6fb0..aae33b2 100644 --- a/docs/guide-ja/output-client-scripts.md +++ b/docs/guide-ja/output-client-scripts.md @@ -1,98 +1,216 @@ クライアントスクリプトを扱う ============================ -> Note: この節はまだ執筆中です。 +今日のウェブアプリケーションでは、静的な HTML ページがレンダリングされてブラウザに送信されるだけでなく、 +JavaScript によって、既存の要素を操作したり、新しいコンテントを AJAX でロードしたりして、ブラウザに表示されるページを修正します。 +この節では、JavaScript と CSS をウェブサイトに追加したり、それらを動的に調整するために Yii によって提供されているメソッドを説明します。 -### スクリプトを登録する +## スクリプトを登録する -[[yii\web\View]] オブジェクトに対してスクリプトを登録することが出来ます。 +[[yii\web\View]] オブジェクトを扱う際には、フロントエンドスクリプトを動的に登録することが出来ます。 このための専用のメソッドが二つあります。 -すなわち、インラインスクリプトのための [[yii\web\View::registerJs()|registerJs()]] と、外部スクリプトのための [[yii\web\View::registerJsFile()|registerJsFile()]] です。 -インラインスクリプトは、設定のためや、動的に生成されるコードのために有用なものです。 -次のようにして、これらを追加するメソッドを使うことが出来ます。 + +- インラインスクリプトのための [[yii\web\View::registerJs()|registerJs()]] +- 外部スクリプトのための [[yii\web\View::registerJsFile()|registerJsFile()]] +### インラインスクリプトを登録する + +インラインスクリプトは、設定や、動的に生成されるコードのために有用なものです。 +また、[ウィジェット](structure-widgets.md) に含まれる再利用可能なフロントエンドコードによって生成されるコード断片もインラインスクリプトです。 +インラインスクリプトを追加するためのメソッド [[yii\web\View::registerJs()|registerJs()]] は、次のようにして使うことが出来ます。 ```php -$this->registerJs("var options = ".json_encode($options).";", View::POS_END, 'my-options'); +$this->registerJs( + "$('#myButton').on('click', function() { alert('ボタンがクリックされました'); });", + View::POS_READY, + 'my-button-handler' +); ``` -最初の引数は、ページに挿入したい実際の JS コードです。 -二番目の引数は、スクリプトがページのどの場所に挿入されるべきかを決定します。 +最初の引数は、ページに挿入したい実際の JS コードです。これが ` + + + + +