-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactors multi_value partials and javascript.
- Loading branch information
Thomas Scherz
committed
Jul 23, 2024
1 parent
e36075b
commit af65d4c
Showing
7 changed files
with
196 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
app/views/software_records/_form_multi_admin_users.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- Multiple Admin Users --> | ||
<div class="form-group" id="multiple_admin_users"> | ||
<%= form.label "Admin Users" %> | ||
<a class="float-right text-primary anchor-underline" id="btnAddAdminUsers">+ add more</a> | ||
|
||
<% if component.to_s == "new" || @software_record.admin_users.empty? %> | ||
<div class="input-group mt-2" id="admin_users1"> | ||
<%= text_field_tag "software_record[admin_users][]", nil, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('admin_users1')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% else %> | ||
<% @software_record.admin_users.each_with_index do |admin_user, index| %> | ||
<% @id = "admin_users#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>"> | ||
<%= text_field_tag "software_record[admin_users][]", admin_user, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<!-- Multiple Admin Users ends --> | ||
|
||
|
||
|
||
|
44 changes: 44 additions & 0 deletions
44
app/views/software_records/_form_multi_departments.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!-- Multiple Departments --> | ||
<% if current_user.role.to_s == "root_admin" %> | ||
<div class="form-group" id="multiple_departments"> | ||
<%= form.label :departments %> | ||
<a class="float-right text-primary anchor-underline" id="btnAddDepartments">+ add more</a> | ||
|
||
<% if component.to_s == "new" || @software_record.departments.empty? %> | ||
<div class="input-group" id="departments1"> | ||
<%= text_field_tag "software_record[departments][]", nil, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('departments1')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% else %> | ||
<% @software_record.departments.each_with_index do |department, index| %> | ||
<% @id = "departments#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>"> | ||
<%= text_field_tag "software_record[departments][]", department, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<% else %> | ||
<% if @software_record.departments.any? %> | ||
<div class="form-group" id="multiple_departments"> | ||
<% @software_record.departments.each_with_index do |department, index| %> | ||
<% @id = "departments#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>" style="display: none"> | ||
<%= text_field_tag "software_record[departments][]", department, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<!-- Multiple Departments ends --> | ||
|
||
|
||
|
43 changes: 43 additions & 0 deletions
43
app/views/software_records/_form_multi_developers.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!-- Multiple Developers --> | ||
<% if current_user.role.to_s != "owner" %> | ||
<div class="form-group" id="multiple_developers"> | ||
<%= form.label :developers %> | ||
<a class="float-right text-primary anchor-underline" id="btnAddDevelopers">+ add more</a> | ||
|
||
<% if component.to_s == "new" || @software_record.developers.empty? %> | ||
<div class="input-group mt-2" id="developers1"> | ||
<%= text_field_tag "software_record[developers][]", nil, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('developers1')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% else %> | ||
<% @software_record.developers.each_with_index do |developer, index| %> | ||
<% @id = "developers#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>"> | ||
<%= text_field_tag "software_record[developers][]", developer, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<% else %> | ||
<% if @software_record.developers.any? %> | ||
<div class="form-group" id="multiple_developers"> | ||
<% @software_record.developers.each_with_index do |developer, index| %> | ||
<% @id = "developers#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>" style="display: none"> | ||
<%= text_field_tag "software_record[developers][]", developer, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<!-- Multiple Developers ends --> | ||
|
||
|
29 changes: 29 additions & 0 deletions
29
app/views/software_records/_form_multi_product_owners.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!-- Multiple Product Owners --> | ||
<div class="form-group" id="multiple_product_owners"> | ||
<%= form.label "Product Lead/Contact" %> | ||
<a class="float-right text-primary anchor-underline" id="btnAddProductOwners">+ add more</a> | ||
|
||
<% if component.to_s == "new" || @software_record.product_owners.empty? %> | ||
<div class="input-group mt-2" id="product_owners1"> | ||
<%= text_field_tag "software_record[product_owners][]", nil, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('product_owners1')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% else %> | ||
<% @software_record.product_owners.each_with_index do |product_owner, index| %> | ||
<% @id = "product_owners#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>"> | ||
<%= text_field_tag "software_record[product_owners][]", product_owner, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<!-- Multiple Product Owners ends --> | ||
|
||
|
||
|
||
|
41 changes: 41 additions & 0 deletions
41
app/views/software_records/_form_multi_tech_leads.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- Multiple Tech Leads --> | ||
<% if current_user.role.to_s != "owner" %> | ||
<div class="form-group" id="multiple_tech_leads"> | ||
<%= form.label :tech_leads %> | ||
<a class="float-right text-primary anchor-underline" id="btnAddTechLeads">+ add more</a> | ||
|
||
<% if component.to_s == "new" || @software_record.tech_leads.empty? %> | ||
<div class="input-group mt-2" id="tech_leads1"> | ||
<%= text_field_tag "software_record[tech_leads][]", nil, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('tech_leads1')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% else %> | ||
<% @software_record.tech_leads.each_with_index do |tech_lead, index| %> | ||
<% @id = "tech_leads#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>"> | ||
<%= text_field_tag "software_record[tech_leads][]", tech_lead, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
</div> | ||
<% else %> | ||
<% if @software_record.tech_leads.any? %> | ||
<div class="form-group" id="multiple_tech_leads"> | ||
<% @software_record.tech_leads.each_with_index do |tech_lead, index| %> | ||
<% @id = "tech_leads#{index + 1}" %> | ||
<div class="input-group mt-2" id="<%= @id %>" style="display: none"> | ||
<%= text_field_tag "software_record[tech_leads][]", tech_lead, required: true, class: "form-control" %> | ||
<div class="input-group-append" id="btnRemove" onclick="remove('<%= @id %>')"> | ||
<span class="input-group-text"><i class="fas fa-minus remove"> Delete</i></span> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> | ||
<% end %> | ||
<% end %> | ||
<!-- Multiple Tech Leads ends --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters