This commit is contained in:
2026-07-25 23:08:19 -04:00
parent 5cef8b1ca6
commit d90c0b040d
2 changed files with 29 additions and 12 deletions
+21 -8
View File
@@ -6,7 +6,7 @@ use http::StatusCode;
use iced::alignment::Horizontal; use iced::alignment::Horizontal;
use iced::widget::button::Style; use iced::widget::button::Style;
use iced::widget::grid::Sizing; use iced::widget::grid::Sizing;
use iced::widget::{button, center, column, combo_box, container, grid, mouse_area, opaque, pick_list, row, scrollable, space, stack, table, text, text_input, toggler}; use iced::widget::{button, center, column, combo_box, container, grid, mouse_area, opaque, operation, pick_list, row, scrollable, space, stack, table, text, text_input, toggler};
use iced::window::Settings; use iced::window::Settings;
use iced::{Background, Color, Element, Length, Subscription, Task, color, window}; use iced::{Background, Color, Element, Length, Subscription, Task, color, window};
use iced::widget::text::Wrapping; use iced::widget::text::Wrapping;
@@ -392,7 +392,7 @@ impl Publisher {
query: String::new(), query: String::new(),
results: Vec::new(), results: Vec::new(),
}); });
task = window_task.map(|_| Message::None); task = window_task.then(|_| operation::focus("query"));
} }
if let Some(selected_entity_class) = selected_entity_class { if let Some(selected_entity_class) = selected_entity_class {
@@ -680,14 +680,26 @@ impl Publisher {
}) })
.unwrap_or(Horizontal::Left); .unwrap_or(Horizontal::Left);
let object_input_base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str()) // If the datatype is something, then it's not a named node, and we should use a plain
.on_shift_click(Message::NavigateToObject(key)); // text_input as opposed to an iri_input.
let object_input = if self.ontology.is_read_only(triple.as_ref()) { let object_input: Element<Message> = if term.datatype().is_some() {
object_input_base let base = text_input("Object", value.as_str());
if self.ontology.is_read_only(triple.as_ref()) {
base.into()
} else { } else {
object_input_base.align_x(value_alignment) base.on_input(move |value| Message::ObjectUpdated(key, value)).into()
}
} else {
let base = iri_input(&self.curie_helper, "Object", Some(&base), value.as_str())
.on_shift_click(Message::NavigateToObject(key));
if self.ontology.is_read_only(triple.as_ref()) {
base.into()
} else {
base.align_x(value_alignment)
.on_input(move |value| Message::ObjectUpdated(key, value)) .on_input(move |value| Message::ObjectUpdated(key, value))
.on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key))) .on_control_click(Message::OpenQueryWindow(SearchResultClickAction::Object(key)))
.into()
}
}; };
let selected_datatype = term.datatype() let selected_datatype = term.datatype()
@@ -781,7 +793,8 @@ impl Publisher {
&& search_state.window_id == window && search_state.window_id == window
{ {
let search_input = let search_input =
text_input("Query", &search_state.query).on_input(Message::QueryUpdated); text_input("Query", &search_state.query).on_input(Message::QueryUpdated)
.id("query");
let entities = self.ontology let entities = self.ontology
.searchable_classes(&*language::ENGLISH_OR_UNTAGGED) .searchable_classes(&*language::ENGLISH_OR_UNTAGGED)
+6 -2
View File
@@ -31,6 +31,7 @@ static PREFIXES: LazyLock<BTreeMap<String, String>> = LazyLock::new(|| {
), ),
("prov", "http://www.w3.org/ns/prov#"), ("prov", "http://www.w3.org/ns/prov#"),
("locid", "http://id.loc.gov/vocabulary/identifiers/"), ("locid", "http://id.loc.gov/vocabulary/identifiers/"),
("loclang", "http://id.loc.gov/vocabulary/languages/"),
("premis", "http://www.loc.gov/premis/rdf/v1#"), ("premis", "http://www.loc.gov/premis/rdf/v1#"),
("premis3", "http://www.loc.gov/premis/rdf/v3/"), ("premis3", "http://www.loc.gov/premis/rdf/v3/"),
("dcterms", "http://purl.org/dc/terms/"), ("dcterms", "http://purl.org/dc/terms/"),
@@ -47,9 +48,12 @@ static PREFIXES: LazyLock<BTreeMap<String, String>> = LazyLock::new(|| {
("rdau", "http://rdaregistry.info/Elements/u/"), ("rdau", "http://rdaregistry.info/Elements/u/"),
("rdaw", "http://rdaregistry.info/Elements/w/"), ("rdaw", "http://rdaregistry.info/Elements/w/"),
("rdax", "http://rdaregistry.info/Elements/x/"), ("rdax", "http://rdaregistry.info/Elements/x/"),
("rdaco", "http://rdaregistry.info/termList/RDAContentType/"),
("rdact", "http://rdaregistry.info/termList/RDACarrierType/"),
("rdaft", "http://rdaregistry.info/termList/fileType/"),
("schema", "https://schema.org/"), ("schema", "https://schema.org/"),
("quill", "http://fedora.quill.lan/rest/"), ("gl", "http://fedora.quill.lan/rest/"),
("gl", ONTOLOGY_PREFIX), ("glo", ONTOLOGY_PREFIX),
].map(|(k, v)| (k.to_string(), v.to_string()))) ].map(|(k, v)| (k.to_string(), v.to_string())))
}); });