hurrying
This commit is contained in:
parent
2a73647983
commit
17169cbcd7
28
index.html
28
index.html
@ -1,5 +1,25 @@
|
||||
<div>
|
||||
@for qr in qrs
|
||||
render_ticket(qr)
|
||||
@end
|
||||
<div><div class="ticket_container">
|
||||
<div>
|
||||
<h1>Ourworld ICTC Event</h1>
|
||||
<p>running rice valley hide speech roof accident full involved wide rather order good hidden horse home graph did model perhaps worry volume collect put</p>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h2>Sponsors</h2>
|
||||
<div></div>
|
||||
</div>
|
||||
|
||||
<div class="flex">
|
||||
<div>
|
||||
<h2>Register</h2>
|
||||
<p>dangerous shadow exclaimed stopped sale easy find add ago cold hard satisfied bent month sing frighten will flag shorter cage period doing successful husband</p>
|
||||
</div>
|
||||
<img src="qrs/qr_test" alt="QR Code">
|
||||
</div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
@ -20,3 +20,5 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
46
ticket.v
46
ticket.v
@ -1,11 +1,49 @@
|
||||
import vweb
|
||||
module main
|
||||
|
||||
pub fn render_ticket(qr string) {
|
||||
import vweb
|
||||
import os
|
||||
|
||||
pub fn ticket_front(qr string) string {
|
||||
slug := qr.all_after_last('_')
|
||||
$tmpl('./ticket.html')
|
||||
return $tmpl('templates/ticket_front.html')
|
||||
}
|
||||
|
||||
pub fn run_before() {
|
||||
qrs := ['test']
|
||||
mut html := ''
|
||||
os.rm('index.html') or { panic(err) }
|
||||
mut index_file := os.create('index.html') or { panic('Failed to create index.html file: $err') }
|
||||
println('debug:${typeof(index_file)}')
|
||||
println('debug: ${ticket_front('test')}')
|
||||
index_file.write_string('<div>') or { panic('Failed to write <div> to index.html file: $err') }
|
||||
for qr in qrs {
|
||||
index_file.write_string(ticket_front(qr)) or {
|
||||
panic('Failed to write qr: $qr to index.html file: $err')
|
||||
}
|
||||
}
|
||||
index_file.write_string('</div>') or {
|
||||
panic('Failed to write </div> to index.html file: $err')
|
||||
}
|
||||
index_file.close()
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
vweb.Context
|
||||
}
|
||||
|
||||
pub fn new_app() &App {
|
||||
mut app := &App{}
|
||||
static_folder := os.resource_abs_path('./app/static')
|
||||
app.mount_static_folder_at(static_folder, '/static')
|
||||
return app
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
run_before()
|
||||
mut app := new_app()
|
||||
vweb.run(app, 8000)
|
||||
}
|
||||
|
||||
pub fn (mut app App) index() vweb.Result {
|
||||
qrs :=
|
||||
return $vweb.html()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user