summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/templates/credentials.html
blob: f8c04bcbca58ec2f20073360a92b7b520e1ef2f7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<div>
	<form method="post" action="?do=locationinfo" id="credentialsForm">
		<input type="hidden" name="token" value="{{token}}">
		<input type="hidden" name="action" value="updateCredentials">
		<input type="hidden" name="id" value="{{id}}">
		<div id="div"></div>
		<button type="submit" class="btn btn-primary">{{lang_save}}</button>
	</form>
</div>
<script type="text/javascript">

	// {{name}} name of auth {{type}} type of auth (string, int etc.) {{value}} value from the db
	{{#credentials}}
	if ("{{type}}" == "string") {
		$("#div").before('<label>{{name}}</label><br><input required type="text" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>');
	} else if ("{{type}}" == "int") {
		$("#div").before('<label>{{name}}</label><br><input required type="number" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>');
	} else if ("{{type}}" == "bool") {
		$("#div").before('<label>{{name}}</label><br><input type="checkbox" name="{{name}}" value="{{value}}" form="credentialsForm"><br><br>');
	} else if ("{{type}}" == "array") {
		$("#div").before('<label>{{name}}</label><br>\
    <select name="{{name}}" form="credentialsForm">\
    {{#array}}\
      <option value="{{option}}" {{#active}}selected{{/active}}>{{option}}</option>\
    {{/array}}\
    </select>\
    <br><br>');
	}
	{{/credentials}}

</script>