inline for (inputs) |input| {
switch (@typeInfo(@TypeOf(input))) {
- .Struct => {
- try res.write("<input ", .{});
- try res.write(input[0], input[1]);
- try res.write(" />", .{});
+ .Struct => |s| {
+ if (s.fields.len == 3) {
+ try res.write("<{s} ", .{input[0]});
+ try res.write(input[1], input[2]);
+ try res.write("></{s}>", .{input[0]});
+ } else {
+ try res.write("<input ", .{});
+ try res.write(input[0], input[1]);
+ try res.write(" />", .{});
+ }
},
else => {
try res.write("<input ", .{});
try res.write("<option value=\"{x}\">{s}{s}</option>", .{ id, name.constSlice(), if (list_view.has(post_id) catch false) " *" else "" });
}
try res.write("</select>", .{});
- try res.write("<input type=\"hidden\" name=\"post_id\" value=\"{x}\"></input>", .{@intFromEnum(post_id)});
- try res.write("<input type=\"submit\" value=\"Save\"></input>", .{});
+ try res.write("<input type=\"hidden\" name=\"post_id\" value=\"{x}\" />", .{@intFromEnum(post_id)});
+ try res.write("<input type=\"submit\" value=\"Save\" />", .{});
try res.write("</form>", .{});
}
try res.write("<option value=\"{x}\">{s}{s}</option>", .{ id, name.constSlice(), if (list_view.has(user.id) catch false) " *" else "" });
}
try res.write("</select>", .{});
- try res.write("<input type=\"hidden\" name=\"user_id\" value=\"{x}\"></input>", .{@intFromEnum(user.id)});
- try res.write("<input type=\"submit\" value=\"Add to feed\"></input>", .{});
+ try res.write("<input type=\"hidden\" name=\"user_id\" value=\"{x}\" />", .{@intFromEnum(user.id)});
+ try res.write("<input type=\"submit\" value=\"Add to feed\" />", .{});
try res.write("</form>", .{});
}
try res.write(
});
try self.res.write("<br />Description: ", .{});
try html_form(self.res, "/set_description", .{
- .{ "type=\"text\" name=\"description\" placeholder=\"{s}\"", .{login.user.description.constSlice()} },
+ .{ "textarea", "type=\"text\" name=\"description\" placeholder=\"{s}\"", .{login.user.description.constSlice()} },
"type=\"submit\" value=\"Change\"",
});
try self.res.write("<br />Password: ", .{});