Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Masonote hands On in Tokyo Japan

Avatar for medy medy
April 24, 2019

Masonote hands On in Tokyo Japan

MasoniteでTodoアプリを作る講座

Avatar for medy

medy

April 24, 2019
Tweet

More Decks by medy

Other Decks in Technology

Transcript

  1. anyenvのインストール git clone https://github.com/riywo/anyenv ~/.anyenv echo 'export PATH=$HOME/.anyenv/bin:$PATH' >> ~/.bash_profile

    echo 'eval "$(anyenv init -)"' >> ~/.bash_profile exec $SHELL -l anyenv install --init vi ~/.bashrc if [ -d $HOME/.anyenv ] then export PATH=$HOME/.anyenv/bin:$PATH eval "$(anyenv init -)" fi
  2. anyenv updateのインストール mkdir -p $(anyenv root)/plugins git clone https://github.com/znz/anyenv-update.git $(anyenv

    root)/plugins/anyenv-update anyenvやそこで管理している**envのアップデートを簡単に行えるよ うにするプラグイン
  3. pip install poetry poetry poetry init Would you like to

    define your dependencies (require) interactively? (yes/no) [yes] →no を入力してスキップ Would you like to define your dev dependencies (require-dev) interactively (yes/no) [yes] →no を入力してスキップ Do you confirm generation? (yes/no) [yes] →yes を入力して確定
  4. Craft Version: 2.1.2 Usage: command [options] [arguments] Options: -h, --help

    Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose[=VERBOSE] Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: help Displays help for a command install Installs all of Masonite's dependencies list Lists commands new Creates a new Masonite project package Creates a new package
  5. コントローラーからビューを呼び出す def index(self): """Show several resource listings ex. Model.all() Get().route("/index",

    TodoController """ return view('todo/index') def edit(self): """Show form to edit an existing resource listing ex. Get().route("/edit", TodoController) """ return view('todo/edit')
  6. セレクトボックスで現在のステータスが初期状態で 選択されているようにする方法 <select> <option value="zero"{% if rec.status==0 %} selected="selected"{% endif

    %}>Zero</option> <option value="first"{% if rec.status==1 %} selected="selected"{% endif %}>First</option> <option value="second"{% if rec.status==2 %} selected="selected"{% endif %}>Second</option> <option value="third"{% if rec.status==3 %} selected="selected"{% endif %}>Third</option> </select>
  7. ルーティング ROUTES = [ Get().route('/', 'WelcomeController@show').name('welcome'), Get().route('/todo', 'TodoController@index'), Post().route('/todo', 'TodoController@store'),

    Get().route('/todo/@id/edit', 'TodoController@edit'), Post().route('/todo/@id/update', 'TodoController@update'), Post().route('/todo/@id/delete', 'TodoController@destroy') ]