Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gofeminin.de
signature-generator
Commits
ab365492
Commit
ab365492
authored
Apr 28, 2017
by
Marco Kellershoff
Browse files
Way to go..
parent
74c5f159
Changes
2
Hide whitespace changes
Inline
Side-by-side
app.js
View file @
ab365492
...
...
@@ -27,7 +27,7 @@
}
return
el
;
};
var
getData
=
function
(
url
,
opts
,
cb
)
{
var
getData
=
function
(
url
,
cb
,
opts
)
{
opts
=
opts
||
{};
var
passToCallback
=
function
(
json
)
{
cb
(
json
);
...
...
@@ -47,21 +47,54 @@
};
fetch
(
url
).
then
(
processData
);
};
var
createTemplateEl
=
function
(
data
)
{
var
node_name
=
'
input
'
;
switch
(
data
.
type
)
{
case
'
input
'
:
break
;
case
'
checkbox
'
:
break
;
default
:
break
;
}
};
var
loadTemplateFromJson
=
function
(
filename
)
{
var
app_container
=
query
(
'
#app
'
);
app_container
.
innerHTML
=
''
;
var
dataCallback
=
function
(
json
)
{
var
elementsCallback
=
function
(
elData
)
{
console
.
log
(
elData
);
};
json
.
data
.
forEach
(
elementsCallback
);
};
getData
(
'
data/
'
+
filename
,
dataCallback
);
};
var
renderPortalSelection
=
function
()
{
var
portals
=
[];
var
portals
=
[
createEl
(
'
option
'
,
''
,
[[
'
value
'
,
''
]])
];
var
portalsCallback
=
function
(
portal
)
{
var
el
=
createEl
(
'
option
'
,
portal
.
name
,
[
[
'
value
'
,
portal
.
data
]
]);
portals
.
push
(
el
);
};
var
selectChangeCallback
=
function
(
evt
)
{
var
selectedIndex
=
this
.
selectedIndex
,
selectedItem
=
this
.
children
[
selectedIndex
],
selectedValue
=
selectedItem
.
value
;
if
(
selectedValue
===
''
)
{
return
;
}
else
{
loadTemplateFromJson
(
selectedValue
);
}
};
var
cb
=
function
(
json
)
{
json
.
portals
.
forEach
(
portalsCallback
);
var
select
=
createEl
(
'
select
'
,
portals
);
select
.
addEventListener
(
'
change
'
,
selectChangeCallback
);
query
(
'
#app
'
).
appendChild
(
select
);
console
.
log
(
portals
);
};
getData
(
'
portals.json
'
,
null
,
cb
);
getData
(
'
portals.json
'
,
cb
);
};
var
init
=
function
()
{
renderPortalSelection
();
...
...
data/gofeminin.de.json
View file @
ab365492
{
"success"
:
true
,
"data"
:
[
{
"type"
:
"input"
,
"label"
:
"Vorname"
,
"value"
:
""
,
"placeholder"
:
""
},
{
"type"
:
"input"
,
"label"
:
"Nachname"
,
"value"
:
""
,
"placeholder"
:
""
},
{
"type"
:
"input"
,
"label"
:
"E-Mail"
,
"value"
:
""
,
"placeholder"
:
""
},
{
"type"
:
"input"
,
"label"
:
"Jobtitel"
,
"value"
:
""
,
"placeholder"
:
""
},
{
"type"
:
"input"
,
"label"
:
"Telefon"
,
"value"
:
"+49 (0) 22 1 / 28 325-"
,
"placeholder"
:
""
},
{
"type"
:
"input"
,
"label"
:
"Dienstliche Handynummer"
,
"value"
:
""
,
"placeholder"
:
"+49 175 1337 187"
},
{
"type"
:
"input"
,
"label"
:
"Fax"
,
"value"
:
"+49 (0) 22 1 / 28 325-555"
,
"placeholder"
:
""
},
{
"type"
:
"checkbox"
,
"label"
:
"News GIF"
,
"value"
:
"1"
},
{
"type"
:
"checkbox"
,
"label"
:
"BoxStories.de Banner"
,
"value"
:
"1"
}
]
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment