catch model up to multi-author lines
now the only thing missing is the quote adding UI support - multiauthor lines can already be added via API
This commit is contained in:
@@ -9,7 +9,9 @@ pub fn quote(quote: &Quote) -> Markup {
|
||||
(PreEscaped(icons::QUOTE))
|
||||
}
|
||||
@for (i, line) in quote.lines.iter().enumerate() {
|
||||
@let show_author = i == quote.lines.len()-1 || quote.lines[i+1].attribution.id != line.attribution.id;
|
||||
@let is_last = i == quote.lines.len() - 1;
|
||||
@let show_author = is_last || !line.attribution.iter().map(|a| a.id)
|
||||
.eq(quote.lines[i + 1].attribution.iter().map(|a| a.id));
|
||||
div class="mb-2" {
|
||||
span class="flex flex-row gap-2 relative" {
|
||||
span class="scale-x-[.65] scale-y-[.5] absolute opacity-[.3]"{
|
||||
@@ -19,7 +21,7 @@ pub fn quote(quote: &Quote) -> Markup {
|
||||
}
|
||||
@if show_author {
|
||||
p class="text-sm italic ml-3 flex flex-row gap-1.5 text-neutral-400" {
|
||||
"— " (line.attribution.name)
|
||||
"— " (line.attribution.iter().map(|a| a.name.clone()).collect::<Vec<_>>().join(", "))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,12 @@ pub async fn form(
|
||||
for nid in form.authors {
|
||||
authors.push(Name::get_by_id(&mut *tx, nid).await.unwrap());
|
||||
}
|
||||
let lines = form.lines.into_iter().zip(authors).collect();
|
||||
let lines = form
|
||||
.lines
|
||||
.into_iter()
|
||||
.zip(authors)
|
||||
.map(|(l, a)| (l, vec![a]))
|
||||
.collect();
|
||||
|
||||
let timestamp = match NaiveDateTime::parse_from_str(&form.time, "%Y-%m-%dT%H:%M") {
|
||||
Ok(ts) => ts,
|
||||
|
||||
Reference in New Issue
Block a user