Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add essence track identifier and essence track fields to instantiatio…

…n forms if they don't already exist
  • Loading branch information...
commit 168c50470c82e4ce5399339e4a1b4ab32a4111dd 1 parent 084a034
@aviflombaum authored
View
2  app/helpers/application_helper.rb
@@ -80,7 +80,7 @@ def link_to_add_fields(name, f, association)
end
def add_another(f, association, link_text = "Add another...")
- content_tag(:p, :class => "add-another") do
+ content_tag(:p, :class => "add-another #{association}") do
link_to_add_fields(link_text, f, association)
end
end
View
2  app/views/instantiations/_essence_track_fields.html.erb
@@ -1,4 +1,4 @@
-<% f.inputs do %>
+<% f.inputs :class => 'inputs essence_tracks' do %>
<%= link_to_remove_fields "Remove", f %>
<%= f.input :essence_track_type_name, :as => :pbcore_combobox,
:input_html => { :class => "pbcore-autocomplete",
View
2  app/views/instantiations/_essence_track_identifier_fields.html.erb
@@ -1,4 +1,4 @@
-<% f.inputs do %>
+<% f.inputs :class => "inputs essence_track_identifier" do %>
<%= f.input :identifier, :as => :string,
:wrapper_html => { :class => "col-1" },
:required => false %>
View
12 app/views/instantiations/_form.html.erb
@@ -1,3 +1,15 @@
+<script>
+$(function(){
+ if ($("fieldset.inputs.essence_tracks").size() == 0){
+ $("p.add-another.essence_tracks a:first").click();
+ }
+
+ if ($("fieldset.inputs.essence_track_identifier").size() == 0){
+ $("p.add-another.essence_track_identifiers a:first").click();
+ }
+})
+</script>
+
<%= assets_navbar %>
<% semantic_form_for [@asset, @instantiation] do |form| %>
Please sign in to comment.
Something went wrong with that request. Please try again.