0

私は Rails を使い始めたばかりです (コーディングの完全な初心者として)。このコードが機能するようになると、経験豊富なコーダーがうんざりすることはわかっています。これをより良く書き直すのを手伝ってください。具体的には、最初の画像がリンクの一部になるように

<table class="table table-hover">
    <tr id="topbar"><th width="60%">Name</th> 
    <th width="10%">Size</th>
    <th width="20%">Modified</th>
    <th width="5%"></th>
    <th width="5%"></th></tr>
<% @folders.each do |folder| %>
    <tr>
     <td width="60%"><img src="https://s3-us-west-2.amazonaws.com/images/folder.gif"> <%= link_to folder.name, browse_path(folder) %></td>
     <td width="10%">-</td>
     <td width="20%">-</td>     
     <td width="5%"><%= link_to image_tag("https://s3-us-west-2.amazonaws.com/images/page_edit.gif"), rename_folder_path(folder) %></td> 
     <td width="5%"><%= link_to image_tag("https://s3-us-west-2.amazonaws.com/images/action_stop.gif"), folder, :confirm => 'Are you sure you want to delete the folder and all of its contents?', :method => :delete %></td>
    </tr>
<% end %> 
4

3 に答える 3

0
<%= link_to " <td width=\"60%\"><img src=\"https://s3-us-west-2.amazonaws.com/images/folder.gif\">#{link_to folder.name, browse_path(folder)}</td><td width=\"10%\">-</td><td width=\"20%\">-</td>" %>

テストされていませんが、同様のものが機能すると思います。

于 2013-05-05T04:15:08.310 に答える