Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
mini-web
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit b10b3783
authored
2019-11-27 11:02:02 -0300
by
Georgina Mondino
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://git.anacsoft.com/Lusho/mini-web
2 parents
b25076c2
1bc58c48
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
9 deletions
Geo/Scripts/construct.js
Geo/generate.html
Luciano/static/Scripts/ArmadoDeForm.js
Luciano/static/Scripts/construct.js
Luciano/static/Style/ArmadoDeForm.css
Luciano/templates/generate.html
Geo/Scripts/construct.js
View file @
b10b378
...
...
@@ -114,4 +114,44 @@ function maxChild(container,number){
(
a
,
b
)
=>
fixinput
(
a
)
>
fixinput
(
b
)
?
a
:
b
);
return
fixinput
(
max
);
}
function
validate
(
obj
){
const
internal
=
"Hubo un error en la generación del formulario"
;
if
(
typeof
obj
!=
"object"
)
return
triggerError
(
internal
,
"not object"
);
for
(
let
t_it
=
0
;
t_it
<
obj
.
length
;
t_it
++
)
{
let
tab
=
obj
[
t_it
];
if
(
"Title"
in
tab
&&
"Fields"
in
tab
){
if
(
typeof
tab
.
Title
!=
"string"
)
return
triggerError
(
internal
,
"wrong type in tab title"
);
if
(
typeof
tab
.
Fields
!=
"object"
)
return
triggerError
(
internal
,
"wrong type in tab fields"
);
if
(
tab
.
Title
==
""
)
return
triggerError
(
"La tab "
+
(
t_it
+
1
)
+
" necesita un título"
,
"empty tab title"
);
if
(
tab
.
Fields
.
length
==
0
)
return
triggerError
(
"La tab "
+
(
t_it
+
1
)
+
" requiere campos"
,
"empty tab fields"
);
for
(
let
f_it
=
0
;
f_it
<
tab
.
Fields
.
length
;
f_it
++
)
{
let
field
=
tab
.
Fields
[
f_it
];
if
(
"Title"
in
field
&&
"Input"
in
field
&&
"Required"
in
field
)
{
if
(
typeof
field
.
Title
!=
"string"
)
return
triggerError
(
internal
,
"wrong type in field title"
);
if
(
typeof
field
.
Input
!=
"string"
)
return
triggerError
(
internal
,
"wrong type in field input"
);
if
(
typeof
field
.
Required
!=
"boolean"
)
return
triggerError
(
internal
,
"wrong type in field required"
);
if
(
field
.
Title
==
""
)
return
triggerError
(
"El campo "
+
(
f_it
+
1
)
+
" del tab "
+
(
t_it
+
1
)
+
" necesita un título"
,
"empty field title"
);
if
(
field
.
Input
==
""
)
return
triggerError
(
"El campo "
+
(
f_it
+
1
)
+
" del tab "
+
(
t_it
+
1
)
+
" necesita un input"
,
"empty field input"
);
}
else
{
return
triggerError
(
internal
,
"field lacks property"
)
}
}
}
else
{
return
triggerError
(
internal
,
"tab lacks property"
)
}
}
}
function
triggerError
(
type
,
log
){
let
out
=
"triggerError => \nerror_message = "
+
type
;
if
(
log
)
out
+=
"\nlog_message = "
+
log
;
console
.
log
(
out
);
document
.
getElementById
(
"ErrorMessage"
).
innerText
=
type
;
}
\ No newline at end of file
Geo/generate.html
View file @
b10b378
...
...
@@ -25,6 +25,7 @@
+
</button>
</div>
<p
id=
"ErrorMessage"
style=
"font-weight: bold; text-align: center; color: red;"
></p>
<h3
id=
"ContinuarText"
>
Cuando se encuentre conforme con el formulario presione Continuar
</h3>
<button
id=
"ContinuarButton"
onclick=
"ArmarForm( generate(document.getElementById('tabs')) )"
>
Continuar
</button>
...
...
Luciano/static/Scripts/ArmadoDeForm.js
View file @
b10b378
...
...
@@ -13,7 +13,7 @@ function ArmarForm(data) {
boton
.
setAttribute
(
"id"
,
"Boton"
+
n
);
boton
.
setAttribute
(
"value"
,
n
);
boton
.
setAttribute
(
"class"
,
"Botones"
);
boton
.
addEventListener
(
"click"
,
HabilitarTab
);
//boton.setAttribute("onclick", HabilitarTab(this)
);
let
ancho
=
((
100
-
(
0.2
*
m
))
/
m
)
+
"%"
;
boton
.
style
.
width
=
ancho
;
let
tab
=
document
.
createElement
(
"div"
);
...
...
@@ -25,9 +25,3 @@ function ArmarForm(data) {
document
.
getElementById
(
"Tab0"
).
style
.
display
=
"block"
;
}
function
HabilitarTab
()
{
for
(
let
n
=
0
;
n
<
m
;
n
++
)
{
document
.
getElementById
(
"Tab"
+
n
).
style
.
display
=
"none"
}
}
\ No newline at end of file
Luciano/static/Scripts/construct.js
View file @
b10b378
...
...
@@ -70,7 +70,9 @@ function processField(field){
function
processTab
(
tab
){
let
dict
=
[];
let
container
=
getDescendantByAttribute
(
tab
,
"name"
,
"Field"
).
parentElement
;
let
container
=
getDescendantByAttribute
(
tab
,
"name"
,
"Field"
);
if
(
container
==
null
)
return
dict
;
container
=
container
.
parentElement
;
for
(
let
i
=
0
;
i
<
container
.
children
.
length
;
i
++
){
if
(
container
.
children
[
i
].
getAttribute
(
"name"
)
==
"Field"
)
{
dict
.
push
(
processField
(
container
.
children
[
i
]));
...
...
@@ -112,4 +114,44 @@ function maxChild(container,number){
(
a
,
b
)
=>
fixinput
(
a
)
>
fixinput
(
b
)
?
a
:
b
);
return
fixinput
(
max
);
}
function
validate
(
obj
){
const
internal
=
"Hubo un error en la generación del formulario"
;
if
(
typeof
obj
!=
"object"
)
return
triggerError
(
internal
,
"not object"
);
for
(
let
t_it
=
0
;
t_it
<
obj
.
length
;
t_it
++
)
{
let
tab
=
obj
[
t_it
];
if
(
"Title"
in
tab
&&
"Fields"
in
tab
){
if
(
typeof
tab
.
Title
!=
"string"
)
return
triggerError
(
internal
,
"wrong type in tab title"
);
if
(
typeof
tab
.
Fields
!=
"object"
)
return
triggerError
(
internal
,
"wrong type in tab fields"
);
if
(
tab
.
Title
==
""
)
return
triggerError
(
"La tab "
+
(
t_it
+
1
)
+
" necesita un título"
,
"empty tab title"
);
if
(
tab
.
Fields
.
length
==
0
)
return
triggerError
(
"La tab "
+
(
t_it
+
1
)
+
" requiere campos"
,
"empty tab fields"
);
for
(
let
f_it
=
0
;
f_it
<
tab
.
Fields
.
length
;
f_it
++
)
{
let
field
=
tab
.
Fields
[
f_it
];
if
(
"Title"
in
field
&&
"Input"
in
field
&&
"Required"
in
field
)
{
if
(
typeof
field
.
Title
!=
"string"
)
return
triggerError
(
internal
,
"wrong type in field title"
);
if
(
typeof
field
.
Input
!=
"string"
)
return
triggerError
(
internal
,
"wrong type in field input"
);
if
(
typeof
field
.
Required
!=
"boolean"
)
return
triggerError
(
internal
,
"wrong type in field required"
);
if
(
field
.
Title
==
""
)
return
triggerError
(
"El campo "
+
(
f_it
+
1
)
+
" del tab "
+
(
t_it
+
1
)
+
" necesita un título"
,
"empty field title"
);
if
(
field
.
Input
==
""
)
return
triggerError
(
"El campo "
+
(
f_it
+
1
)
+
" del tab "
+
(
t_it
+
1
)
+
" necesita un input"
,
"empty field input"
);
}
else
{
return
triggerError
(
internal
,
"field lacks property"
)
}
}
}
else
{
return
triggerError
(
internal
,
"tab lacks property"
)
}
}
}
function
triggerError
(
type
,
log
){
let
out
=
"triggerError => \nerror_message = "
+
type
;
if
(
log
)
out
+=
"\nlog_message = "
+
log
;
console
.
log
(
out
);
document
.
getElementById
(
"ErrorMessage"
).
innerText
=
type
;
}
\ No newline at end of file
Luciano/static/Style/ArmadoDeForm.css
View file @
b10b378
...
...
@@ -21,7 +21,7 @@ html {
margin
:
0.1%
;
}
.Botones
:a
ctive
{
.Botones
A
ctive
{
background-color
:
var
(
--Color
);
border-bottom
:
none
;
height
:
6%
;
...
...
Luciano/templates/generate.html
View file @
b10b378
...
...
@@ -7,6 +7,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<link
rel=
"stylesheet"
href=
"{{url_for('static',filename='Style/Templates.css')}}"
>
<link
rel=
"stylesheet"
href=
"{{url_for('static',filename='Style/ArmadoDeForm.css')}}"
>
<link
href=
"https://fonts.googleapis.com/css?family=Montserrat&display=swap"
rel=
"stylesheet"
>
<title>
Generador de Formularios
</title>
<link
rel=
"icon"
href=
"{{url_for('static',filename='Assets/ICONO ANACSOFT 48 SIN TRASNSF.png')}}"
type=
"image/png"
>
...
...
@@ -24,6 +25,7 @@
+
</button>
</div>
<p
id=
"ErrorMessage"
style=
"font-weight: bold; text-align: center; color: red;"
></p>
<h3
id=
"ContinuarText"
>
Cuando se encuentre conforme con el formulario presione Continuar
</h3>
<button
id=
"ContinuarButton"
onclick=
"ArmarForm( generate(document.getElementById('tabs')) )"
>
Continuar
</button>
</section>
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment