我有這個部分,我在其中使用如果elsif和形式在他們在某些條件。由於呈現部分條件,我得到了結束標記問題。它說我有額外的結局。在包含表單的情況下(如果還有)有額外的結尾?
<% if (@company_detail.company_logo.blank?)%>
<h3>ADD LOGO</h3>
<% else %>
<img src="<%= "#{@company_detail.company_logo}"%>" class="logo-image" alt="logo"/>
<% end -%>
<div class="overlay align-right">
<%= form_for(:company_detail, :url => {:action => 'changeLogo', :id => @company_detail.id}, :remote => true, :html => {:multipart => true, :method => :post }) do |f| %>
<p style="display:none;">
<input type="file" name = "logo" id="logoUploadField" accept="image/png,image/gif,image/jpeg,image/jpg" onChange='upload()'/>
<button id="upload_logo" type="submit"></button>
</p>
<% end -%>
<% if (@company_detail.company_logo.blank?) %>
<p class="align-right">
<button class="button small green" id="add_logo" type="reset"><span>Add</span></button>
</p>
<% elsif (@company_detail.company_logo.present?)%>
<%= form_tag({:action => 'removeLogo', :id => @company_detail.id}, :remote => true, :html => {:method => :post }) %>
<p class="align-right">
<button class="button small green" id="change_logo" type="reset"><span>Change</span></button>
<button class="button small green" type="submit"><span>Remove</span></button>
<% end %>
</p>
<% end %>
oh..yes ...我忘了添加它。感謝您爲我指出。 – 2013-05-08 12:17:15