Skip to content

Commit 8a7f2d8

Browse files
authored
Merge pull request #169 from RE-QDA/categories-collapse-expand
Categories collapse expand function addded
2 parents 6334d24 + 4f88e7e commit 8a7f2d8

15 files changed

+620
-336
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: requal
22
Title: Shiny Application for Computer-Assisted Qualitative Data Analysis
3-
Version: 1.2.3
3+
Version: 1.2.3.9002
44
Authors@R:
55
c(
66
person(given = "Radim",

R/mod_about.R

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,39 @@ mod_about_ui <- function(id) {
1212
# Citation info ----
1313
rql_citation <- utils::citation("requal")
1414
# Extract authors
15-
authors <- sapply(as.character(rql_citation$author), function(x) strsplit(x, " ")) # Split the author names into first and last names
15+
authors <- sapply(as.character(rql_citation$author), function(x) {
16+
strsplit(x, " ")
17+
}) # Split the author names into first and last names
1618
# Format the authors as "Last name, Initial."
17-
formatted_authors <- sapply(authors, function(x) paste0(x[2], ", ", substr(x[1], 1, 1), "."))
19+
formatted_authors <- sapply(authors, function(x) {
20+
paste0(x[2], ", ", substr(x[1], 1, 1), ".")
21+
})
1822
# Combine the authors into a single string
1923
author_string <- paste(formatted_authors, collapse = ", ")
2024
year <- rql_citation$year
2125
title <- rql_citation$title
2226
version <- as.character(packageVersion("requal"))
2327
rql_url <- rql_citation$url
2428
# Construct the APA citation
25-
apa_citation <- paste0(author_string, " (", year, "). ", tags$i(title), ". (Version ", version, "). &lt;", rql_url, "&gt;")
29+
apa_citation <- paste0(
30+
author_string,
31+
" (",
32+
year,
33+
"). ",
34+
tags$i(title),
35+
". (Version ",
36+
version,
37+
"). &lt;",
38+
rql_url,
39+
"&gt;"
40+
)
2641
# UI starts here ----
2742
tagList(
2843
h2(
2944
tags$a(
30-
href = "https://requal.fsv.cuni.cz/",
31-
tags$img(src = "www/requal_logo.png", width = "5%"), target = "_blank"
45+
href = "https://requal.app/",
46+
tags$img(src = "www/requal_logo.png", width = "5%"),
47+
target = "_blank"
3248
),
3349
"requal CAQDAS"
3450
),
@@ -37,11 +53,19 @@ mod_about_ui <- function(id) {
3753
p(),
3854
p(
3955
"For help, consult ",
40-
a("requal Wiki", href = "https://github.com/RE-QDA/requal/wiki", target = "_blank"),
56+
a(
57+
"requal Wiki",
58+
href = "https://github.com/RE-QDA/requal/wiki",
59+
target = "_blank"
60+
),
4161
".",
4262
br(),
4363
"Leave feedback on our ",
44-
a("GitHub page", href = "https://github.com/RE-QDA/requal/issues", target = "_blank"),
64+
a(
65+
"GitHub page",
66+
href = "https://github.com/RE-QDA/requal/issues",
67+
target = "_blank"
68+
),
4569
"."
4670
),
4771
p(),
@@ -66,7 +90,8 @@ mod_about_ui <- function(id) {
6690
)
6791
),
6892
p("To cite package", tags$code("requal"), "in publications use:"),
69-
HTML(apa_citation), p(),
93+
HTML(apa_citation),
94+
p(),
7095
p("A BibTeX entry for LaTeX users:"),
7196
tags$pre(paste(utils::toBibtex(utils::citation("requal")), collapse = "\n"))
7297
)
@@ -83,7 +108,9 @@ mod_about_server <- function(id, glob) {
83108
paste0(
84109
"The current project was created with requal version ",
85110
dplyr::tbl(glob$pool, "requal_version") %>%
86-
dplyr::filter(.data$project_id == local(as.numeric(glob$active_project))) %>%
111+
dplyr::filter(
112+
.data$project_id == local(as.numeric(glob$active_project))
113+
) %>%
87114
dplyr::pull(version),
88115
"."
89116
)
@@ -92,7 +119,8 @@ mod_about_server <- function(id, glob) {
92119
output$version_package <- renderText({
93120
paste0(
94121
"The current version of requal package installed is ",
95-
packageVersion("requal"), "."
122+
packageVersion("requal"),
123+
"."
96124
)
97125
})
98126
})

R/mod_analysis.R

Lines changed: 82 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,26 @@ mod_analysis_ui <- function(id) {
1212
tagList(
1313
fluidRow(
1414
class = "module_tools",
15-
div(mod_rql_button_ui(ns("filter_ui"),
15+
mod_rql_button_ui(
16+
ns("filter_ui"),
1617
label = "Filter segments",
1718
icon = "filter"
18-
)) %>% tagAppendAttributes(style = "padding-right: 25px;"),
19-
mod_rql_button_ui(ns("download_ui"),
19+
),
20+
mod_rql_button_ui(
21+
ns("download_ui"),
2022
label = "Download segments",
2123
icon = "download"
2224
)
23-
),
25+
),
2426
fluidRow(
2527
class = "module_content",
26-
uiOutput(ns("segments")) %>%
27-
tagAppendAttributes(class = "scrollable80")
28-
)
28+
uiOutput(ns("segments")) %>%
29+
tagAppendAttributes(class = "scrollable80")
30+
)
2931
# ###########
3032
# column(
3133
# width = 4,
32-
34+
3335
# )
3436
# uiOutput(ns("download"))
3537
# )
@@ -45,64 +47,67 @@ mod_analysis_server <- function(id, glob) {
4547

4648
loc <- reactiveValues()
4749

48-
if (golem::get_golem_options(which = "mode") == "server") {
49-
observeEvent(input$user_filter, {
50-
loc$user_filter <- input$user_filter
51-
})
52-
} else {
53-
# local version does not have user filter UI
54-
# so we set the user filter to 1
55-
# to always select the user in desktop version
56-
loc$user_filter <- 1 # for local version
57-
}
50+
if (golem::get_golem_options(which = "mode") == "server") {
51+
observeEvent(input$user_filter, {
52+
loc$user_filter <- input$user_filter
53+
})
54+
} else {
55+
# local version does not have user filter UI
56+
# so we set the user filter to 1
57+
# to always select the user in desktop version
58+
loc$user_filter <- 1 # for local version
59+
}
5860

59-
# UI ----
61+
# UI ----
6062

6163
#--- Filter UI --------------
62-
mod_rql_button_server(
63-
id = "filter_ui",
64-
custom_title = "Filter segments",
65-
custom_tagList = tagList(
66-
rql_picker_UI(ns("code_filter"),
64+
mod_rql_button_server(
65+
id = "filter_ui",
66+
custom_title = "Filter segments",
67+
custom_tagList = tagList(
68+
rql_picker_UI(
69+
ns("code_filter"),
6770
label = "Filter by code",
6871
choices = "",
6972
multiple = TRUE,
7073
none = "Off"
71-
),
72-
rql_picker_UI(ns("category_filter"),
74+
),
75+
rql_picker_UI(
76+
ns("category_filter"),
7377
label = "Filter by category",
7478
choices = "",
7579
multiple = TRUE,
7680
none = "Off"
77-
),
78-
rql_picker_UI(ns("document_filter"),
81+
),
82+
rql_picker_UI(
83+
ns("document_filter"),
7984
label = "Filter by document",
8085
choices = "",
8186
multiple = TRUE,
8287
none = "Off"
8388
),
8489
if (golem::get_golem_options(which = "mode") == "server") {
85-
rql_picker_UI(ns("user_filter"),
86-
label = "Filter by user",
87-
choices = "",
88-
multiple = TRUE,
89-
none = "Off"
90-
)
90+
rql_picker_UI(
91+
ns("user_filter"),
92+
label = "Filter by user",
93+
choices = "",
94+
multiple = TRUE,
95+
none = "Off"
96+
)
9197
}
92-
),
93-
glob
98+
),
99+
glob
100+
)
101+
# Download UI ----
102+
mod_rql_button_server(
103+
id = "download_ui",
104+
custom_title = "Download segments",
105+
custom_tagList = tagList(
106+
tags$p(mod_download_csv_ui("download_csv_ui_1", "download_analysis")),
107+
tags$p(mod_download_html_ui("download_html_ui_1"))
94108
)
95-
# Download UI ----
96-
mod_rql_button_server(
97-
id = "download_ui",
98-
custom_title = "Download segments",
99-
custom_tagList = tagList(
100-
tags$p(mod_download_csv_ui("download_csv_ui_1", "download_analysis")),
101-
tags$p(mod_download_html_ui("download_html_ui_1"))
102-
)
109+
)
103110

104-
)
105-
106111
# Filters ----
107112

108113
observeEvent(glob$codebook, {
@@ -140,13 +145,15 @@ mod_rql_button_server(
140145
session = session,
141146
"user_filter",
142147
choices = get_user_permissions(
143-
glob$pool,
144-
glob$active_project
145-
) %>% dplyr::pull(user_id, name = "user_name") ,
148+
glob$pool,
149+
glob$active_project
150+
) %>%
151+
dplyr::pull(user_id, name = "user_name"),
146152
selected = get_user_permissions(
147-
glob$pool,
148-
glob$active_project
149-
) %>% dplyr::pull(user_id)
153+
glob$pool,
154+
glob$active_project
155+
) %>%
156+
dplyr::pull(user_id)
150157
)
151158
})
152159

@@ -163,7 +170,7 @@ mod_rql_button_server(
163170
glob$documents,
164171
glob$active_project
165172
),
166-
{
173+
{
167174
loc$temp_df <- load_segments_analysis(
168175
pool = glob$pool,
169176
active_project = as.integer(glob$active_project),
@@ -172,23 +179,23 @@ mod_rql_button_server(
172179
selected_docs = as.integer(input$document_filter),
173180
selected_users = as.integer(loc$user_filter)
174181
)
175-
182+
176183
if (nrow(loc$temp_df) > 0) {
177184
# handle view permissions
178-
if (glob$user$data$analysis_other_view != 1){
179-
loc$temp_df <- loc$temp_df %>%
185+
if (glob$user$data$analysis_other_view != 1) {
186+
loc$temp_df <- loc$temp_df %>%
180187
dplyr::filter(user_id == glob$user$user_id)
181188
}
182-
189+
183190
loc$segments_df <- loc$temp_df %>%
184-
dplyr::left_join(glob$codebook,
185-
by = "code_id"
186-
) %>%
187-
dplyr::left_join(tibble::enframe(glob$documents,
188-
name = "doc_name",
189-
value = "doc_id"
190-
),
191-
by = "doc_id"
191+
dplyr::left_join(glob$codebook, by = "code_id") %>%
192+
dplyr::left_join(
193+
tibble::enframe(
194+
glob$documents,
195+
name = "doc_name",
196+
value = "doc_id"
197+
),
198+
by = "doc_id"
192199
)
193200
} else {
194201
loc$segments_df <- as.data.frame(NULL)
@@ -239,13 +246,20 @@ mod_rql_button_server(
239246
shinyjs::enable("download_csv_ui_1-download", asis = TRUE)
240247
shinyjs::enable("download_html_ui_1-report", asis = TRUE)
241248
glob$segments_df <- loc$segments_df %>%
242-
dplyr::select(doc_name, doc_id, segment_start, segment_end, code_name,
243-
code_id, segment_text, user_name)
249+
dplyr::select(
250+
doc_name,
251+
doc_id,
252+
segment_start,
253+
segment_end,
254+
code_name,
255+
code_id,
256+
segment_text,
257+
user_name
258+
)
244259
glob$segments_taglist <- loc$segments_taglist
245260
} else {
246261
shinyjs::disable("download_csv_ui_1-download", asis = TRUE)
247262
shinyjs::disable("download_html_ui_1-report", asis = TRUE)
248-
249263
}
250264
}
251265
)

R/mod_categories.R

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ mod_categories_ui <- function(id) {
1414
tagList(
1515
fluidRow(
1616
class = "module_tools",
17-
div(
18-
mod_rql_button_ui(
19-
ns("category_create"),
20-
label = "Create category",
21-
icon = "plus"
22-
)
23-
) %>%
24-
tagAppendAttributes(style = "padding-right: 25px;"),
17+
mod_rql_button_ui(
18+
ns("category_create"),
19+
label = "Create category",
20+
icon = "plus"
21+
),
2522
mod_rql_button_ui(
2623
ns("category_delete"),
2724
label = "Delete category",

0 commit comments

Comments
 (0)