╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ NewUser.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
152 return; 153 }; 154 155 // log in as the new user, reading them from a moment that has them 156 self.session.data.user_id = try self.session.arena.allocator().dupe(u8, &id); 157 self.session.haxy_moment = try evt.currentMoment(evt.admin_repo_opts, admin_repo); 158 try self.session.loadUser(); 159 160 // wipe the form so a return visit starts fresh 161 name_input.clear(allocator); 162 email_input.clear(allocator); 163 password_input.clear(allocator); 164 password_again_input.clear(allocator); 165 166 try self.session.navigate(.{ .user_repos = .{ .name = ui.RoutablePage.Array(evt.User.name_max_len).from(name) orelse return error.RouteTooLong } }); 167 } 168 169 fn formBox(self: *View) *wgt.Box(ui.Widget) { 170 return &self.center.child.box; 171 } 172 173 pub fn clearGrid(self: *View) void { 174 self.center.clearGrid(); 175 } 176 177 pub fn getGrid(self: View) ?Grid { 178 return self.center.getGrid(); 179 } 180 181 pub fn getFocus(self: *View) *Focus { 182 return self.center.getFocus(); 183 } 184 185 // up leaves the form from its first control 186 pub fn atTop(self: View) bool { 187 const box = &self.center.child.box; 188 return box.focus.child_id == box.children.keys()[0]; 189 } 190 }; 191