2016-06-22 2 views
3

내 연결 체크 박스에서 테이블을 생성 중입니다. 각 행에는 확인란과 몇 가지 추가 정보가 표시됩니다.collection_check_boxes에서 외부 레이블 제거

<table> 
<span><label for="task_ids_1"> <--- I want to remove this... 
    <tr> 
    <td><label for="task_ids_1">My Name</label></td> 
    <td><input type="checkbox" value="8" name="user[task_ids][]" id="task_ids_1" /></td> 
    <td>I'm in.</td> 
    </tr> 
</label></span> <--- ...and this! 
</table> 

은 물론 내가 label: false을 설정했지만,이 옵션이 적용되지 않습니다 : 출력은 다음과 같습니다 이후

%table 
= f.collection_check_boxes :task_ids, @my_collection, :id, :label do |r| 
    %tr 
    %td= r.label 
    %td= r.check_box 
    %td= r.object.due_date 

는하지만 내 HTML을 나누기. 바깥 쪽 레이블을 제거하려면 어떻게해야합니까?

답변

1

마침내 거의 1 년 후 나 스스로 알아 냈습니다. boolean_style: :inline이라는 옵션이 작동합니다.

당신이 (당신이 으로 자신을 내포하고 있기 때문에) 당신이 boolean_style를 사용할 필요가 인라인되고 싶어하기 때문에 :

%table 
    = f.collection_check_boxes :task_ids, @coll, :id, :label, boolean_style: :inline do |r| 
    %tr 
     %td= r.label 
     %td= r.check_box 
     %td= r.object.due_date 

나는 해결책 여기 https://github.com/plataformatec/simple_form/issues/1266 설명을 발견 : 인라인 설정을 .

관련 문제