╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ NewRepo.zig ──────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯
143 const access = std.meta.stringToEnum(evt.Repo.Access, (try formRadio(self.formBox(), "access")).selected()) orelse unreachable; 144 145 _ = evt.createRepo(io, allocator, users_dir, &user_id, .{ .name = user.event.name, .email = user.event.email }, name, description, access, hash_kind) catch |err| { 146 const failure = ui.Session.FormFeedback.RepoFailure.fromError(err) orelse return err; 147 const aa = self.session.arena.allocator(); 148 self.session.data.form_feedback = .{ .repo = .{ .failure = failure, .fields = .{ 149 .name = try aa.dupe(u8, name), 150 .description = try aa.dupe(u8, description), 151 .hash = hash_kind, 152 .access = access, 153 } } }; 154 return; 155 }; 156 157 // wipe the form so a return visit starts fresh 158 name_input.clear(allocator); 159 description_input.clear(allocator); 160 161 const identity = try self.session.page_arena.allocator().print("{s}:{s}", .{ user.event.name, name }); 162 try self.session.navigate(ui.RoutablePage.repoFilesRoute(identity, null, "", "", 0) orelse return); 163 } 164 165 fn formBox(self: *View) *wgt.Box(ui.Widget) { 166 return &self.center.child.box; 167 } 168 169 pub fn clearGrid(self: *View) void { 170 self.center.clearGrid(); 171 } 172 173 pub fn getGrid(self: View) ?Grid { 174 return self.center.getGrid(); 175 } 176 177 pub fn getFocus(self: *View) *Focus { 178 return self.center.getFocus(); 179 } 180 181 // up leaves the form from its first control 182 pub fn atTop(self: View) bool { 183 const box = &self.center.child.box; 184 return box.focus.child_id == box.children.keys()[0]; 185 } 186 }; 187