From 958038b3fd7749aa4357640487fa09e9e39abf7f Mon Sep 17 00:00:00 2001 From: Gede Primahadi Wijaya Rajeg Date: Sat, 10 Aug 2024 14:30:54 +0800 Subject: [PATCH 1/5] Add one search all with enter but failed to prevent enter in the 'Search' panel. --- enolex/app.R | 96 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 91 insertions(+), 5 deletions(-) diff --git a/enolex/app.R b/enolex/app.R index 3c9e221..d633b06 100644 --- a/enolex/app.R +++ b/enolex/app.R @@ -111,6 +111,32 @@ english_gloss <- selectizeInput(inputId = "English_Gloss", selected = NULL ) +js_enter_key <- ' +$(document).on("keyup", function(e) { + if((e.keyCode == 13)){ + Shiny.onInputChange("keyPressed", Math.random()); + } +});' + +# js_enter_key <- '$(document).keyup(function(event) { +# if ($("#site_search").is(":focus") && (event.key == "Enter")) { +# $("#goButton").click(); +# } +# });' + +# js_enter_key <- ' +# $(document).ready(function() { +# $(window).keydown(function(event){ +# if(event.keyCode == 13) { +# event.preventDefault(); +# return false; +# } +# }); +# }); +# ' + +# one_search_all <- textInput("searchbar", label = "Search", placeholder = "Type & press Enter") + link_enolex_github <- tags$a(shiny::icon("github"), "GitHub", href="https://github.com/engganolang/enolex", target="_blank") @@ -128,7 +154,7 @@ bibs <- selectizeInput(inputId = "References", ## MAIN page ==== cards <- list( background_image = - card(card_image("estuary.JPG", border_radius = "none"), + card(card_image("estuary.JPG", border_radius = "none", height = "255px"), card_footer("The estuary towards the Indian Ocean from the Bak Blau lake, Enggano Island", class = "fs-6; fw-lighter; blockquote-footer; border-0"), class = "border-0") @@ -147,7 +173,11 @@ cards <- list( p("EnoLEX collates lexical data from", actionLink("SourcesTabLink", "legacy materials and contemporary fieldwork data"), "about the Enggano language, ranging from simple/short and extensive word lists, anthropological and ethnographic writings, a dictionary, thesis, and contemporary Enggano data. The materials span over 150 years from the middle of the 19th century up to the present. With expert cognate-judgement, EnoLEX offers historical development of word forms expressing a certain concept/meaning."), h2("How to get started"), - p("Users can go to the", actionLink("CognatesTabLink", "Search"), "tab and then, from the left-hand side sidebar, select the concept to filter forms expressing that concept and how they develop across periods."), + p("The first option is that users can go to the", actionLink("CognatesTabLink", "Search"), "tab and then, from the left-hand side sidebar, select the concept to filter forms expressing that concept and how they develop across periods."), + p("The second option is a gloabal search by entering any search term (e.g., Indonesian translation, Enggano form, English, etc.) in the search field below. Then, the app will filter from the database any observation whose columns contain the typed value."), + # tags$input(type = "search", id = "site_search", name = "q", placeholder = "Type and Enter"), + tags$script(js_enter_key), + textInput(inputId = "site_search", label = "Search", placeholder = "Type and Enter"), h2("Licensing"), HTML('

EnoLEX edited by Daniel Krauße, Gede Primahadi W. Rajeg, Cokorda Pramartha, Erik Zoebel, Charlotte Hemmings, I Wayan Arka, and Mary Dalrymple is licensed under Creative Commons Attribution-NonCommercial 4.0 International

') @@ -166,7 +196,7 @@ cards <- list( ## COGNATES page ==== cognate_cards <- list( cognate_table = card( - layout_sidebar(sidebar = sidebar(english_gloss, + layout_sidebar(sidebar = sidebar(english_gloss, open = list(mobile = "always-above"), width = 200), div(DT::DTOutput(outputId = "cognatesOut"), @@ -195,6 +225,7 @@ cognate_cards <- list( ui <- page_navbar( id = "tabs", fillable = TRUE, + # footer = "
", theme = bs_theme( version = bslib::version_default(), bootswatch = "cosmo", @@ -212,7 +243,7 @@ ui <- page_navbar( nav_panel(title = "Main", layout_columns( - + cards[["enolex_description"]], layout_columns( @@ -249,7 +280,10 @@ ui <- page_navbar( ), nav_menu(title = "Links", nav_item(link_enolex_github), - nav_item(link_enggano_web)) + nav_item(link_enggano_web)), + nav_panel_hidden(value = "Global Search Results", + div(DT::DTOutput(outputId = "global_search_table"), + style = "font-size: 96%")) ) server <- function(input, output, session) { @@ -258,6 +292,58 @@ server <- function(input, output, session) { updateSelectizeInput(session, inputId = "References", choices = bib_choices, server = TRUE) + ### reactive output for Global Search ===== + globalsearch_tb <- eventReactive(input[["keyPressed"]], + + { + search_pattern <- str_c("\\b", input$site_search, "\\b", sep = "") + tb <- elx |> + filter(if_any(where(is.character), ~str_detect(., search_pattern))) |> + select(Cognate_ID, Year, Sources, Original_Form, Standardised_Orthography = Orthography, + Phonemic_Transcription = IPA) + # select(where(function(x) any(grepl(search_pattern, x, perl = TRUE)))) + + cog_id_colouring <- unique(tb$Cognate_ID) + + DT::datatable(tb, + escape = FALSE, + selection = "single", + options = list(paging = FALSE, + scrollY = "500px", + scrollX = TRUE, + autoWidth = TRUE, + columnDefs = list(list(className = "dt-center", + targets = c(1, 2)), + list(width = "50px", + targets = "Cognate_ID"), + list(width = "50px", + targets = "Year"))), + filter = "top", + style = "bootstrap4", + class = list(stripe = FALSE)) |> + formatStyle("Cognate_ID", + backgroundColor = styleEqual(cog_id_colouring, + colour_values(factor(cog_id_colouring), + palette = "rdylbu", + alpha = 65))) + + + } + + ) + observeEvent(globalsearch_tb(), + { + req(nrow(globalsearch_tb()$x$data) > 0) + output$global_search_table <- DT::renderDT(globalsearch_tb()) + nav_select("tabs", "Global Search Results") + updateTextInput(session = session, inputId = "site_search", value = "") + + # output$table_out <- renderTable(subset(df, grepl(input$searchbar, Species))) + # updateNavbarPage(session = session, inputId = "my_panel", + # selected = "data") + + }) + ### reactive output for COGNATE Table ==== notes <- reactive( From b85f9c0d7010717bcefaab65e7ca519d46cc9bad Mon Sep 17 00:00:00 2001 From: Gede Primahadi Wijaya Rajeg Date: Sat, 10 Aug 2024 22:18:45 +0800 Subject: [PATCH 2/5] Add new panel for Global Search plus fix error for Indonesian translation card. --- enolex/app.R | 130 +++++++++++++++++++++++++++------------------------ 1 file changed, 68 insertions(+), 62 deletions(-) diff --git a/enolex/app.R b/enolex/app.R index d633b06..76da860 100644 --- a/enolex/app.R +++ b/enolex/app.R @@ -111,6 +111,24 @@ english_gloss <- selectizeInput(inputId = "English_Gloss", selected = NULL ) +jscode <- ' +$(function() { + var $els = $("[data-proxy-click]"); + $.each( + $els, + function(idx, el) { + var $el = $(el); + var $proxy = $("#" + $el.data("proxyClick")); + $el.keydown(function (e) { + if (e.keyCode == 13) { + $proxy.click(); + } + }); + } + ); +}); +' + js_enter_key <- ' $(document).on("keyup", function(e) { if((e.keyCode == 13)){ @@ -173,11 +191,17 @@ cards <- list( p("EnoLEX collates lexical data from", actionLink("SourcesTabLink", "legacy materials and contemporary fieldwork data"), "about the Enggano language, ranging from simple/short and extensive word lists, anthropological and ethnographic writings, a dictionary, thesis, and contemporary Enggano data. The materials span over 150 years from the middle of the 19th century up to the present. With expert cognate-judgement, EnoLEX offers historical development of word forms expressing a certain concept/meaning."), h2("How to get started"), - p("The first option is that users can go to the", actionLink("CognatesTabLink", "Search"), "tab and then, from the left-hand side sidebar, select the concept to filter forms expressing that concept and how they develop across periods."), - p("The second option is a gloabal search by entering any search term (e.g., Indonesian translation, Enggano form, English, etc.) in the search field below. Then, the app will filter from the database any observation whose columns contain the typed value."), + p("The first option is the", actionLink("CognatesTabLink", "Concept Search"), "tab and then, from the left-hand side sidebar, select the concept to filter forms expressing that concept and how they develop across periods."), + p("The second option is the", actionLink("GlobalSearch", "Global Search"), "tab to entering any search term (e.g., Indonesian translation, Enggano form, English, etc.) in the search box there. Then, the app will filter from the database any observation whose columns contain the typed value."), # tags$input(type = "search", id = "site_search", name = "q", placeholder = "Type and Enter"), - tags$script(js_enter_key), - textInput(inputId = "site_search", label = "Search", placeholder = "Type and Enter"), + # tags$script(js_enter_key), + # tags$script(jscode), + # textInput(inputId = "site_search", label = "Search", placeholder = "Type and Enter"), + + # fluidRow( + # column(11, tagAppendAttributes(textInput("site_search", label = " ", width = "60%", placeholder = "Type"), + # `data-proxy-click` = "btn")), + # column(1, div( style = "margin-top: 24px; margin-left: -210px", actionButton("btn", "Search")))), h2("Licensing"), HTML('

EnoLEX edited by Daniel Krauße, Gede Primahadi W. Rajeg, Cokorda Pramartha, Erik Zoebel, Charlotte Hemmings, I Wayan Arka, and Mary Dalrymple is licensed under Creative Commons Attribution-NonCommercial 4.0 International

') @@ -193,6 +217,19 @@ cards <- list( #) ) +## GLOBAL search page ==== +full_db_page <- list( + db_table = card( + layout_sidebar( + sidebar = sidebar(textInput("global_search", label = "Database search", width = 150), + open = list(mobile = "always-above"), + width = 200), + div(DT::DTOutput(outputId = "global_search_output"), + style = "font-size: 95%") + ) + ) +) + ## COGNATES page ==== cognate_cards <- list( cognate_table = card( @@ -256,7 +293,7 @@ ui <- page_navbar( ) ), - nav_panel(title = "Search", + nav_panel(title = "Concept Search", layout_columns( @@ -273,6 +310,10 @@ ui <- page_navbar( ) ), + nav_panel(title = "Global Search", + layout_columns( + full_db_page[["db_table"]] + )), nav_panel(title = "Sources", div(DT::DTOutput(outputId = "enolex_materials"), style = "font-size: 96%") @@ -280,10 +321,7 @@ ui <- page_navbar( ), nav_menu(title = "Links", nav_item(link_enolex_github), - nav_item(link_enggano_web)), - nav_panel_hidden(value = "Global Search Results", - div(DT::DTOutput(outputId = "global_search_table"), - style = "font-size: 96%")) + nav_item(link_enggano_web)) ) server <- function(input, output, session) { @@ -292,57 +330,6 @@ server <- function(input, output, session) { updateSelectizeInput(session, inputId = "References", choices = bib_choices, server = TRUE) - ### reactive output for Global Search ===== - globalsearch_tb <- eventReactive(input[["keyPressed"]], - - { - search_pattern <- str_c("\\b", input$site_search, "\\b", sep = "") - tb <- elx |> - filter(if_any(where(is.character), ~str_detect(., search_pattern))) |> - select(Cognate_ID, Year, Sources, Original_Form, Standardised_Orthography = Orthography, - Phonemic_Transcription = IPA) - # select(where(function(x) any(grepl(search_pattern, x, perl = TRUE)))) - - cog_id_colouring <- unique(tb$Cognate_ID) - - DT::datatable(tb, - escape = FALSE, - selection = "single", - options = list(paging = FALSE, - scrollY = "500px", - scrollX = TRUE, - autoWidth = TRUE, - columnDefs = list(list(className = "dt-center", - targets = c(1, 2)), - list(width = "50px", - targets = "Cognate_ID"), - list(width = "50px", - targets = "Year"))), - filter = "top", - style = "bootstrap4", - class = list(stripe = FALSE)) |> - formatStyle("Cognate_ID", - backgroundColor = styleEqual(cog_id_colouring, - colour_values(factor(cog_id_colouring), - palette = "rdylbu", - alpha = 65))) - - - } - - ) - observeEvent(globalsearch_tb(), - { - req(nrow(globalsearch_tb()$x$data) > 0) - output$global_search_table <- DT::renderDT(globalsearch_tb()) - nav_select("tabs", "Global Search Results") - updateTextInput(session = session, inputId = "site_search", value = "") - - # output$table_out <- renderTable(subset(df, grepl(input$searchbar, Species))) - # updateNavbarPage(session = session, inputId = "my_panel", - # selected = "data") - - }) ### reactive output for COGNATE Table ==== notes <- reactive( @@ -512,6 +499,21 @@ server <- function(input, output, session) { }) + global_search <- reactive({ + + elx |> + filter(if_any(where(is.character), ~str_detect(., str_c("\\b", input$global_search, "\\b", sep = "")))) |> + select(where(function(x) any(!is.na(x)))) |> + select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon) |> + datatable(escape = FALSE) + + }) + + output$global_search_output <- DT::renderDT({ + req(nchar(input$global_search) > 0) + global_search() + }) + materials_table <- reactive( { DT::datatable(bibs1, @@ -561,7 +563,7 @@ server <- function(input, output, session) { idn_notes <- idn_orth |> group_by(Indonesian, Sources) |> - mutate(forms = str_c("", Standardised_Orthography = Orthography, "", sep = "")) |> + mutate(forms = str_c("", Standardised_Orthography, "", sep = "")) |> mutate(forms = str_c(forms, collapse = ", ")) |> group_by(Sources, Indonesian) |> mutate(forms = str_c(forms, " (", Sources, ")", sep = "")) |> @@ -680,7 +682,11 @@ server <- function(input, output, session) { # the following code run the clicking on Search hyperlink the main panel/page observeEvent(input$CognatesTabLink, { - updateTabsetPanel(session = session, "tabs", "Search") + updateTabsetPanel(session = session, "tabs", "Concept Search") + }) + + observeEvent(input$GlobalSearch, { + updateTabsetPanel(session = session, "tabs", "Global Search") }) # the following code run the clicking on Sources hyperlink the main panel/page From 48e7d6ef2fe944f22225d59b2df241a63d6958a6 Mon Sep 17 00:00:00 2001 From: Gede Primahadi Wijaya Rajeg Date: Sun, 11 Aug 2024 08:09:16 +0800 Subject: [PATCH 3/5] Update code for the datatable in the global search. --- enolex/app.R | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/enolex/app.R b/enolex/app.R index 76da860..3a894c0 100644 --- a/enolex/app.R +++ b/enolex/app.R @@ -83,6 +83,11 @@ bibs <- bibs |> left_join(form_count) |> left_join(dialect_info) +### join dialect info into EnoLEX +elx <- elx |> + left_join(dialect_info) |> + select(-Doculect) + ## Prepare the choice for the English concept elx_eng <- sort(unique(elx$English), decreasing = FALSE) sem_choices_eng <- c("(none)", elx_eng) @@ -504,8 +509,27 @@ server <- function(input, output, session) { elx |> filter(if_any(where(is.character), ~str_detect(., str_c("\\b", input$global_search, "\\b", sep = "")))) |> select(where(function(x) any(!is.na(x)))) |> - select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon) |> - datatable(escape = FALSE) + select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates) |> + datatable(escape = FALSE, + selection = "single", + options = list(paging = FALSE, + scrollY = "500px", + scrollX = TRUE, + autoWidth = TRUE, + columnDefs = list(list(className = "dt-center", + targets = c(1, 2)), + list(width = "50px", + targets = "Cognate_ID"), + list(width = "50px", + targets = "Year"))), + filter = "top", + style = "bootstrap4", + class = list(stripe = FALSE)) # |> + # formatStyle("Cognate_ID", + # backgroundColor = styleEqual(cog_id_colouring, + # colour_values(factor(cog_id_colouring), + # palette = "rdylbu", + # alpha = 65))) }) From 9400d0142574d6369743faf08981a73608adfa13 Mon Sep 17 00:00:00 2001 From: Gede Primahadi Wijaya Rajeg Date: Sun, 11 Aug 2024 22:41:48 +0800 Subject: [PATCH 4/5] Commit before merge. --- enolex/app.R | 204 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 190 insertions(+), 14 deletions(-) diff --git a/enolex/app.R b/enolex/app.R index 3c9e221..bd14377 100644 --- a/enolex/app.R +++ b/enolex/app.R @@ -8,6 +8,8 @@ library(colourvalues) year_arranged <- c("< 1855", "1854", "1855", "1864", "1870", "1878", "1879", "1888", "1891", "1894", "1916", "1979", "1982", "1987", "2011", "2019", "2022") + +## Read in the main data for Sources ==== bibs <- read_rds("sources.rds") |> filter(BIBTEXKEY != "NothoferMS") |> mutate(YEAR = replace(YEAR, YEAR == "n.d.", "< 1855")) |> @@ -16,9 +18,22 @@ bibs <- read_rds("sources.rds") |> mutate(Sources = str_replace(Sources, "et al\\. 2023", "et al. 2022")) |> mutate(Sources = replace(Sources, Sources == "vd Straten & S. 1855", "vd Straaten & Severijn 1855")) -## Read in the main data +## Read in the main data for EnoLEX ==== elx <- read_rds("enolex.rds") |> - mutate(Sources = replace(Sources, Sources == "vd Straten & S. 1855", "vd Straaten & Severijn 1855")) |> + mutate(Sources = replace(Sources, + Sources == "vd Straten & S. 1855", + "vd Straaten & Severijn 1855") + ) |> + mutate(Sources = replace(Sources, + Sources == "Stockhof 1987", + "Stokhof 1987") + ) |> + mutate(Note_for_Year = if_else(str_detect(Note_for_Year, '^[^" ]+?"'), + str_replace(Note_for_Year, + '(^[^" ]+?")', + '"\\1'), + Note_for_Year) + ) |> mutate(Etymology_Source = str_replace_all(Etymology_Source, "^(Lafeber)(1922)", "\\1 \\2"), Etymology_Source = str_replace_all(Etymology_Source, @@ -55,7 +70,7 @@ elx <- read_rds("enolex.rds") |> "(Mahdi )(1988)", "\\1\\2")) -## Dialect by sources +## Dialect by sources ====== dialect_info <- elx |> select(Sources, Doculect) |> distinct() |> @@ -66,28 +81,177 @@ dialect_info <- elx |> "Enggano Meok"), Dialect_Info = replace(Dialect_Info, Dialect_Info == "Enggano", - "Enggano (unspec.)")) |> + "?")) |> + mutate(Dialect_Info = replace(Dialect_Info, + Sources %in% c("Helfrich & Pieters 1891") & + Dialect_Info == "Enggano Kèfoe", + "Southeast"), + Dialect_Info = replace(Dialect_Info, + Sources %in% c("Helfrich & Pieters 1891") & + Dialect_Info == "Enggano Barohia", + "Northwest")) |> group_by(Sources) |> mutate(Dialect_Info = str_c(Dialect_Info, collapse = " ; ")) |> ungroup() |> - distinct() + distinct() |> + mutate(Place = "?") |> + mutate(Dialect_Info = replace(Dialect_Info, + Sources == "Brouwer <1855", + "Northwest"), + Place = replace(Place, + Sources == "Brouwer <1855", + "Barhau"), + + Dialect_Info = replace(Dialect_Info, + Sources == "vd Straaten & Severijn 1855", + "Northwest"), + Place = replace(Place, + Sources == "vd Straaten & Severijn 1855", + "Karkau"), + + Dialect_Info = replace(Dialect_Info, + Sources == "v. Rosenberg 1855", + "Northwest or South"), + Place = replace(Place, + Sources == "v. Rosenberg 1855", + "Barhau"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Francis 1870", + "Northwest"), + Place = replace(Place, + Sources == "Francis 1870", + "Barhau?"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Helfrich 1888", + "South"), + Place = replace(Place, + Sources == "Helfrich 1888", + "Kioyo"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Modigliani 1894", + "Southeast?"), + Place = replace(Place, + Sources == "Modigliani 1894", + "Kayaapu"), + + Place = replace(Place, + Sources == "Helfrich & Pieters 1891", + "Pulau Dua ; Karkua"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Stokhof 1987", + "Southeast?"), + Place = replace(Place, + Sources == "Stokhof 1987", + "Pulau Dua"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Helfrich 1916", + "Southeast ; Northwest"), + Place = replace(Place, + Sources == "Helfrich 1916", + "Pulau Dua ; Karkua"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Kähler 1987", + "South"), + Place = replace(Place, + Sources == "Kähler 1987", + "Kioyo"), + + Dialect_Info = replace(Dialect_Info, + Sources == "Kasim et al. 1987", + "West"), + Place = replace(Place, + Sources == "Kasim et al. 1987", + "Malakoni ; Banjar Sari"), + + Dialect_Info = replace(Dialect_Info, + Sources %in% c("Zakaria et al. 2022", + "Aron 2019", + "Yoder 2011"), + "West"), + Place = replace(Place, + Sources %in% c("Zakaria et al. 2022", + "Aron 2019", + "Yoder 2011"), + "Meok"), + + Dialect_Info = str_replace(Dialect_Info, + "^Enggano ", + "")) |> + mutate(Collected = "-", + Collected = replace(Collected, + Sources %in% c("Brouwer <1855"), + "ca. 1850"), + Collected = replace(Collected, + Sources %in% c("Boewang 1854"), + "1840-1850"), + Collected = replace(Collected, + Sources %in% c("vd Straaten & Severijn 1855"), + "1854"), + Collected = replace(Collected, + Sources %in% c("v. Rosenberg 1855"), + "1852"), + Collected = replace(Collected, + Sources %in% c("Walland 1864"), + "1863"), + Collected = replace(Collected, + Sources %in% c("Francis 1870"), + "1865-1870"), + Collected = replace(Collected, + Sources %in% c("Helfrich 1888"), + "1885"), + Collected = replace(Collected, + Sources %in% c("Helfrich & Pieters 1891"), + "1891"), + Collected = replace(Collected, + Sources %in% c("Modigliani 1894"), + "1891"), + Collected = replace(Collected, + Sources %in% c("Stokhof 1987"), + "1895"), + Collected = replace(Collected, + Sources %in% c("Helfrich 1916"), + "1891"), + Collected = replace(Collected, + Sources %in% c("Amran et al. 1979"), + "1978"), + Collected = replace(Collected, + Sources %in% c("Kähler 1987"), + "1937-1938"), + Collected = replace(Collected, + Sources %in% c("Kasim et al. 1987"), + "1983?"), + Collected = replace(Collected, + Sources %in% c("Yoder 2011"), + "2010"), + Collected = replace(Collected, + Sources %in% c("Aron 2019"), + "2019"), + Collected = replace(Collected, + Sources %in% c("Zakaria et al. 2022"), + "2022")) -## count the forms by sources +## Count the forms by sources ===== form_count <- elx |> select(Sources, Original_Form) |> group_by(Sources) |> summarise(Count_of_Original_Form = n_distinct(Original_Form)) -### join the count and dialect info with bibs +### Join the count and dialect info with bibs ===== bibs <- bibs |> left_join(form_count) |> left_join(dialect_info) -## Prepare the choice for the English concept +## Prepare the choice for the English concept ===== elx_eng <- sort(unique(elx$English), decreasing = FALSE) sem_choices_eng <- c("(none)", elx_eng) -## Prepare the choice for the Sources +## Prepare the choice for the Sources ===== bib_choices <- c("(none)", bibs$Sources) bibs1 <- select(bibs, @@ -102,7 +266,7 @@ bibs1 <- select(bibs, "URL"), CITATION)) |> rename(YEAR = YEAR_URL) |> - select(Year = YEAR, Sources, Form_Count = Count_of_Original_Form, Dialect_Info, Citation = CITATION) + select(Collected, Published = YEAR, Sources, Form_Count = Count_of_Original_Form, Dialect = Dialect_Info, Place, Citation = CITATION) english_gloss <- selectizeInput(inputId = "English_Gloss", options = list(dropdownParent = "body"), @@ -249,7 +413,11 @@ ui <- page_navbar( ), nav_menu(title = "Links", nav_item(link_enolex_github), - nav_item(link_enggano_web)) + nav_item(link_enggano_web)) #, + # nav_panel(value = "search_panel", + # textInput("global_search", + # label = NULL, + # value = "Search")) ) server <- function(input, output, session) { @@ -374,6 +542,7 @@ server <- function(input, output, session) { scrollY = "500px", scrollX = TRUE, autoWidth = TRUE, + language = list(searchPlaceholder = "Search"), columnDefs = list(list(className = "dt-center", targets = c(1, 2)), list(width = "50px", @@ -381,6 +550,7 @@ server <- function(input, output, session) { list(width = "50px", targets = "Year"))), filter = "top", + # callback=JS('$(\'div.has-feedback input[type="search"]\').attr( "placeholder", "Search" )'), style = "bootstrap4", class = list(stripe = FALSE)) |> formatStyle("Cognate_ID", @@ -435,16 +605,22 @@ server <- function(input, output, session) { options = list(paging = FALSE, scrollY = "500px", scrollX = TRUE, - # autoWidth = TRUE, + language = list(searchPlaceholder = "Search"), + autoWidth = TRUE, columnDefs = list(list(className = "dt-center", - targets = c(1, 3)), + targets = c(1:4)), list(width = "50px", - targets = "Year"), + targets = c("Published", "Collected")), list(width = "60px", targets = "Form_Count"), + list(width = "140px", + targets = "Dialect"), + list(width = "140px", + targets = "Place"), list(width = "170px", targets = "Sources"))), filter = "top", + # callback=JS('$(\'div.has-feedback input[type="search"]\').attr( "placeholder", "Search" )'), style = "bootstrap4", class = list(stripe = FALSE)) } From 6c803b906596491b7779093afc6a3cab966b95a2 Mon Sep 17 00:00:00 2001 From: Gede Primahadi Wijaya Rajeg Date: Mon, 12 Aug 2024 15:56:29 +0800 Subject: [PATCH 5/5] Update app. --- enolex/app.R | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/enolex/app.R b/enolex/app.R index 24deaed..8e2a9ae 100644 --- a/enolex/app.R +++ b/enolex/app.R @@ -341,12 +341,16 @@ bibs <- selectizeInput(inputId = "References", ## MAIN page ==== cards <- list( background_image = - card(card_image("estuary.JPG", border_radius = "none", height = "350px"), - card_footer("The estuary towards the Indian Ocean from the Bak Blau lake, Enggano Island", - class = "fs-6; fw-lighter; blockquote-footer; border-0"), + card(card_image("estuary.JPG", + height = "330px", + border_radius = "none"), + card_body(fill = FALSE, + p("The estuary towards the Indian Ocean from the Bak Blau lake, Enggano Island", + class = "fw-light text-muted")), class = "border-0") , - citation = card(class = "border-0", + citation = card(#class = "border-0", + # height = "200px", card_body(div(h2("How to cite EnoLEX")), div(p("Krauße, Daniel, Gede Primahadi Wijaya Rajeg, Cokorda Pramartha, Erik Zoebel, Charlotte Hemmings, I Wayan Arka, Mary Dalrymple (2024).", em("EnoLEX: A Diachronic Lexical Database for the Enggano Language."), "Available online at", a("https://enggano.shinyapps.io/enolex/", href='https://enggano.shinyapps.io/enolex/', target='_blank')), style="font-size: 0.9em"), div(p("Rajeg, Gede Primahadi Wijaya, Daniel Krauße, and Cokorda Rai Adi Pramartha (2024).", a("EnoLEX: A Diachronic Lexical Database for the Enggano language", href='https://enggano.ling-phil.ox.ac.uk/static/papers/EnoLEX%20-%20A%20Diachronic%20Lexical%20Database%20for%20the%20Enggano%20language%20[Preprint].pdf', target="_blank"), ". In", em("Proceedings of AsiaLex 2024 (The Asian Association for Lexicography 2024 Hybrid Conference)."), "Toyo University, Tokyo: Japan."), style="font-size: 0.9em") @@ -692,23 +696,24 @@ server <- function(input, output, session) { if (input$pattern_matching_options == "regex") { glb <- elx |> + select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates, -matches("Segments")) |> filter(if_any(where(is.character), ~str_detect(., regex(input$global_search, ignore_case = FALSE)))) |> - select(where(function(x) any(!is.na(x)))) |> - select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates, -matches("Segments")) + select(where(function(x) any(!is.na(x)))) + } else if (input$pattern_matching_options == "exact_match") { glb <- elx |> + select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates, -matches("Segments")) |> filter(if_any(where(is.character), ~str_detect(., fixed(input$global_search, ignore_case = FALSE)))) |> - select(where(function(x) any(!is.na(x)))) |> - select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates, -matches("Segments")) + select(where(function(x) any(!is.na(x)))) } else if (input$pattern_matching_options == "partial_match") { glb <- elx |> + select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates, -matches("Segments")) |> filter(if_any(where(is.character), ~str_detect(., regex(input$global_search, ignore_case = FALSE)))) |> - select(where(function(x) any(!is.na(x)))) |> - select(-CITATION, -URL, -YEAR, -BIBTEXKEY, -Concepticon, -AUTHOR, -TITLE, -YEAR_URL, -Number_of_Cognates, -matches("Segments")) + select(where(function(x) any(!is.na(x)))) }