-
Notifications
You must be signed in to change notification settings - Fork 0
/
comment.view
69 lines (63 loc) · 2.2 KB
/
comment.view
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
auto comment_view = [](long long session) {
static Redis redis;
std::string login{redis.session_login(session)};
std::string dn{redis.display_name(login)};
tags::h3 h3;
h3.innerhtml("Обсудим?");
tags::div group;
group.push_attr("class", "form-group");
tags::form form;
form.push_attr("action", "/");
form.push_attr("method", "post");
if (!login.empty())
form.push_attr("enctype", "multipart/form-data");
const std::string ctl1 = [&dn](){
tags::label label;
label.push_attr("for", "nickname");
label.innerhtml("Nickname (*)");
tags::input input;
input.push_attr("class", "form-control");
input.push_attr("type", "text");
input.push_attr("id", "nickname");
input.push_attr("name", "nickname");
if (!dn.empty())
input.push_attr("value", dn);
return label.content() + input.content();
}();
const std::string ctl2 = [](){
tags::label label;
label.push_attr("for", "text");
label.innerhtml("Text (*)");
tags::textarea textarea;
textarea.push_attr("class", "form-control");
textarea.push_attr("id", "text");
textarea.push_attr("name", "text");
return label.content() + textarea.content();
}();
const std::string ctl3 = [&login](){
if (login.empty())
return ""s;
tags::label label;
label.push_attr("for", "file");
label.innerhtml("File");
tags::input input;
input.push_attr("class", "form-control");
input.push_attr("type", "file");
input.push_attr("id", "file");
input.push_attr("name", "file");
return label.content() + input.content();
}();
const std::string ctl4 = [](){
tags::button button;
button.push_attr("class", "form-control");
button.push_attr("type", "submit");
button.push_attr("name", "submit");
button.push_attr("value", "Send");
button.innerhtml("Send");
return button.content();
}();
form.innerhtml(ctl1 + ctl2 + ctl3 + ctl4);
group.innerhtml(form.content());
return h3.content() + group.content();
};
// vim: syntax=cpp