开发者

haml to html.erb

Can anyone please convert these haml code snippets to the equivalent html.erb? 1.

 %h1
  Edit Project Form
.edit_project
  = semantic_form_for [:admin, @project], :url => admin_organization_开发者_StackOverflow社区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


For the second:

<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>


for first:

<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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜