╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Settings.zig ─────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
162 }; 163 try self.session.navigate(route); 164 } 165 166 fn formBox(self: *View) *wgt.Box(ui.Widget) { 167 return &self.center.child.box; 168 } 169 170 pub fn clearGrid(self: *View) void { 171 self.center.clearGrid(); 172 } 173 174 pub fn getGrid(self: View) ?Grid { 175 return self.center.getGrid(); 176 } 177 178 pub fn getFocus(self: *View) *Focus { 179 return self.center.getFocus(); 180 } 181 182 // up leaves the form from its first control 183 pub fn atTop(self: View) bool { 184 const box = &self.center.child.box; 185 return box.focus.child_id == box.children.keys()[0]; 186 } 187 }; 188 189 // change the repo `identity` names as `actor`, its owner, returning its 190 // settings route under its new name 191 pub fn update( 192 io: std.Io, 193 allocator: std.mem.Allocator, 194 users_dir: []const u8, 195 actor: ui.Actor, 196 identity: []const u8, 197 name: []const u8, 198 description: []const u8, 199 access: evt.Repo.Access, 200 ) !ui.RoutablePage { 201 const parsed = ui.RoutablePage.RepoIdentity.parse(identity) orelse return error.NotFound; 202 const owner_id = actor.repo_user_id orelse return error.NotFound; 203 try evt.updateRepo(io, allocator, users_dir, &owner_id, actor.author, parsed.name, name, description, access); 204 var buf: [ui.RoutablePage.repo_route_max_len]u8 = undefined; 205 const new_identity = std.fmt.bufPrint(&buf, "{s}:{s}", .{ parsed.owner, name }) catch return error.RouteTooLong; 206 return ui.RoutablePage.repoRepoRoute(new_identity) orelse error.RouteTooLong; 207 } 208