Ruby on rails 4 haml到html的翻译
有人能翻译一下haml专家吗,这个haml代码是如何翻译成html的? 该页是由此派生的。我只对第1行和第12行感兴趣。我使用过各种工具,在线转换器,但似乎不起作用:(Ruby on rails 4 haml到html的翻译,ruby-on-rails-4,haml,Ruby On Rails 4,Haml,有人能翻译一下haml专家吗,这个haml代码是如何翻译成html的? 该页是由此派生的。我只对第1行和第12行感兴趣。我使用过各种工具,在线转换器,但似乎不起作用:( %table.table.table带边框.table带条#sortable{:data=>{update\u url: 排序\管理\事物\路径} %泰德 %tr %th=标题 %th=描述 %th %t车身 -@things.each do| things| #通过添加所需的“.item”类使可拖动 #将项目id传递到参数[:
%table.table.table带边框.table带条#sortable{:data=>{update\u url:
排序\管理\事物\路径}
%泰德
%tr
%th=标题
%th=描述
%th
%t车身
-@things.each do| things|
#通过添加所需的“.item”类使可拖动
#将项目id传递到参数[:id]
%tr{data:{item_id:{thing.id}},类:'item'}
%td=事物名称
%td=thing.description.truncate(20)
%运输署
=链接到'show',admin\u thing\u path(thing),:class=>'btn'
=链接到“编辑”,编辑管理对象路径(对象):类=>'btn btn primary'
=链接到'destroy',admin\u thing\u path(thing),method::delete,confirm:“确定吗?”,:class=>'btn btn danger'
缩进不正确。haml的一个大问题是必须正确缩进才能工作。否则,缩进会导致意外错误
无论如何,试试这个:
<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> </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>
'btn'>
“btn btn主节点”%>
“btn btn危险”%>
<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> </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>