diff --git a/src/app/pages/settings/settings.page.html b/src/app/pages/settings/settings.page.html
index 3ba2b6f..88ddb6a 100644
--- a/src/app/pages/settings/settings.page.html
+++ b/src/app/pages/settings/settings.page.html
@@ -1,28 +1,44 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/app/pages/settings/settings.page.scss b/src/app/pages/settings/settings.page.scss
index 9ee20ad..ebacda2 100644
--- a/src/app/pages/settings/settings.page.scss
+++ b/src/app/pages/settings/settings.page.scss
@@ -1,3 +1,20 @@
-mat-form-field {
+mat-form-field, mat-slider {
display: block;
}
+
+form {
+ margin-left: 15px;
+ margin-bottom: 15px;
+
+ @media screen and (min-width: 576px) {
+ max-width: 100%;
+ }
+
+ @media screen and (min-width: 768px) {
+ max-width: 80%;
+ }
+
+ @media screen and (min-width: 992px) {
+ max-width: 50%;
+ }
+}
\ No newline at end of file
diff --git a/src/app/pages/settings/settings.page.ts b/src/app/pages/settings/settings.page.ts
index 352e6d7..fb754f8 100644
--- a/src/app/pages/settings/settings.page.ts
+++ b/src/app/pages/settings/settings.page.ts
@@ -26,15 +26,20 @@ export class PageSettings implements OnInit {
username: [ { disabled: true }, Validators.nullValidator ],
email: [ '', Validators.nullValidator ],
about: [ '', Validators.nullValidator ],
+ gravity: [ '', Validators.nullValidator ],
});
this.form.get('username').disable();
this.userService.get().subscribe(user => {
this.user = user;
+ if (!this.user.settings) {
+ this.user.settings = {};
+ }
this.form.get('username').setValue(this.user.username);
this.form.get('email').setValue(this.user.email);
this.form.get('about').setValue(this.user.about);
+ this.form.get('gravity').setValue(this.user.settings.gravity || this.user.metadata.defaultGravity);
})
}
@@ -42,6 +47,11 @@ export class PageSettings implements OnInit {
return this.form.controls[ controlName ].errors != null;
}
+ resetGravity(): void {
+ this.user.settings.gravity = null;
+ this.form.get('gravity').setValue(this.user.metadata.defaultGravity);
+ }
+
save(): void {
if (this.working) {
return;
@@ -53,8 +63,21 @@ export class PageSettings implements OnInit {
this.user.about = this.form.get('about').value;
this.user.email = this.form.get('email').value;
+ if (!this.user.settings) {
+ this.user.settings = {};
+ }
+
+ if (this.form.get('gravity').value != this.user.metadata.defaultGravity && !this.user.settings.gravity) {
+ this.user.settings.gravity = this.form.get('gravity').value;
+ } else if (this.user.settings.gravity) {
+ this.user.settings.gravity = this.form.get('gravity').value;
+ }
+
this.userService.update(this.user).subscribe((data) => {
this.user = data;
+ if (!this.user.settings) {
+ this.user.settings = {};
+ }
this.working = false;
this.success = true;
}, (error) => {
diff --git a/src/app/pages/submission/submission.page.html b/src/app/pages/submission/submission.page.html
index 3bdd329..3da82c0 100644
--- a/src/app/pages/submission/submission.page.html
+++ b/src/app/pages/submission/submission.page.html
@@ -1,44 +1,48 @@
-