Skip to content

Commit b375f26

Browse files
committed
Merge branch 'sv/emancipation-checklist-button-2781' into 6494-volunteer-table
2 parents cb94762 + 380b1e2 commit b375f26

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

app/assets/stylesheets/pages/casa_cases.scss

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ body.casa_cases {
8484
select {
8585
padding: 5px;
8686
}
87+
88+
.emancipation-btn {
89+
padding: 5px 10px;
90+
font-size: 10px;
91+
line-height: 16px;
92+
vertical-align: middle;
93+
}
94+
8795
}
8896

8997
@media only screen and (max-width: screen-sizes.$small) {
@@ -200,4 +208,3 @@ span.select2-selection.select2-selection--single {
200208
span[role=combobox] {
201209
padding-top: 2px;
202210
}
203-

app/decorators/casa_case_decorator.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,13 @@ def successful_contacts_this_week_before(date)
9898
end
9999

100100
def transition_aged_youth
101-
object.in_transition_age? ? "Yes #{CasaCase::TRANSITION_AGE_YOUTH_ICON}" : "No #{CasaCase::NON_TRANSITION_AGE_YOUTH_ICON}"
101+
text = object.in_transition_age? ? "Yes #{CasaCase::TRANSITION_AGE_YOUTH_ICON}" : "No #{CasaCase::NON_TRANSITION_AGE_YOUTH_ICON}"
102+
if object.in_transition_age?
103+
badge_html = h.render(partial: "shared/emancipation_link", locals: {casa_case: object})
104+
h.safe_join([text, " ", badge_html])
105+
else
106+
text
107+
end
102108
end
103109

104110
def transition_aged_youth_icon

app/javascript/src/dashboard.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ $(() => { // JQuery's callback for the DOM loading
7272
return statusArray.includes(status) &&
7373
assignedToVolunteerArray.includes(assignedToVolunteer) &&
7474
assignedToMoreThanOneVolunteerArray.includes(assignedToMoreThanOneVolunteer) &&
75-
assignedToTransitionYouthArray.includes(assignedToTransitionYouth) &&
75+
assignedToTransitionYouthArray.some(filterValue =>
76+
assignedToTransitionYouth.toLowerCase().includes(filterValue.toLowerCase().replace(/[^a-zA-Z]/g, ''))
77+
) &&
7678
caseNumberPrefixArray.includes(caseNumberPrefix)
7779
}
7880
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<%= link_to(casa_case_emancipation_path(casa_case.id),
2+
class: "main-btn primary-btn btn-sm emancipation-btn") do %>
3+
Emancipation
4+
<%= render BadgeComponent.new(text: casa_case.decorate.emancipation_checklist_count,
5+
type: :light,
6+
margin: false) %>
7+
<% end %>

spec/decorators/casa_case_decorator_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@
6363
end
6464

6565
it "returns transition age youth status with icon if over 14 years old" do
66-
casa_case = build(:casa_case, birth_month_year_youth: CasaCase::TRANSITION_AGE.years.ago)
66+
casa_case = build_stubbed(:casa_case, birth_month_year_youth: CasaCase::TRANSITION_AGE.years.ago)
6767
expect(casa_case.decorate.transition_aged_youth)
68-
.to eq "Yes #{CasaCase::TRANSITION_AGE_YOUTH_ICON}"
68+
.to include "Yes #{CasaCase::TRANSITION_AGE_YOUTH_ICON}"
69+
expect(casa_case.decorate.transition_aged_youth).to include "Emancipation"
6970
end
7071

7172
it "returns non-transition age youth status with icon if not over 14 years old" do

0 commit comments

Comments
 (0)