Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 haml到html的翻译_Ruby On Rails 4_Haml - Fatal编程技术网

Ruby on rails 4 haml到html的翻译

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传递到参数[:

有人能翻译一下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传递到参数[: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>&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>

'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>&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>