這是什麼東西,我可以全砍嗎?
其實我已經改掉一小部份了,但還是這樣一團:
<% if prev_photo=@photo.get_prev(params[:album_id]) %>
<% prev_photo1 = prev_photo %>
<% if prev_photo=prev_photo.get_prev(params[:album_id]) %>
<% if prev_photo.id != @photo.id %>
<%= link_to (show_photo(prev_photo, :square, :width => "75"), photo_path(prev_photo) + '.html', {:style => "padding: 0px 10px 0px 10px;" }) %>
<% end -%>
<% else %>
<% prev_photo=prev_photo1.get_last(params[:album_id]) %>
<% if prev_photo.id != @photo.id %>
<%= link_to (show_photo(prev_photo, :square, :width => "75"), photo_path(prev_photo) + '.html', {:style => "padding: 0px 10px 0px 10px;" }) %>
<% end -%>
<% end %>
<% if prev_photo.id != @photo.id %>
<%= link_to (show_photo(prev_photo1, :square, :width => "75", :alt => prev_photo1.title), photo_path(prev_photo1) + '.html', {:style => "padding: 0px 10px 0px 10px;" }) %>
<% end -%>
<% else %>
<% if prev_photo = @photo.get_last(params[:album_id]) %>
<% prev_photo1 = prev_photo %>
<% if prev_photo=prev_photo.get_prev(params[:album_id]) %>
<% if prev_photo.id != @photo.id %>
<%= link_to (show_photo(prev_photo, :square,:width=> "75",:alt => prev_photo.title), photo_path(prev_photo) + '.html', {:style => "padding: 0px 10px 0px 10px;" }) %>
<% end %>
<% end %>
<% if prev_photo.id != @photo.id %>
<%= link_to (show_photo(prev_photo1, :square,:width=> "75", :alt => prev_photo1.title), photo_path(prev_photo1) + '.html', {:style => "padding: 0px 10px 0px 10px;" }) %>
<% end -%>
<% end -%>
<% end -%>
2 retries:
這個一看就感覺很亂,不太想看 :QQ
不過我要改寫的話,勢必得看懂 @@
Post a Comment
Note: Only a member of this blog may post a comment.