diff --git a/app/views/software_records/_form_general.html.erb b/app/views/software_records/_form_general.html.erb index f6572d5..14a5508 100644 --- a/app/views/software_records/_form_general.html.erb +++ b/app/views/software_records/_form_general.html.erb @@ -47,184 +47,12 @@ <%= form.select(:authentication_type, t('authentication_types'), {}, { :class => 'form-control' }) %> - -<% if current_user.role.to_s == "root_admin" %> -
- <%= form.label :departments %> - + add more - - <% if component.to_s == "new" || @software_record.departments.empty? %> -
- <%= text_field_tag "software_record[departments][]", nil, required: true, class: "form-control" %> -
- Delete -
-
- <% else %> - <% @software_record.departments.each_with_index do |department, index| %> - <% @id = "departments#{index + 1}" %> -
- <%= text_field_tag "software_record[departments][]", department, required: true, class: "form-control" %> -
- Delete -
-
- <% end %> - <% end %> -
-<% else %> - <% if @software_record.departments.any? %> -
- <% @software_record.departments.each_with_index do |department, index| %> - <% @id = "departments#{index + 1}" %> - - <% end %> -
- <% end %> -<% end %> - - - -<% if current_user.role.to_s != "owner" %> -
- <%= form.label :developers %> - + add more - - <% if component.to_s == "new" || @software_record.developers.empty? %> -
- <%= text_field_tag "software_record[developers][]", nil, required: true, class: "form-control" %> -
- Delete -
-
- <% else %> - <% @software_record.developers.each_with_index do |developer, index| %> - <% @id = "developers#{index + 1}" %> -
- <%= text_field_tag "software_record[developers][]", developer, required: true, class: "form-control" %> -
- Delete -
-
- <% end %> - <% end %> -
-<% else %> - <% if @software_record.developers.any? %> -
- <% @software_record.developers.each_with_index do |developer, index| %> - <% @id = "developers#{index + 1}" %> - - <% end %> -
- <% end %> -<% end %> - - - -<% if current_user.role.to_s != "owner" %> -
- <%= form.label :tech_leads %> - + add more - - <% if component.to_s == "new" || @software_record.tech_leads.empty? %> -
- <%= text_field_tag "software_record[tech_leads][]", nil, required: true, class: "form-control" %> -
- Delete -
-
- <% else %> - <% @software_record.tech_leads.each_with_index do |tech_lead, index| %> - <% @id = "tech_leads#{index + 1}" %> -
- <%= text_field_tag "software_record[tech_leads][]", tech_lead, required: true, class: "form-control" %> -
- Delete -
-
- <% end %> - <% end %> -
-<% else %> - <% if @software_record.tech_leads.any? %> -
- <% @software_record.tech_leads.each_with_index do |tech_lead, index| %> - <% @id = "tech_leads#{index + 1}" %> - - <% end %> -
- <% end %> -<% end %> - - - -
- <%= form.label "Product Lead/Contact" %> - + add more - - <% if component.to_s == "new" || @software_record.product_owners.empty? %> -
- <%= text_field_tag "software_record[product_owners][]", nil, required: true, class: "form-control" %> -
- Delete -
-
- <% else %> - <% @software_record.product_owners.each_with_index do |product_owner, index| %> - <% @id = "product_owners#{index + 1}" %> -
- <%= text_field_tag "software_record[product_owners][]", product_owner, required: true, class: "form-control" %> -
- Delete -
-
- <% end %> - <% end %> -
- - - -
- <%= form.label "Admin Users" %> - + add more - - <% if component.to_s == "new" || @software_record.admin_users.empty? %> -
- <%= text_field_tag "software_record[admin_users][]", nil, required: true, class: "form-control" %> -
- Delete -
-
- <% else %> - <% @software_record.admin_users.each_with_index do |admin_user, index| %> - <% @id = "admin_users#{index + 1}" %> -
- <%= text_field_tag "software_record[admin_users][]", admin_user, required: true, class: "form-control" %> -
- Delete -
-
- <% end %> - <% end %> -
- - + + <%= render 'form_multi_departments', software_record: @software_record, component: component, form: form %> + <%= render 'form_multi_developers', software_record: @software_record, component: component, form: form %> + <%= render 'form_multi_tech_leads', software_record: @software_record, component: component, form: form %> + <%= render 'form_multi_product_owners', software_record: @software_record, component: component, form: form %> + <%= render 'form_multi_admin_users', software_record: @software_record, component: component, form: form %> <% if current_user.role.to_s != "owner" %> diff --git a/app/views/software_records/_form_multi_admin_users.html.erb b/app/views/software_records/_form_multi_admin_users.html.erb new file mode 100644 index 0000000..ebaff8b --- /dev/null +++ b/app/views/software_records/_form_multi_admin_users.html.erb @@ -0,0 +1,29 @@ + +
+ <%= form.label "Admin Users" %> + + add more + + <% if component.to_s == "new" || @software_record.admin_users.empty? %> +
+ <%= text_field_tag "software_record[admin_users][]", nil, required: true, class: "form-control" %> +
+ Delete +
+
+ <% else %> + <% @software_record.admin_users.each_with_index do |admin_user, index| %> + <% @id = "admin_users#{index + 1}" %> +
+ <%= text_field_tag "software_record[admin_users][]", admin_user, required: true, class: "form-control" %> +
+ Delete +
+
+ <% end %> + <% end %> +
+ + + + + diff --git a/app/views/software_records/_form_multi_departments.html.erb b/app/views/software_records/_form_multi_departments.html.erb new file mode 100644 index 0000000..a291254 --- /dev/null +++ b/app/views/software_records/_form_multi_departments.html.erb @@ -0,0 +1,44 @@ + +<% if current_user.role.to_s == "root_admin" %> +
+ <%= form.label :departments %> + + add more + + <% if component.to_s == "new" || @software_record.departments.empty? %> +
+ <%= text_field_tag "software_record[departments][]", nil, required: true, class: "form-control" %> +
+ Delete +
+
+ <% else %> + <% @software_record.departments.each_with_index do |department, index| %> + <% @id = "departments#{index + 1}" %> +
+ <%= text_field_tag "software_record[departments][]", department, required: true, class: "form-control" %> +
+ Delete +
+
+ <% end %> + <% end %> +
+<% else %> + <% if @software_record.departments.any? %> +
+ <% @software_record.departments.each_with_index do |department, index| %> + <% @id = "departments#{index + 1}" %> + + <% end %> +
+ <% end %> +<% end %> + + + + diff --git a/app/views/software_records/_form_multi_developers.html.erb b/app/views/software_records/_form_multi_developers.html.erb new file mode 100644 index 0000000..6bb8f30 --- /dev/null +++ b/app/views/software_records/_form_multi_developers.html.erb @@ -0,0 +1,43 @@ + +<% if current_user.role.to_s != "owner" %> +
+ <%= form.label :developers %> + + add more + + <% if component.to_s == "new" || @software_record.developers.empty? %> +
+ <%= text_field_tag "software_record[developers][]", nil, required: true, class: "form-control" %> +
+ Delete +
+
+ <% else %> + <% @software_record.developers.each_with_index do |developer, index| %> + <% @id = "developers#{index + 1}" %> +
+ <%= text_field_tag "software_record[developers][]", developer, required: true, class: "form-control" %> +
+ Delete +
+
+ <% end %> + <% end %> +
+<% else %> + <% if @software_record.developers.any? %> +
+ <% @software_record.developers.each_with_index do |developer, index| %> + <% @id = "developers#{index + 1}" %> + + <% end %> +
+ <% end %> +<% end %> + + + diff --git a/app/views/software_records/_form_multi_product_owners.html.erb b/app/views/software_records/_form_multi_product_owners.html.erb new file mode 100644 index 0000000..7bfec3c --- /dev/null +++ b/app/views/software_records/_form_multi_product_owners.html.erb @@ -0,0 +1,29 @@ + +
+ <%= form.label "Product Lead/Contact" %> + + add more + + <% if component.to_s == "new" || @software_record.product_owners.empty? %> +
+ <%= text_field_tag "software_record[product_owners][]", nil, required: true, class: "form-control" %> +
+ Delete +
+
+ <% else %> + <% @software_record.product_owners.each_with_index do |product_owner, index| %> + <% @id = "product_owners#{index + 1}" %> +
+ <%= text_field_tag "software_record[product_owners][]", product_owner, required: true, class: "form-control" %> +
+ Delete +
+
+ <% end %> + <% end %> +
+ + + + + diff --git a/app/views/software_records/_form_multi_tech_leads.html.erb b/app/views/software_records/_form_multi_tech_leads.html.erb new file mode 100644 index 0000000..09b7c0b --- /dev/null +++ b/app/views/software_records/_form_multi_tech_leads.html.erb @@ -0,0 +1,41 @@ + +<% if current_user.role.to_s != "owner" %> +
+ <%= form.label :tech_leads %> + + add more + + <% if component.to_s == "new" || @software_record.tech_leads.empty? %> +
+ <%= text_field_tag "software_record[tech_leads][]", nil, required: true, class: "form-control" %> +
+ Delete +
+
+ <% else %> + <% @software_record.tech_leads.each_with_index do |tech_lead, index| %> + <% @id = "tech_leads#{index + 1}" %> +
+ <%= text_field_tag "software_record[tech_leads][]", tech_lead, required: true, class: "form-control" %> +
+ Delete +
+
+ <% end %> + <% end %> +
+<% else %> + <% if @software_record.tech_leads.any? %> +
+ <% @software_record.tech_leads.each_with_index do |tech_lead, index| %> + <% @id = "tech_leads#{index + 1}" %> + + <% end %> +
+ <% end %> +<% end %> + diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index ad2ab73..fc33fc3 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -14,7 +14,7 @@ # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. # Rails.application.config.assets.precompile += %w( admin.js admin.css ) -Rails.application.config.assets.precompile += %w( navigation.js ) -Rails.application.config.assets.precompile += %w( filtermanagement.js ) -Rails.application.config.assets.precompile += %w( inputsanitization.js ) -Rails.application.config.assets.precompile += %w( multivalueinputs.js ) +Rails.application.config.assets.precompile += %w[navigation.js] +Rails.application.config.assets.precompile += %w[filtermanagement.js] +Rails.application.config.assets.precompile += %w[inputsanitization.js] +Rails.application.config.assets.precompile += %w[multivalueinputs.js]