mirror of
https://github.com/thegeneralist01/archivr
synced 2026-07-21 18:55:36 +02:00
feat: inline entry title renaming (#14)
* feat: inline entry title renaming - database.rs: add update_entry_title(conn, entry_uid, title) -> Result<bool> targets archived_entries table; returns false for unknown uid - routes.rs: PATCH /api/archives/:archive_id/entries/:entry_uid (ROLE_USER) maps false -> 404; 3 tests (401 unauthed, 204+persists, 404 unknown uid) - api.js: updateEntryTitle(archiveId, entryUid, title) - ContextRail.jsx: click title h2 -> inline input; Enter/blur commits, Escape cancels (cancel ref prevents double-save on blur after Escape); pencil icon fades in on hover as edit affordance - App.jsx: handleEntryTitleChange mutates entries + selectedEntry in-place - styles.css: rail-title--editable cursor/hover, pencil icon show/hide, rail-title-input underline style - rebuild frontend bundle * chore: remove + prefix from Capture button label
This commit is contained in:
parent
1ff91956a1
commit
2502de45b6
11 changed files with 258 additions and 50 deletions
|
|
@ -752,6 +752,16 @@ pub fn update_user_display_name(conn: &Connection, user_id: i64, display_name: O
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Updates the user-visible title of an archived entry.
|
||||
/// Returns `Ok(true)` if a row was updated, `Ok(false)` if the entry_uid was not found.
|
||||
pub fn update_entry_title(conn: &Connection, entry_uid: &str, title: Option<&str>) -> Result<bool> {
|
||||
let n = conn.execute(
|
||||
"UPDATE archived_entries SET title = ?1 WHERE entry_uid = ?2",
|
||||
params![title, entry_uid],
|
||||
)?;
|
||||
Ok(n > 0)
|
||||
}
|
||||
|
||||
pub fn get_user_display_name(conn: &Connection, user_id: i64) -> Result<Option<String>> {
|
||||
conn.query_row(
|
||||
"SELECT display_name FROM users WHERE id = ?1",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue