recent_view: Rename btn -> button in CSS classes.

This commit is a part of the efforts to rename btn-related classes
and variables to align with Zulip's no-abbreviations policy and
streamline the search results.
This commit is contained in:
Sayam Samal 2024-11-13 19:38:11 +05:30 committed by Tim Abbott
parent 51e042e842
commit 650076b027
5 changed files with 16 additions and 16 deletions

View File

@ -1022,7 +1022,7 @@ export function update_topic_unread_count(message: Message): void {
export function set_filter(filter: string): void { export function set_filter(filter: string): void {
// This function updates the `filters` variable // This function updates the `filters` variable
// after user clicks on one of the filter buttons // after user clicks on one of the filter buttons
// based on `btn-recent-selected` class and current // based on `button-recent-selected` class and current
// set `filters`. // set `filters`.
// Get the button which was clicked. // Get the button which was clicked.
@ -1030,7 +1030,7 @@ export function set_filter(filter: string): void {
`[data-filter="${CSS.escape(filter)}"]`, `[data-filter="${CSS.escape(filter)}"]`,
); );
if ($filter_elem.hasClass("btn-recent-selected")) { if ($filter_elem.hasClass("button-recent-selected")) {
filters.delete(filter); filters.delete(filter);
// If the button was not selected, we add the filter. // If the button was not selected, we add the filter.
} else { } else {
@ -1041,12 +1041,12 @@ export function set_filter(filter: string): void {
} }
function show_selected_filters(): void { function show_selected_filters(): void {
// Add `btn-selected-filter` to the buttons to show // Add `button-recent-selected` to the buttons to show
// which filters are applied. // which filters are applied.
for (const filter of filters) { for (const filter of filters) {
$("#recent_view_filter_buttons") $("#recent_view_filter_buttons")
.find(`[data-filter="${CSS.escape(filter)}"]`) .find(`[data-filter="${CSS.escape(filter)}"]`)
.addClass("btn-recent-selected") .addClass("button-recent-selected")
.attr("aria-checked", "true"); .attr("aria-checked", "true");
} }
} }
@ -1571,7 +1571,7 @@ export function change_focused_element($elt: JQuery, input_key: string): boolean
if ( if (
post_tab_focus_elem.id === "recent_view_search" || post_tab_focus_elem.id === "recent_view_search" ||
post_tab_focus_elem.classList.contains("btn-recent-filters") || post_tab_focus_elem.classList.contains("button-recent-filters") ||
post_tab_focus_elem.classList.contains("dropdown-widget-button") post_tab_focus_elem.classList.contains("dropdown-widget-button")
) { ) {
$current_focus_elem = $(post_tab_focus_elem); $current_focus_elem = $(post_tab_focus_elem);
@ -1648,7 +1648,7 @@ export function change_focused_element($elt: JQuery, input_key: string): boolean
set_table_focus(row_focus, col_focus); set_table_focus(row_focus, col_focus);
return true; return true;
} }
} else if ($elt.hasClass("btn-recent-filters") || $elt.hasClass("dropdown-widget-button")) { } else if ($elt.hasClass("button-recent-filters") || $elt.hasClass("dropdown-widget-button")) {
switch (input_key) { switch (input_key) {
case "click": case "click":
$current_focus_elem = $elt; $current_focus_elem = $elt;
@ -1747,7 +1747,7 @@ export function change_focused_element($elt: JQuery, input_key: string): boolean
} }
if ($current_focus_elem !== "table" && input_key !== "escape") { if ($current_focus_elem !== "table" && input_key !== "escape") {
$current_focus_elem.trigger("focus"); $current_focus_elem.trigger("focus");
if ($current_focus_elem.hasClass("btn-recent-filters")) { if ($current_focus_elem.hasClass("button-recent-filters")) {
compose_closed_ui.set_standard_text_for_reply_button(); compose_closed_ui.set_standard_text_for_reply_button();
} }
return true; return true;
@ -1838,7 +1838,7 @@ export function initialize({
$("body").on("keydown", ".on_hover_topic_read", ui_util.convert_enter_to_click); $("body").on("keydown", ".on_hover_topic_read", ui_util.convert_enter_to_click);
$("body").on("click", ".btn-recent-filters", (e) => { $("body").on("click", ".button-recent-filters", (e) => {
e.stopPropagation(); e.stopPropagation();
if (page_params.is_spectator) { if (page_params.is_spectator) {
// Filter buttons are disabled for spectator. // Filter buttons are disabled for spectator.

View File

@ -509,7 +509,7 @@
background-color: hsl(211deg 18% 25%) !important; background-color: hsl(211deg 18% 25%) !important;
} }
.recent_view_container #recent_view_table .btn-recent-filters { .recent_view_container #recent_view_table .button-recent-filters {
background-color: hsl(211deg 29% 14%); background-color: hsl(211deg 29% 14%);
border-color: hsl(0deg 0% 0%); border-color: hsl(0deg 0% 0%);
color: hsl(0deg 0% 100%); color: hsl(0deg 0% 100%);
@ -530,7 +530,7 @@
} }
} }
.btn-recent-selected, .button-recent-selected,
#recent_view_table thead th { #recent_view_table thead th {
background-color: hsl(228deg 11% 17%) !important; background-color: hsl(228deg 11% 17%) !important;

View File

@ -161,7 +161,7 @@
padding-top: 4px !important; padding-top: 4px !important;
} }
.btn-recent-filters { .button-recent-filters {
border-radius: 40px; border-radius: 40px;
margin: 0 5px 10px 0; margin: 0 5px 10px 0;
@ -181,7 +181,7 @@
} }
} }
.btn-recent-selected { .button-recent-selected {
background-color: hsl(0deg 11% 93%); background-color: hsl(0deg 11% 93%);
} }

View File

@ -1,5 +1,5 @@
{{> ./dropdown_widget widget_name="recent-view-filter"}} {{> ./dropdown_widget widget_name="recent-view-filter"}}
<button data-filter="include_private" type="button" class="btn btn-default btn-recent-filters {{#if is_spectator}}fake_disabled_button{{/if}}" role="checkbox" aria-checked="true"> <button data-filter="include_private" type="button" class="btn btn-default button-recent-filters {{#if is_spectator}}fake_disabled_button{{/if}}" role="checkbox" aria-checked="true">
{{#if filter_pm}} {{#if filter_pm}}
<i class="fa fa-check-square-o"></i> <i class="fa fa-check-square-o"></i>
{{else}} {{else}}
@ -7,7 +7,7 @@
{{/if}} {{/if}}
{{t 'Include DMs' }} {{t 'Include DMs' }}
</button> </button>
<button data-filter="unread" type="button" class="btn btn-default btn-recent-filters {{#if is_spectator}}fake_disabled_button{{/if}}" role="checkbox" aria-checked="false"> <button data-filter="unread" type="button" class="btn btn-default button-recent-filters {{#if is_spectator}}fake_disabled_button{{/if}}" role="checkbox" aria-checked="false">
{{#if filter_unread}} {{#if filter_unread}}
<i class="fa fa-check-square-o"></i> <i class="fa fa-check-square-o"></i>
{{else}} {{else}}
@ -15,7 +15,7 @@
{{/if}} {{/if}}
{{t 'Unread' }} {{t 'Unread' }}
</button> </button>
<button data-filter="participated" type="button" class="btn btn-default btn-recent-filters {{#if is_spectator}}fake_disabled_button{{/if}}" role="checkbox" aria-checked="false"> <button data-filter="participated" type="button" class="btn btn-default button-recent-filters {{#if is_spectator}}fake_disabled_button{{/if}}" role="checkbox" aria-checked="false">
{{#if filter_participated}} {{#if filter_participated}}
<i class="fa fa-check-square-o"></i> <i class="fa fa-check-square-o"></i>
{{else}} {{else}}

View File

@ -772,7 +772,7 @@ test("test_filter_participated", ({mock_template}) => {
// remove muted filter // remove muted filter
rt.set_filter("muted"); rt.set_filter("muted");
$("#recent_view_filter_buttons").removeClass("btn-recent-selected"); $("#recent_view_filter_buttons").removeClass("button-recent-selected");
expected_filter_participated = true; expected_filter_participated = true;