buddy_list: Refactor section toggle to not need custom classname.

This commit is contained in:
evykassirer 2024-10-28 16:32:25 -07:00 committed by Tim Abbott
parent f29083f2ef
commit ec1b265ff8
2 changed files with 7 additions and 10 deletions

View File

@ -452,7 +452,6 @@ export class BuddyList extends BuddyListConf {
id: "buddy-list-participants-section-heading",
header_text: $t({defaultMessage: "In this conversation"}),
user_count: get_formatted_sub_count(this.participant_user_ids.length),
toggle_class: "toggle-participants",
is_collapsed: this.participants_is_collapsed,
}),
),
@ -466,7 +465,6 @@ export class BuddyList extends BuddyListConf {
user_count: get_formatted_sub_count(
total_human_subscribers_count - this.participant_user_ids.length,
),
toggle_class: "toggle-users-matching-view",
is_collapsed: this.users_matching_view_is_collapsed,
}),
),
@ -478,7 +476,6 @@ export class BuddyList extends BuddyListConf {
id: "buddy-list-other-users-section-heading",
header_text: $t({defaultMessage: "Others"}),
user_count: get_formatted_sub_count(other_users_count),
toggle_class: "toggle-other-users",
is_collapsed: this.other_users_is_collapsed,
}),
),
@ -491,11 +488,11 @@ export class BuddyList extends BuddyListConf {
"collapsed",
this.participants_is_collapsed,
);
$("#buddy-list-participants-container .toggle-participants").toggleClass(
$("#buddy-list-participants-container .buddy-list-section-toggle").toggleClass(
"rotate-icon-down",
!this.participants_is_collapsed,
);
$("#buddy-list-participants-container .toggle-participants").toggleClass(
$("#buddy-list-participants-container .buddy-list-section-toggle").toggleClass(
"rotate-icon-right",
this.participants_is_collapsed,
);
@ -511,11 +508,11 @@ export class BuddyList extends BuddyListConf {
"collapsed",
this.users_matching_view_is_collapsed,
);
$("#buddy-list-users-matching-view-container .toggle-users-matching-view").toggleClass(
$("#buddy-list-users-matching-view-container .buddy-list-section-toggle").toggleClass(
"rotate-icon-down",
!this.users_matching_view_is_collapsed,
);
$("#buddy-list-users-matching-view-container .toggle-users-matching-view").toggleClass(
$("#buddy-list-users-matching-view-container .buddy-list-section-toggle").toggleClass(
"rotate-icon-right",
this.users_matching_view_is_collapsed,
);
@ -531,11 +528,11 @@ export class BuddyList extends BuddyListConf {
"collapsed",
this.other_users_is_collapsed,
);
$("#buddy-list-other-users-container .toggle-other-users").toggleClass(
$("#buddy-list-other-users-container .buddy-list-section-toggle").toggleClass(
"rotate-icon-down",
!this.other_users_is_collapsed,
);
$("#buddy-list-other-users-container .toggle-other-users").toggleClass(
$("#buddy-list-other-users-container .buddy-list-section-toggle").toggleClass(
"rotate-icon-right",
this.other_users_is_collapsed,
);

View File

@ -1,4 +1,4 @@
<h5 id="{{id}}" data-user-count="{{user_count}}" class="buddy-list-heading no-style hidden-for-spectators">
{{header_text}} (<span class="buddy-list-heading-user-count">{{user_count}}</span>)
</h5>
<i class="buddy-list-section-toggle {{toggle_class}} fa fa-sm fa-caret-right {{#if is_collapsed}}rotate-icon-right{{else}}rotate-icon-down{{/if}}" aria-hidden="true"></i>
<i class="buddy-list-section-toggle fa fa-sm fa-caret-right {{#if is_collapsed}}rotate-icon-right{{else}}rotate-icon-down{{/if}}" aria-hidden="true"></i>