╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Settings.zig ─────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
376 pub fn getGrid(self: Form) ?Grid { 377 return self.scroll.getGrid(); 378 } 379 380 pub fn getFocus(self: *Form) *Focus { 381 return self.scroll.getFocus(); 382 } 383 384 // up leaves the form from its first control 385 pub fn atTop(self: Form) bool { 386 const box = &self.scroll.child.center.child.box; 387 return box.focus.child_id == box.children.keys()[0]; 388 } 389 }; 390 391 // change the repo `identity` names as `actor`, its owner, returning its 392 // settings route under its new name 393 pub fn update( 394 io: std.Io, 395 allocator: std.mem.Allocator, 396 users_dir: []const u8, 397 actor: ui.Actor, 398 identity: []const u8, 399 name: []const u8, 400 description: []const u8, 401 access: evt.Repo.Access, 402 discuss_role: ?evt.Repo.Role, 403 issue_role: ?evt.Repo.Role, 404 patch_role: ?evt.Repo.Role, 405 ) !ui.RoutablePage { 406 const parsed = ui.RoutablePage.RepoIdentity.parse(identity) orelse return error.NotFound; 407 const owner_id = actor.repo_user_id orelse return error.NotFound; 408 try evt.updateRepo(io, allocator, users_dir, &owner_id, actor.author, parsed.name, name, description, access, discuss_role, issue_role, patch_role); 409 var buf: [ui.RoutablePage.repo_route_max_len]u8 = undefined; 410 const new_identity = std.fmt.bufPrint(&buf, "{s}:{s}", .{ parsed.owner, name }) catch return error.RouteTooLong; 411 return ui.RoutablePage.repoSettingsRoute(new_identity) orelse error.RouteTooLong; 412 } 413