#haml #erb
#haml #ошибка
Вопрос:
Кто-нибудь может, пожалуйста, преобразовать эти фрагменты кода haml в эквивалентный html.erb? 1.
%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
Ответ №1:
Для второго:
<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>
Ответ №2:
для первого:
<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>
Комментарии:
1. Я не думаю, что Erb поддерживает
<%= foo{ %> ... <%}%>
; я ошибаюсь?