Commit dee9ef99 authored by Romain Loth's avatar Romain Loth

additional image display in profile/claim_profile in input zone

parent 52989318
......@@ -47,6 +47,17 @@ function selectSavedMenus(uinfo) {
}
}
// also pre-setup for images
var picShow = document.getElementById('show_pic')
if (uinfo.pic_url || uinfo.pic_fname) {
if (uinfo.pic_url) {
cmxClt.uform.showPic(uinfo.pic_url)
}
if (uinfo.pic_fname) {
cmxClt.uform.showPic('/data/shared_user_img/'+uinfo.pic_fname)
}
}
// the contents are conditioned on what return_user had in his info
var presentMtis = []
......
......@@ -38,6 +38,19 @@ function selectSavedMenus(uinfo) {
}
}
// also pre-setup for images
var picShow = document.getElementById('show_pic')
if (uinfo.pic_url || uinfo.pic_fname) {
if (uinfo.pic_url) {
cmxClt.uform.showPic(uinfo.pic_url)
}
if (uinfo.pic_fname) {
cmxClt.uform.showPic('/data/shared_user_img/'+uinfo.pic_fname)
}
}
// initialize form controllers
var theUForm = cmxClt.uform.Form(
......
......@@ -612,6 +612,32 @@ var cmxClt = (function() {
var picMsg = document.getElementById('picture_message')
var imgReader = new FileReader();
cC.uform.showPic = function(aSrc) {
showPicImg.src = aSrc
// prepare max size while preserving ratio
var realValues = window.getComputedStyle(showPicImg)
var imgW = realValues.getPropertyValue("width")
var imgH = realValues.getPropertyValue("height")
// debug
// console.log("img wid", imgW)
// console.log("img hei", imgH)
if (imgW > imgH) {
showPicImg.style.width = "100%"
showPicImg.style.height = "auto"
}
else {
showPicImg.style.width = "auto"
showPicImg.style.height = "100%"
}
// now show it
boxShowPicImg.style.display = 'block'
// possible re-adjust outerbox ?
}
cC.uform.checkShowPic = function (aForm, doHighlight) {
// TEMPORARY initial size already 200 kB, user has to do it himself
var max_size = 204800
......@@ -644,30 +670,8 @@ var cmxClt = (function() {
picMsg.style.color = cmxClt.colorGreen
// to show the pic when readAsDataURL
imgReader.onload = function () {
showPicImg.src = imgReader.result;
// prepare max size while preserving ratio
var realValues = window.getComputedStyle(showPicImg)
var imgW = realValues.getPropertyValue("width")
var imgH = realValues.getPropertyValue("height")
// debug
// console.log("img wid", imgW)
// console.log("img hei", imgH)
if (imgW > imgH) {
showPicImg.style.width = "100%"
showPicImg.style.height = "auto"
}
else {
showPicImg.style.width = "auto"
showPicImg.style.height = "100%"
}
// now show it
boxShowPicImg.style.display = 'block'
// possible re-adjust outerbox ?
imgReader.onload = function() {
cC.uform.showPic(imgReader.result)
}
// create fake src url & trigger the onload
imgReader.readAsDataURL(theFile);
......
......@@ -65,14 +65,16 @@
<h3 class="formcatfirst"> Carte de visite </h3>
{% if not current_user.empty %}
<div id="information-example" class="our-vcard">
<!-- TODO if empty then click on image starts showPicImg -->
<img src="{{ (current_user.pic_src | safe) if current_user.pic_src else ''}}" class="our-vcard-img">
<ul>
<!-- TODO if empty then click on image starts showPicImg -->
<img src="{{ (current_user.pic_src | safe) if current_user.pic_src else ''}}" width="80px" style="float:left;margin:5px">
<li>
<li class=bigger>
<b>{{ current_user.info.hon_title }}
{{ current_user.info.first_name }}
<!-- TODO mid initials -->
{{ current_user.info.last_name }}</b>
<br/>
<br/>
</li>
<li>
<b>Country: </b>{{ current_user.info.country }}<br>
......@@ -559,6 +561,7 @@
<!-- == S U B M I T == -->
<div style="text-align:center">
<br/><br/>
<!-- @type button to avoid ENTER submit -->
<button class="btn btn-lg btn-success" id="form_submit"
type="button" onclick="theUForm.elForm.submit()">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment