-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
98 lines (84 loc) · 3.12 KB
/
index.html
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html>
<head>
<title>{{ protomustache }}</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
crossorigin="anonymous">
<style>
body {
padding-top: 1.5rem;
padding-bottom: 1.5rem;
}
/* Customize container */
@media (min-width: 48em) {
.container {
max-width: 46rem;
}
}
.container-narrow>hr {
margin: 2rem 0;
}
.jumbotron {
text-align: center;
border-bottom: .05rem solid #e5e5e5;
}
table .Longitude,
table .Latitude,
table .FacebookID,
table .Int64,
table .Uint32,
table .Uint64,
table .Sint32,
table .Sint64,
table .Fixed32,
table .Fixed64,
table .Sfixed32,
table .Sfixed64 {
display: none
}
</style>
</head>
<body>
<div class="container">
<div class="jumbotron">
<h1 class="display-3">Protomustache</h1>
<p class="lead"> Generate HTML templates from protobuf </p>
</div>
<p class=""> GitHub page: <a href="https://github.com/azr/protoc-gen-htmltemplate">https://github.com/azr/protoc-gen-htmltemplate</a> </p>
<p class="small"> Mustache GitHub page: <a href="https://github.com/mustache/mustache.github.com">https://github.com/mustache/mustache.github.com</a> </p>
<div id="content">
Example of a generated Profile form :
<form id="user-form"></form>
</div>
<div id="content">
Example of a generated table view :
<table class="table table-inverse">
<thead>
<tr id="user-table-header">
</tr>
</thead>
<tbody id="user-table-content">
</tbody>
</table>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mustache.js/2.3.0/mustache.js"></script>
<script src="example/user.pb.mustache.js"></script>
<script src="example/storage.pb.mustache.js"></script>
<script>
var userFormRendered = Mustache.render(templates.Profile.form, { ID: 42 }, templates.Profile.formIncludes());
$("#user-form").html(userFormRendered);
var userTableHeaderRendered = Mustache.render(templates.Profile.tableHeader, {}, templates.Profile.tableHeaderIncludes());
$("#user-table-header").html(userTableHeaderRendered);
var userTableRowRendered = Mustache.render(
'{{#.}} <tr> ' + templates.Profile.tableRow + '</tr> {{/.}} ',
[
{ ID: 42 },
{ ID: 43 },
{ ID: 44 },
{ ID: 45 },
], templates.Profile.tableRowIncludes());
$("#user-table-content").html(userTableRowRendered);
</script>
</body>
</html>