2014-04-11 56 views
0

有人可以rails-haml專家翻譯,請問這個haml代碼是如何翻譯成html的? 該頁面源自此url。我爲只在線路1和12感興趣的我已經使用的各種工具,上線CON變頻器則,但似乎沒有工作:(haml到html翻譯

%table.table.table-bordered.table-striped#sortable{:data => {update_url: 
sort_admin_things_path}} 
    %thead 
%tr 
    %th= Title 
    %th= Description 
    %th   
    %tbody 
    - @things.each do |thing| 
    # make the <tr>'s draggable by adding the expected '.item' class 
    # pass the item id into params[:id] 
    %tr{data: {item_id: "#{thing.id}"}, class: 'item'} 
    %td= thing.title 
    %td= thing.description.truncate(20) 
    %td 
     = link_to 'show', admin_thing_path(thing), :class => 'btn' 
     = link_to 'edit', edit_admin_thing_path(thing), :class => 'btn btn-primary' 
     = link_to 'destroy', admin_thing_path(thing), method: :delete, confirm: "Are you sure?", :class => 'btn btn-danger' 

回答

1

那不是正確的縮進。大不了的HAML是必須的事情縮進格式正確工作,否則你就會有意外的錯誤,由於壓痕

Anyway..Try這樣的:。

<table class="table table-bordered table-striped" id="sortable" data-update_url = <%= sort_admin_things_path%> > 
    <thead> 
    <tr> 
     <th> 
     <%= Title %> 
     </th> 
     <th> 
     <%= Description %> 
     </th> 
     <th>&nbsp;</th> 
    </tr> 
    </thead> 
    <tbody> 
    <% @things.each do |thing| %> 
     <tr data-item_id= <%= thing.id %> class= "item" > 
     <td> 
      <%= thing.title %> 
     </td> 
     <td> 
      <%= thing.description.truncate(20) %> 
     </td> 
     <td> 
      <%= link_to 'show', admin_thing_path(thing), :class => 'btn' %> 
      <%= link_to 'edit', edit_admin_thing_path(thing), :class => 'btn btn-primary' %> 
      <%= link_to 'destroy', admin_thing_path(thing), method: :delete, confirm: "Are you sure?", :class => 'btn btn-danger' %> 
     </td> 
     </tr> 
    <% end %> 
    </tbody> 
</table> 
+0

感謝您的回答 – user3172824