Padrino Commit Oct 08, 2013

namusyaka Merge pull request #1436 from padrino/rails-style-select

#1436のマージコミットです。

ujifgc support rails-style attribute hash of select options
ujifgc support disabled_options key for select_tag
ujifgc fix ruby 1.8.7

select_tag ヘルパーで disabled オプションを指定する方法が変更されました。

  • select_tag の disabled_options オプションに、対象とするキーまたは値を指定する(複数指定可)
  • 値を配列で渡す場合に disabled というキーを含む Hash で指定する
opts = {
  "Friends" => ["Yoda",["Obiwan",2,:magister=>'no'],:lame=>'yes'],
  "Enemies" => [["Palpatine","Palpatine",:scary=>'yes',:old=>'yes'],["Darth Vader",3,:disabled=>true]]
}
actual_html = select_tag( 'name', :grouped_options => opts, :disabled_options => [2], :selected => ['Yoda'] )

こうすると

<select name="name">
  <optgroup label="Friends" lame="yes">
    <option value="Yoda" selected="selected">Yoda</option>
    <option value="2" magister="no" disabled="disabled">Obiwan</option>
  </optgroup>
  <optgroup label="Enemies">
    <option value="Palpatine" scary="yes" old="yes">Palpatine</option>
    <option value="3" disabled="disabled">Darth Vader</option>
  </optgroup>
</select>

こうなります。

ujifgc fix #1438

#1438

String#clear メソッドの結果が ANSI カラーエスケープシーケンス付きの文字列となってしまっていた不具合が修正されました。

nesquena Remove color monkeypatching from strings, tuck that away in separateclass

ANSI カラーエスケープシーケンス付きの文字列を出力する方法が変更されました。

これまでは

puts 'foo'.red.bold

というようにStringクラスのインスタンスにカラーエスケープシーケンス付きの結果を返すメソッドが生やされていましたが、それが

puts 'foo'.colorize(:red).colorize(:bold)

というように colorize メソッド経由で指定する様になりました。

ujifgc Merge pull request #1437 from minad/correct-slim-fix

#1437のマージコミットです。

minad Correct fix for Slim #1431, #1434, #1435

slim テンプレートの不具合修正の修正方法が改善されました。