Play framework チュートリアル実践・写経メモ-7.CRUD による基本的な管理機能のセットアップ
モジュール構成の所でちょっと詰まったけど自己解決。
guide7:CRUD による基本的な管理機能のセットアップ
CRUD モジュールの有効化
/yabe/conf/dependencies.yml ファイルに内容を追記(『 -> crud』)を付加
# Application dependencies require: - play -> crud
依存性解決を図るため、dependenciesコマンドを実行(play dependencies|deps アプリ名)
PS C:\eclipse3.6_playfw\workspace> play deps yabe ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.4, http://www.playframework.org ~ ~ Resolving dependencies using C:\eclipse3.6_playfw\workspace\yabe\conf\dependencies.yml, ~ ~ ~ Installing resolved dependencies, ~ ~ modules/crud -> C:\play-1.2.4\modules\crud ~ ~ Done! ~ PS C:\eclipse3.6_playfw\workspace>
- プロジェクト配下にmodules/フォルダ及びcrudファイルが作成された。
- routesファイルに以下の内容を追記。
# Import CRUD routes * /admin module:crud
- モジュールライブラリをEclipseでも使えるように諸設定が必要。
プロジェクト右クリック→[ビルドパス]→[ソースのリンク]を選択。[PLAY_HOME]/modules/crud/app配下をリンク先に指定し保存。
構成を取り込み、利用が可能に。
- (削除&追記)以下のページによると、依存性解決(play dependencies|deps [appsname])を行った後は『play eclipsfisy|ec [appsname])→Eclipse再ビルド』で上記事象を解決してくれるようです。素敵!
バリデーションの追加
より良いフォームラベル
- /yabe/conf/messagesに情報を追記し対応。
- Play framework - Documentation : 国際化と地域化
'Comments' データリストのカスタマイズ
- play crud:ovコマンドの実行(プロジェクト名の箇所はフルパス指定でないとコケた)
C:\eclipse3.6_playfw\workspace>play crud:ov C:\eclipse3.6_playfw\workspace\yabe --template Comments/list ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.2.4, http://www.playframework.org ~ ~ Copied C:\play-1.2.4\modules\crud\app/views/CRUD/list.html to C:\eclipse3.6_playfw\workspace\yabe\app/views/Comments/list.html ~ C:\eclipse3.6_playfw\workspace>
あとはチュートリアルページの内容通りの進行で完了。リリースや各種作業の時にどういう手順でこの辺りのモジュール・依存性管理の部分を組み込んでいくかは、個人的に少し整理する必要がありそうだ。