adejs/controllers/settings/templates/settings.pug

73 lines
2.8 KiB
Plaintext
Raw Normal View History

2017-09-24 01:03:25 +02:00
extends ../../../templates/base.pug
block content
form(method="POST", action=getUrl("settingsTarget"))
.form-group.row
.col-2
label.col-2.col-form-label(for="username") Username
.col-6
input.form-control(type="text", value=session.user.username, disabled, name="username", id="username")
2017-09-24 01:03:25 +02:00
.col-2
.form-group.row
.col-2
label.col-2.col-form-label(for="email") Email
.col-6
input.form-control(type="email", value=session.user.email, disabled, name="email", id="email")
2017-09-24 01:03:25 +02:00
.col-2
.form-group.row
.col-2
label.col-2.col-form-label(for="resources") Resources
.col-6
input.form-control(type="number", value=session.user.resources, name="resources", id="resources")
2017-09-24 01:03:25 +02:00
.col-2
.form-group.row
.col-2
label.col-2.col-form-label(for="projectId") Project id
.col-6
input.form-control(type="number", value=session.user.projectId, name="projectId", id="projectId")
2017-09-24 01:03:25 +02:00
.col-2
.form-group.row
.col-2
.col-8.form-text.text-muted.
If you don't know your resources and your project id, simply go
2017-09-26 09:09:26 +02:00
to your edt, click the export button, click on <em>Generate
url</em>, copy the url you get and paste it in the field below,
and click the <em>Set from url</em> button.
.col-2
.form-group.row
.col-2
label.col-2.col-from-label(for="url") Set from url
.col-4
input.form-control(type="text", id="url", placeholder="Url generated from edt")
.col-2
#urlButton.btn.btn-primary Set from url
2017-09-24 01:03:25 +02:00
.form-group.row
.col-4
.col-4
input.btn.btn-primary.form-control(type="submit", value="Submit")
.col-4
block extrajs
script.
var urlButton = document.getElementById('urlButton');
var url = document.getElementById('url');
var resources = document.getElementById('resources');
var projectId = document.getElementById('projectId');
urlButton.addEventListener('click', function() {
var urlContent = url.value;
var values = urlContent.split('?')[1].split('&');
for (var i = 0; i < values.length; i++) {
var params = values[i].split('=');
var key = params[0];
if (key === 'resources') {
resources.value = parseInt(params[1], 10);
} else if (key === 'projectId') {
projectId.value = parseInt(params[1], 10);
}
}
});