Commit 28d675b3 authored by Romain Loth's avatar Romain Loth

more compact 2-column layout for claim_profile login creation

parent 81b5be0e
......@@ -112,6 +112,16 @@ div.my-box {
}
/* sub containers */
.nopadding {
padding: 0;
}
.nomargin {
margin: 0;
}
/* self-made modals */
.modal.self-made {
top:25%;
......
......@@ -171,6 +171,16 @@ input.readonly {
padding-right: 2.1em;
}
.legend-alone {
font-family: Cambria, serif;
color: #554 ;
font-style: italic;
text-align: center;
font-size: 120%;
padding-bottom: 1em;
font-weight: 500;
}
/* for code blocks or urls */
.code {
font-family: "Fira Mono", "Droid Sans Mono", monospace;
......
......@@ -21,114 +21,6 @@
* 2/ The "re-create your account" form is a doors-auth of register type
*/
// 2 exposed vars for inline js controls
var otherInstDiv = document.getElementById('other_org_div')
// TODO make relative to org_type and move inline snippet to extended form obj
var otherOrgTypeInput = document.getElementById('other_org_type')
// reselecting current_user's info choices
function setupSavedItems(uinfo) {
// (date and menu values are set up here
// but normal text vals are set up via html,
// pic is set below from a separate function,
// and multi text inputs are set up via form init... fixable to harmonize)
for (var i in cmxClt.COLS) {
var colType = cmxClt.COLS[i][3]
if (colType == 'd' || colType == 'm') {
var colName = cmxClt.COLS[i][0]
var chosenV = uinfo[colName]
var tgtElt = document.getElementById(colName)
if (tgtElt && (chosenV != null)) {
// d <=> convert to YY/MM/DD from iso string YYYY-MM-DD
if (colType == 'd') {
// console.log('setting date', colName, 'with', chosenV)
tgtElt.value = chosenV.replace(/-/g,'/')
tgtElt.dispatchEvent(new CustomEvent('change'))
}
// m <=> select saved menus
if (colType == 'm') {
// console.log('setting menu', colName, 'with', chosenV)
var myOption = tgtElt.querySelector(`option[value="${chosenV}"]`)
// normal case
if (myOption) {
tgtElt.selectedIndex = myOption.index
tgtElt.dispatchEvent(new CustomEvent('change'))
}
// this case is really just for org_type right now
else if (tgtElt.querySelector(`option[value="other"]`)) {
tgtElt.selectedIndex = tgtElt.querySelector(`option[value="other"]`).index
tgtElt.dispatchEvent(new CustomEvent('change'))
var relatedFreeTxt = document.getElementById('other_'+colName)
if (relatedFreeTxt) {
relatedFreeTxt.value = chosenV
relatedFreeTxt.dispatchEvent(new CustomEvent('change'))
}
}
// fallback case
else {
var optionOthers =
console.warn(`setupSavedItems: couldn't find option: ${chosenV} for select element: ${colName}`)
}
}
}
else {
// console.warn("setupSavedItems: couldn't find element: "+colName)
}
}
}
}
// 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 = []
if (uinfo.keywords.length) {
presentMtis.push(
{'id':'keywords', 'prevals': uinfo.keywords, 'readonly':true}
)
}
if (uinfo.hashtags.length) {
presentMtis.push(
{'id':'hashtags', 'prevals': uinfo.hashtags,'readonly':true, 'color': "#23A"}
)
}
// initialize readonly form controllers
var consultReturnDataUForm = cmxClt.uform.Form(
// id
"comex_claim_profile_form",
// onkeyup function
null,
// other params
{ 'multiTextinputs': presentMtis }
)
setupSavedItems(uinfo)
// open middlename if there is one
if (uinfo.middle_name != null
&& uinfo.middle_name != ""
&& uinfo.middle_name != "None") {
cmxClt.uform.displayMidName()
}
// the "re-create this account" form
......@@ -140,7 +32,8 @@ var returnForm = cmxClt.uauth.AuthForm(
{
'type': "doorsRegister",
// if email validation, captcha perhaps too much?
'validateCaptcha': false
'validateCaptcha': false,
'validateEmail': false
}
)
......
......@@ -66,7 +66,19 @@ cmxClt = (function(cC) {
// -> type
auForm.type = afParams.type || "login"
auForm.validateCaptcha = afParams.validateCaptcha || false
if (afParams.validateEmail != undefined) {
auForm.validateEmail = afParams.validateEmail
}
else {
auForm.validateEmail = true
}
if (afParams.validateCaptcha != undefined) {
auForm.validateCaptcha = afParams.validateCaptcha
}
else {
auForm.validateCaptcha = false
}
// -> interaction elements (params, else default)
var emailId, duuidId, passId, pass2Id, captchaId, capcheckId
......@@ -94,11 +106,13 @@ cmxClt = (function(cC) {
// 1) for email
// side-effects: email icon + message
auForm.elEmail.onkeyup = function(event) {
// console.debug('..elMail '+auForm.id+' event:'+event.type)
cC.uauth.testMailFormatAndExistence(auForm)
if (auForm.validateEmail) {
auForm.elEmail.onkeyup = function(event) {
// console.debug('..elMail '+auForm.id+' event:'+event.type)
cC.uauth.testMailFormatAndExistence(auForm)
}
auForm.elEmail.onchange = auForm.elEmail.onkeyup
}
auForm.elEmail.onchange = auForm.elEmail.onkeyup
// 2) for password
// login <=> just test password's length
......
This diff is collapsed.
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