Skip to content

Commit 4724bc7

Browse files
committed
Cleanup after condtions/_form refactor
- ` action_type_arr` and `remove_question_group` are only needed in `conditions/_new_condition_form.erb`. The assignments have been moved directly to that partial. - - ` view_email_content_info` is only needed in `conditions/_new_condition_form.erb`. The assignment has been moved directly to that partial.
1 parent 3a11067 commit 4724bc7

3 files changed

Lines changed: 17 additions & 21 deletions

File tree

app/views/org_admin/conditions/_existing_condition_display.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<%
22
qopt = condition[:question_option_id].any? ? QuestionOption.find_by(id: condition[:question_option_id].first): nil
33
rquesArray = condition[:remove_question_id].any? ? Question.where(id: condition[:remove_question_id]) : nil
4+
view_email_content_info = _("Hover over the email address to view email content. To change email details you need to remove and add the condition again.")
45
%>
56
<div class="col-md-3 pe-2">
67
<%= qopt[:text]&.slice(0, 25) %>

app/views/org_admin/conditions/_form.html.erb

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,40 +3,29 @@
33
- app/views/org_admin/conditions/_container.html.erb
44
%>
55

6-
<% condition ||= nil %>
7-
86
<div class="row condition-partial mb-3">
97
<%
10-
action_type_arr = [["removes", :remove], ["adds notification", :add_webhook]]
8+
condition ||= nil
119
name_start = "conditions[#{condition_no.to_s}]"
12-
remove_question_collection = later_question_list(question)
13-
remove_question_group = grouped_options_for_select(remove_question_collection)
14-
view_email_content_info = _("Hover over the email address to view email content. To change email details you need to remove and add the condition again.")
1510
%>
1611

1712
<%# If this is a new condition then display the interactive controls. otherwise just display the logic %>
1813
<% if condition.nil? %>
1914
<%= render partial: 'org_admin/conditions/new_condition_form',
20-
locals: { action_type_arr: action_type_arr,
21-
condition_no: condition_no,
22-
question: question,
15+
locals: { condition_no: condition_no,
2316
name_start: name_start,
24-
remove_question_group: remove_question_group,
25-
view_email_content_info: view_email_content_info
17+
question: question
2618
}
2719
%>
2820

2921
<% else %>
30-
<%= render partial: 'org_admin/conditions/existing_condition_display',
31-
locals: { action_type_arr: action_type_arr,
32-
condition: condition,
33-
condition_no: condition_no,
34-
name_start: name_start,
35-
question: question,
36-
remove_question_group: remove_question_group,
37-
view_email_content_info: view_email_content_info
38-
}
39-
%>
22+
<%= render partial: 'org_admin/conditions/existing_condition_display',
23+
locals: { condition: condition,
24+
condition_no: condition_no,
25+
name_start: name_start,
26+
question: question
27+
}
28+
%>
4029

4130
<% end %>
4231
</div>

app/views/org_admin/conditions/_new_condition_form.erb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<%
2+
action_type_arr = [["removes", :remove], ["adds notification", :add_webhook]]
3+
remove_question_collection = later_question_list(question)
4+
remove_question_group = grouped_options_for_select(remove_question_collection)
5+
%>
6+
17
<div class="form-label bold">Add condition</div>
28
<div class="row mb-3">
39
<div class="col-md-9 pe-2">

0 commit comments

Comments
 (0)