mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-26 17:38:21 +01:00
allow download pdf file
This commit is contained in:
parent
9d8e0916a2
commit
4710f183e1
@ -9,4 +9,22 @@ end
|
||||
function IndexController:actionnotfound(...)
|
||||
self.template:setView("index")
|
||||
return self:index(table.unpack({...}))
|
||||
end
|
||||
|
||||
function IndexController:json(...)
|
||||
std.json()
|
||||
echo( JSON.encode(REQUEST))
|
||||
return false
|
||||
end
|
||||
|
||||
function IndexController:get(...)
|
||||
return true
|
||||
end
|
||||
|
||||
function IndexController:form(...)
|
||||
return true
|
||||
end
|
||||
|
||||
function IndexController:upload(...)
|
||||
return true
|
||||
end
|
15
apps/views/default/index/form.ls
Normal file
15
apps/views/default/index/form.ls
Normal file
@ -0,0 +1,15 @@
|
||||
<?lua
|
||||
if REQUEST.method == "POST" then
|
||||
return echo(JSON.encode(REQUEST))
|
||||
end
|
||||
?>
|
||||
<form action="https://apps.localhost:9195/index/form" method="post">
|
||||
<fieldset>
|
||||
<legend>Personal information:</legend>
|
||||
First name:<br>
|
||||
<input type="text" name="firstname" value="Mickey"><br>
|
||||
Last name:<br>
|
||||
<input type="text" name="lastname" value="Mouse"><br><br>
|
||||
<input type="submit" value="Submit">
|
||||
</fieldset>
|
||||
</form>
|
3
apps/views/default/index/get.ls
Normal file
3
apps/views/default/index/get.ls
Normal file
@ -0,0 +1,3 @@
|
||||
<?lua
|
||||
echo(JSON.encode(REQUEST))
|
||||
?>
|
12
apps/views/default/index/upload.ls
Normal file
12
apps/views/default/index/upload.ls
Normal file
@ -0,0 +1,12 @@
|
||||
|
||||
<?lua
|
||||
if REQUEST.method == "POST" then
|
||||
return echo(JSON.encode(REQUEST))
|
||||
end
|
||||
?>
|
||||
<form action="https://apps.localhost:9195/index/upload" method="post" enctype="multipart/form-data">
|
||||
Select image to upload:
|
||||
<input type="file" name="fileToUpload" id="fileToUpload">
|
||||
<input type="file" name="fileToUpload1" id="fileToUpload1">
|
||||
<input type="submit" value="Upload Image" name="submit">
|
||||
</form>
|
@ -50,3 +50,17 @@ end
|
||||
function IndexController:actionnotfound(...)
|
||||
return self:notoc(table.unpack({...}))
|
||||
end
|
||||
|
||||
function IndexController:pdf(...)
|
||||
local tmp_file = "/tmp/lxsang_cv.pdf"
|
||||
local cmd = "wkhtmltopdf "..HTTP_ROOT.."/index/notoc "..tmp_file
|
||||
local r = os.execute(cmd)
|
||||
if r then
|
||||
local mime = std.mimeOf(tmp_file)
|
||||
std.header(mime)
|
||||
std.fb(tmp_file)
|
||||
return false
|
||||
else
|
||||
return self:error("Sorry.Problem generate PDF file")
|
||||
end
|
||||
end
|
||||
|
@ -29,6 +29,17 @@
|
||||
flex-direction: row-reverse;
|
||||
/*color: #414339;*/
|
||||
}
|
||||
|
||||
.layoutprint{
|
||||
max-width:960px;
|
||||
font-family: "Ubuntu";
|
||||
text-align: justify;
|
||||
margin:0 auto;
|
||||
display: flex;
|
||||
flex-direction: row-reverse;
|
||||
color: #414339;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 25px;
|
||||
text-align: center;
|
||||
|
@ -4,10 +4,24 @@
|
||||
<script type="text/javascript" src="<?=HTTP_ROOT?>/rst/gscripts/showdown.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/style.css" />
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/font-awesome.css" />
|
||||
<?lua
|
||||
if not toc then
|
||||
?>
|
||||
<link rel="stylesheet" type="text/css" href="<?=HTTP_ROOT?>/rst/ubuntu-regular.css" />
|
||||
<?lua
|
||||
end
|
||||
?>
|
||||
<title>Porfolio</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layout">
|
||||
<?lua
|
||||
local classname = "layout"
|
||||
if not toc then
|
||||
classname = "layoutprint"
|
||||
if user then user:set("preview", true) end
|
||||
end
|
||||
?>
|
||||
<div class="<?=classname?>">
|
||||
<div class = "cv-content">
|
||||
<?lua
|
||||
if user then
|
||||
|
@ -11,6 +11,14 @@
|
||||
<span class="text"><?=data.email?></span>
|
||||
<span class="fa fa-globe"></span>
|
||||
<span class="text"><a href ="<?=data.url?>"><?=data.url?></a></span>
|
||||
<?lua
|
||||
if not preview then
|
||||
?>
|
||||
<span class="fa fa-file-pdf-o"></span>
|
||||
<span class="text"><a href ="<?=HTTP_ROOT?>/index/pdf">Download</a></span>
|
||||
<?lua
|
||||
end
|
||||
?>
|
||||
</p>
|
||||
<p class="shortbio">
|
||||
<span class="fa fa-quote-left"></span>
|
||||
|
Loading…
Reference in New Issue
Block a user