2013-05-08 45 views
0

我有這個部分,我在其中使用如果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 %> 

回答

1

您的問題不包括do類似於第二種形式的代碼。

<%= form_tag({:action => 'removeLogo', :id => @company_detail.id}, :remote => true, :html => {:method => :post }) do %> 
+0

oh..yes ...我忘了添加它。感謝您爲我指出。 – 2013-05-08 12:17:15

1

你忘了 「做」 這一行:

<%= form_tag({:action => 'removeLogo', :id => @company_detail.id}, :remote => true, :html => {:method => :post }) %> 

添加 「做」 在這裏:

<%= form_tag({:action => 'removeLogo', :id => @company_detail.id}, :remote => true, :html => {:method => :post }) do %> 

,它應該工作。

+0

oh..yes ...我忘了添加它。感謝您爲我指出。 – 2013-05-08 12:17:43

相關問題