mirror of
https://github.com/lxsang/antd-web-apps
synced 2024-12-25 17:08:22 +01:00
display photo
This commit is contained in:
parent
9eb6d62d7d
commit
87169dd41f
@ -53,7 +53,8 @@ end
|
||||
|
||||
function IndexController:pdf(...)
|
||||
local tmp_file = WWW_ROOT.."/cv_exported.pdf"
|
||||
local cmd = "wkhtmltopdf "..HTTP_ROOT.."/"..self.registry.user.."/notoc "..tmp_file
|
||||
local cmd = "wkhtmltopdf "..HTTP_ROOT.."/"..self.registry.user.."/index/notoc "..tmp_file
|
||||
print(cmd)
|
||||
local r = os.execute(cmd)
|
||||
if r then
|
||||
local mime = std.mimeOf(tmp_file)
|
||||
|
@ -15,3 +15,25 @@ function UserController:index(...)
|
||||
self.template:set("data", data[1])
|
||||
return true
|
||||
end
|
||||
|
||||
|
||||
function UserController:photo(...)
|
||||
local data = self.user:findAll()
|
||||
if not data or not data[1] then
|
||||
self:error("Cannot fetch user info")
|
||||
end
|
||||
if(not data[1] or data[1].photo == "") then
|
||||
self:error("User photo is not available")
|
||||
end
|
||||
local prefix = data[1].photo:match("%a+://")
|
||||
local suffix = data[1].photo:gsub(prefix,"")
|
||||
local path = string.format("/home/%s/", self.registry.user)..suffix
|
||||
print(path)
|
||||
if ulib.exists(path) then
|
||||
local mime = std.mimeOf(path)
|
||||
std.sendFile(path)
|
||||
else
|
||||
self:error("Asset file not found or access forbidden: "..path)
|
||||
end
|
||||
return false
|
||||
end
|
@ -67,7 +67,7 @@ function NotfoundController:index(...)
|
||||
self:error("404: Controller "..args[1].." not found : "..args[2])
|
||||
return
|
||||
end
|
||||
REQUEST.r = "index/"..std.trim(REQUEST.r:gsub(user, ""), "/")
|
||||
REQUEST.r = std.trim(REQUEST.r:gsub(user, ""), "/")
|
||||
if REGISTRY.db then REGISTRY.db:close() end
|
||||
REGISTRY.user = user
|
||||
REGISTRY.db = DBHelper:new{db=REGISTRY.user}
|
||||
|
@ -31,7 +31,7 @@
|
||||
}
|
||||
|
||||
.layout div.container{
|
||||
display: none;
|
||||
display: block;
|
||||
}
|
||||
.layout div.container_active{
|
||||
display: block;
|
||||
@ -169,4 +169,16 @@ hr{
|
||||
border-top: 1px solid #878887;
|
||||
padding: 0;
|
||||
}
|
||||
img {max-width:100%}
|
||||
img {max-width:100%}
|
||||
|
||||
.header_container {
|
||||
display: block;
|
||||
width: 100%;
|
||||
}
|
||||
.header_container img {
|
||||
float: left;
|
||||
max-width: 150px;
|
||||
margin-right: 10px;
|
||||
margin-bottom: 20px;
|
||||
display: block;
|
||||
}
|
||||
|
@ -8,7 +8,8 @@
|
||||
local active = "toc_active"
|
||||
for k, v in pairs(data) do
|
||||
?>
|
||||
<li class="<?=active?>"><a href=<?='"#toc'..v[2]..'"'?> onclick='switchTab("toc<?=v[2]?>", this)' ><?=v[1]?></a></li>
|
||||
<!--onclick='switchTab("toc<?=v[2]?>", this)'-->
|
||||
<li class="<?=active?>"><a href=<?='"#toc'..v[2]..'"'?> ><?=v[1]?></a></li>
|
||||
<?lua
|
||||
active = ''
|
||||
end
|
||||
|
@ -1,27 +1,33 @@
|
||||
<h1>
|
||||
<span class="name"><?=data.fullname?></span>
|
||||
<span class="cv">Curriculum Vitae</span>
|
||||
</h1>
|
||||
<p class="coordination">
|
||||
<span class="fa fa-home"></span><?=data.address?></p>
|
||||
<p class="coordination">
|
||||
<span class="fa fa-phone"></span>
|
||||
<span class="text"><?=data.Phone?></span>
|
||||
<span class="fa fa-envelope-o"></span>
|
||||
<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?>/<?=data.user?>/pdf" target="_blank">Download</a></span>
|
||||
<?lua
|
||||
end
|
||||
?>
|
||||
</p>
|
||||
<p class="shortbio">
|
||||
<span class="fa fa-quote-left"></span>
|
||||
<span><?=data.shortbiblio?></span>
|
||||
<span class="fa fa-quote-right"></span>
|
||||
</p>
|
||||
<div class="header_container">
|
||||
<?lua if data.photo and data.photo ~= "" then ?>
|
||||
<img src="/<?=data.user?>/user/photo"></img>
|
||||
<?lua end ?>
|
||||
<h1>
|
||||
<span class="name"><?=data.fullname?></span>
|
||||
<span class="cv">Curriculum Vitae</span>
|
||||
</h1>
|
||||
<p class="coordination">
|
||||
<span class="fa fa-home"></span><?=data.address?></p>
|
||||
<p class="coordination">
|
||||
<span class="fa fa-phone"></span>
|
||||
<span class="text"><?=data.Phone?></span>
|
||||
<span class="fa fa-envelope-o"></span>
|
||||
<span class="text"><?=data.email?></span>
|
||||
<br/>
|
||||
<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?>/<?=data.user?>/index/pdf" target="_blank">Download</a></span>
|
||||
<?lua
|
||||
end
|
||||
?>
|
||||
</p>
|
||||
<p class="shortbio">
|
||||
<span class="fa fa-quote-left"></span>
|
||||
<span><?=data.shortbiblio?></span>
|
||||
<span class="fa fa-quote-right"></span>
|
||||
</p>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user