2011-05-03 28 views
0

任何人都可以請將這些haml代碼片段轉換爲相應的html.erb嗎? 1.haml to html.erb

%h1 
    Edit Project Form 
.edit_project 
    = semantic_form_for [:admin, @project], :url => admin_organization_project_path(@organization), :html => { :multipart => true } do |f| 
    = f.inputs do 
     = f.input :name 
     = f.input :status, :as => :select, :collection => Project.statuses 
     = f.input :overview 
     = f.input :funds_purpose 
     = f.input :goal 
     .files 
     = render :partial => 'admin/edit_photo', :collection => @project.project_photos, :locals => { :field_name => 'project[project_photos_attributes][][file]' } 
    = f.submit 'Save Project' 

2.

%li.file.optional#project_project_photo_file_input 
    = label_tag 'File' 
    = image_tag edit_photo.file.url(:thumb) if edit_photo.file? 
    = file_field_tag field_name 

回答

0

對於第二個:

<li class="file optional" id="project_project_photo_file_input"> 
<%= label_tag 'File' %> 
<%= image_tag edit_photo.file.url(:thumb) if edit_photo.file? %> 
<%= file_field_tag field_name %> 
</li> 
0

爲第一:

<h1> Edit Project Form </h1> 
<div class='edit_project'> 
    <%= semantic_form_for [:admin, @project], :url => admin_organization_project_path(@organization), :html => { :multipart => true } do |f| %> 
    <%= f.inputs do %> 
    <%= f.input :name %> 
    <%= f.input :status, :as => :select, :collection => Project.statuses%> 
    <%= f.input :overview %> 
    <%= f.input :funds_purpose %> 
    <%= f.input :goal %> 
    <div class='files' > 
     <%= render :partial => 'admin/edit_photo', :collection => @project.project_photos, :locals => { :field_name => 'project[project_photos_attributes][][file]' } %> 
    </div> 
    <% end %> 
    <%= f.submit 'Save Project' %> 
    <% end %> 
</div> 
+0

我不認爲厄爾布支持'<%= foo{ %> ... <%}%>';我錯了嗎? – Phrogz 2011-05-05 02:48:40