Skip to content

Commit 64d5578

Browse files
committed
move ids and labels to pack of constants
1 parent b2a42c5 commit 64d5578

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

R/mod_listings.R

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ TBL <- pack_of_constants( # nolint
1818
REMOVE_ALL_COLS_BUTTON_LABEL = "Remove all variables",
1919
RESET_COLS_DEFAULT_BUTTON_ID = "reset_cols_btn",
2020
RESET_COLS_DEFAULT_BUTTON_LABEL = "Reset to default variables",
21+
RESET_ROWS_ORDER_BUTTON_ID = "reset_row_order_btn",
22+
RESET_ROWS_ORDER_BUTTON_LABEL = "Reset Row Order",
23+
SEARCH_BOX_ID = "search_box",
24+
SEARCH_BOX_LABEL = "Search: ",
2125
SEL_SUB_ID = "selected_subject_id"
2226
)
2327

@@ -82,7 +86,7 @@ listings_UI <- function(module_id) { # nolint
8286
icon = shiny::icon("filter-circle-xmark")
8387
),
8488
shiny::tags[["button"]](
85-
id = ns("reset_order"),
89+
id = ns(TBL$RESET_ROWS_ORDER_BUTTON_ID),
8690
class = "btn btn-default action-button",
8791
"Reset Row Order"
8892
),
@@ -92,14 +96,14 @@ listings_UI <- function(module_id) { # nolint
9296
table.order([]); // reset sorting
9397
table.draw();
9498
});
95-
", ns("reset_order"), ns(TBL$TABLE_ID)))),
99+
", ns(TBL$RESET_ROWS_ORDER_BUTTON_ID), ns(TBL$TABLE_ID)))),
96100
shiny::span(
97101
shiny::tags[["label"]](
98-
"for" = ns("search_box"),
99-
"Search:"
102+
"for" = ns(TBL$SEARCH_BOX_ID),
103+
TBL$SEARCH_BOX_LABEL
100104
),
101105
shiny::tags[["input"]](
102-
id = ns("search_box"),
106+
id = ns(TBL$SEARCH_BOX_ID),
103107
type = "text"
104108
),
105109

@@ -110,7 +114,7 @@ listings_UI <- function(module_id) { # nolint
110114
let table = $('#%s table.dataTable').DataTable();
111115
table.search(this.value).draw();
112116
});",
113-
ns("search_box"), ns(TBL$TABLE_ID)
117+
ns(TBL$SEARCH_BOX_ID), ns(TBL$TABLE_ID)
114118
)
115119
)
116120
),

0 commit comments

Comments
 (0)