<% action ||= :create %> <% if @dirmon_entry.errors.present? %>
Invalid Dirmon entry!
<% @dirmon_entry.errors.messages.each_pair do |field, message| %>
<%= field %>: <%= message %>
<% end %> <% end %> <%= form_for @dirmon_entry, url: { action: action } do |f| %>
<%= f.label :name %> <%= f.text_field :name, class: "form-control" %>
<%= f.label "Job Class" %> <%= f.text_field :job_class_name, class: "form-control", disabled: action != :create %>
<%= f.label :pattern %> <%= f.text_field :pattern, class: "form-control" %>
<%= f.label :archive_directory %> <%= f.text_field :archive_directory, class: "form-control" %>
<% if @dirmon_entry.job_class %> <% @job = @dirmon_entry.job_class.from_properties(@dirmon_entry.properties) %> <%= f.fields_for :properties do |p| %>
Properties
<% @dirmon_entry.job_class.user_editable_fields.sort.each do |property_name| %> <% next if property_name == :run_at %>
<%= p.label property_name.to_s %> <%= editable_field_html(@dirmon_entry.job_class, property_name, @job.public_send(property_name), p) %>
<% end %>
<% if @dirmon_entry.job_class.respond_to?(:defined_input_categories) && @dirmon_entry.job_class.respond_to?(:defined_output_categories) %>
Input Categories
<% @job.input_categories.each do |input_categories| %> <%= p.fields_for "input_categories_attributes[]", input_categories do |i| %> <%= render "input_category_fields.html", f: i %> <% end %> <% end %>
Output Categories
<% @job.output_categories.each do |output_categories| %> <%= p.fields_for "output_categories_attributes[]", output_categories do |o| %> <%= render "output_category_fields.html", f: o %> <% end %> <% end %>
<% end %> <% end %>
<% end %>
<%= f.submit action, class: 'btn btn-primary' %> <%= link_to 'cancel', :back, class: 'btn btn-default' %>
<% if action == :create %> <%= button_tag 'properties', type: 'button', class: 'btn btn-default', id: 'properties', data: {url: rocket_job_mission_control.new_dirmon_entry_path} %> <% end %>
<% end %>