[英]haml/html dropdown as a table column
I am displaying a table for which one column is a dropdown which also changes the state of the row 我正在显示一张表,其中一列是一个下拉列表,它也会更改行的状态
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)
Above, bug.state_events return the next possible states in a drop down for that bug. 上面的bug.state_events在该错误的下拉列表中返回下一个可能的状态。 The user can then change the state (to say fixed from open).
然后,用户可以更改状态(例如,从打开状态更改为固定状态)。
Whats the best way to implement this in haml/html ? 在haml / html中实现此的最佳方法是什么?
PS: I am using Rails, haml, state_machine gems PS:我正在使用Rails,halm,state_machine gems
尝试这个
= select_tag "tag_name", options_from_collection_for_select(bug.state_events, "id", "name"),{ :prompt => "Select State"}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.