2013-12-27 04:38:35 +00:00
|
|
|
doctype html
|
|
|
|
html(lang="en")
|
|
|
|
head
|
|
|
|
include head
|
2016-07-07 08:11:56 +00:00
|
|
|
+head()
|
2013-12-27 04:38:35 +00:00
|
|
|
body
|
|
|
|
#wrap
|
|
|
|
nav.navbar.navbar-inverse.navbar-fixed-top(role="navigation")
|
|
|
|
include nav
|
2016-07-07 08:11:56 +00:00
|
|
|
+navheader()
|
2013-12-27 04:38:35 +00:00
|
|
|
#nav-collapsible.collapse.navbar-collapse
|
|
|
|
ul.nav.navbar-nav
|
2016-07-07 08:11:56 +00:00
|
|
|
+navdefaultlinks("/account/profile")
|
|
|
|
+navloginlogout("/account/profile")
|
2013-12-27 04:38:35 +00:00
|
|
|
section#mainpage
|
|
|
|
.container
|
|
|
|
if !loggedIn
|
|
|
|
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
|
|
|
|
.alert.alert-danger.messagebox.center
|
|
|
|
strong Authorization Required
|
|
|
|
p You must be <a href="/login">logged in</a> to view this page.
|
|
|
|
else
|
|
|
|
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3
|
|
|
|
h3 Profile
|
|
|
|
if profileError
|
|
|
|
.alert.alert-danger.center.messagebox
|
|
|
|
strong Profile Error
|
|
|
|
p= profileError
|
2014-02-27 23:26:49 +00:00
|
|
|
.profile-box.linewrap(style="position: inherit; z-index: auto;")
|
2014-01-20 18:42:20 +00:00
|
|
|
img.profile-image(src=profileImage)
|
|
|
|
strong= loginName
|
|
|
|
p= profileText
|
2013-12-27 04:38:35 +00:00
|
|
|
h3 Edit Profile
|
|
|
|
form(action="/account/profile", method="post", role="form")
|
2015-02-23 00:15:22 +00:00
|
|
|
input(type="hidden", name="_csrf", value=csrfToken)
|
2013-12-27 04:38:35 +00:00
|
|
|
.form-group
|
|
|
|
label.control-label(for="profileimage") Image
|
2016-12-14 06:44:23 +00:00
|
|
|
input#profileimage.form-control(type="text", name="image", maxlength="255")
|
2013-12-27 04:38:35 +00:00
|
|
|
.form-group
|
|
|
|
label.control-label(for="profiletext") Text
|
2016-12-14 06:44:23 +00:00
|
|
|
textarea#profiletext.form-control(cols="10", name="text", maxlength="255")= profileText
|
2013-12-27 04:38:35 +00:00
|
|
|
button.btn.btn-primary.btn-block(type="submit") Save
|
|
|
|
|
|
|
|
include footer
|
2016-07-07 08:11:56 +00:00
|
|
|
+footer()
|
2014-01-20 18:42:20 +00:00
|
|
|
script(type="text/javascript").
|
2016-12-14 06:44:23 +00:00
|
|
|
var $profileImage = $("#profileimage");
|
|
|
|
$profileImage.val("#{profileImage}");
|
|
|
|
var hasError = false;
|
|
|
|
function validateImage() {
|
|
|
|
var value = $profileImage.val().trim();
|
|
|
|
$profileImage.val(value);
|
|
|
|
if (!/^$|^https:/.test(value)) {
|
|
|
|
hasError = true;
|
|
|
|
$profileImage.parent().addClass("has-error");
|
|
|
|
var $error = $("#profileimage-error");
|
|
|
|
if ($error.length === 0) {
|
|
|
|
$error = $("<p/>")
|
|
|
|
.attr({ id: "profileimage-error" })
|
|
|
|
.addClass("text-danger")
|
|
|
|
.html("Profile image must be a URL beginning with <code>https://</code>")
|
|
|
|
.insertAfter($profileImage);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
hasError = false;
|
|
|
|
$profileImage.parent().removeClass("has-error");
|
|
|
|
$("#profileimage-error").remove();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$("form").submit(function (event) {
|
|
|
|
validateImage();
|
|
|
|
if (hasError) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
});
|