我正在显示一个表,其中一列是下拉列表,它也会更改行的状态
for ex:
%table#bug.table
%thead
%tr
%th.span3 bug name
%th.span6 Comment
%th.span2 State
%th.span2 Manage
%tbody
- @bug.each do |ref|
%tr
%td= bug.name
%td= bug.comment
%td= bug.state
%td= select(bug.state_events)
上面,bug.state_events在该bug的下拉列表中返回下一个可能的状态。然后,用户可以更改状态(从打开状态变为固定状态)。
在haml/html中实现这一点的最佳方法是什么?
PS:我正在使用Rails、haml、state_machine-gems
试试这个
= select_tag "tag_name", options_from_collection_for_select(bug.state_events, "id", "name"),{ :prompt => "Select State"}