Skip to content

Instantly share code, notes, and snippets.

@mysteriouspants
Created October 25, 2011 20:36
Show Gist options
  • Save mysteriouspants/1314177 to your computer and use it in GitHub Desktop.
Save mysteriouspants/1314177 to your computer and use it in GitHub Desktop.
Borked Form
<h3>Upload a New Image</h3>
<%= form_for Image.new(:project => @project) do |f| %>
<%= f.hidden_field :project_id %>
<div class="sevenhundred">
<div class="first column threeforty">
<%= f.text_field :name, :class => 'form-text', :placeholder => 'Image Name', :size => '45' %>
</div>
<div class="last column threeforty">
<%= f.file_field :image %>
</div>
</div>
<%= f.submit 'Upload', :class => 'form-button' %>
<% end %>
<p id="bingo-batches-notifier" <% unless @project.batches.empty? %>style="display:none"<% end %>>This project has no batches.</p>
<div>
<ul class="no-bullets" id="batch-list">
<% @project.batches.each do |batch| %>
<% @batch = batch %>
<%= render :partial => 'batches/batch' %>
<% end %>
</ul>
</div>
<% if is_project_owner? %>
<div>
<%= form_for Batch.new, :remote => true, :html => { :id => 'batch-creator' } do |f| %>
<%= hidden_field_tag 'batch[project_id]', @project.id %>
<%= hidden_field_tag 'batch[status]', 'Ready' %>
<%= f.text_field :number, :class => 'form-text', :placeholder => 'New Batch Number' %>
<%= f.submit :class => 'form-submit', :style => 'margin-top:1.33em' %>
<% end %>
<p id="batch-submit-error" style="display:none">There was an error creating that batch</p>
</div>
<% end %>
<div class="clearfix nineforty">
<%= form_for @project do |f| %>
<div class="first column seventwenty project-instructions">
<div class="project-name">
<%= f.text_field :name, :class => 'form-text', :id => 'project-name' %>
</div>
<%= f.text_area :instructions, :class => 'form-textarea', :placeholder => 'Project instructions go here', :id => 'project-instructions' %>
<%= f.submit 'Save', :class => 'form-button', :style => 'float:right' %>
</div>
<div class="last column twohundred">
<h2>Project Status</h2>
<%= f.select :status, Project.valid_statuses %>
<h2>Batches</h2>
<%= render :partial => 'batch_list' %>
</div>
</div>
<% end %>
<div class="clearfix nineforty attachments">
<ul id="images">
<% @project.images.each do |image| %>
<% @image = image %>
<%= render :partial => 'images/image_thumb' %>
<% end %>
</ul>
<br style="clear:both"/>
<div>
<%= render :partial => 'attachment_form' %>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment