Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: a234fde441
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 70 lines (57 sloc) 1.986 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
<% javascript :defaults %>

<%= error_messages_for :project %>

<% form_for @project do |project_form| -%>

  <p>
    <%= project_form.label :name, "Project:" %>
    <%= project_form.text_field :name %>
  </p>
  
  <p>
    <% project_form.fields_for :author do |author_form| %>
      <%= author_form.label :name, "Author name:" %>
      <%= author_form.text_field :name %>
      
      <%= author_form.label :raise_exception, "Raise exception:" %>
      <%= author_form.check_box :raise_exception %>
    <% end %>
  </p>
  
  <div id="tasks">
    <% project_form.fields_for :tasks do |task_form| %>
      <div class="task">
        <p>
          <%= task_form.label :name, "Task:" %>
          <%= task_form.text_field :name %>
          
          <%= task_form.label :raise_exception, "Raise exception:" %>
          <%= task_form.check_box :raise_exception %>
          
          <!-- Uses JS to hide this `task' and set a hidden_field with the name
`_delete' to "1" which causes the record to be deleted. -->
          <%= remove_link_unless_new_record(task_form) %>
        </p>
      </div>
    <% end %>
  </div>
  <p>
    <%= add_task_link "Add a task", project_form %>
  </p>
  
  <div id="tags">
    <% project_form.fields_for :tags do |tag_form| %>
      <div class="tag">
        <p>
          <%= tag_form.label :name, "Tag:" %>
          <%= tag_form.text_field :name %>
          
          <%= tag_form.label :raise_exception, "Raise exception:" %>
          <%= tag_form.check_box :raise_exception %>
          
          <% unless tag_form.object.new_record? %>
            <!-- For existing records we add a checkbox to be able to delete records. -->
            <%= tag_form.label :_delete, "Remove:" %>
            <%= tag_form.check_box :_delete %>
          <% end %>
        </p>
      </div>
    <% end %>
  </div>
  <p>
    <%= add_tag_link "Add a tag", project_form %>
  </p>
  
  <p>
    <%= project_form.submit "Submit" %>
  </p>
<% end -%>
Something went wrong with that request. Please try again.