Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Secfit Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
T2
Secfit Frontend
Commits
79733c7d
Commit
79733c7d
authored
4 years ago
by
Sigmund Berbom
Browse files
Options
Downloads
Plain Diff
Merge branch 'exercise_dropdown' into 'master'
added exercise select See merge request
!2
parents
63501a9f
c8db6b6a
No related branches found
No related tags found
1 merge request
!2
added exercise select
Pipeline
#114076
failed
4 years ago
Stage: production
Changes
2
Pipelines
4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
www/profilepage.html
+6
-1
6 additions, 1 deletion
www/profilepage.html
www/scripts/profilepage.js
+30
-6
30 additions, 6 deletions
www/scripts/profilepage.js
with
36 additions
and
7 deletions
www/profilepage.html
+
6
−
1
View file @
79733c7d
...
@@ -29,10 +29,15 @@
...
@@ -29,10 +29,15 @@
<input
type=
"date"
class=
"form-control"
id=
"birthday"
name=
"name"
readonly
>
<input
type=
"date"
class=
"form-control"
id=
"birthday"
name=
"name"
readonly
>
</div>
</div>
<div
class=
"col-lg-6"
></div>
<div
class=
"col-lg-6"
></div>
<div
class=
"col-lg-6 "
>
<div
class=
"col-lg-6 "
id=
"favoriteExercise-container"
>
<label
for=
"inputName"
class=
"form-label"
>
Favorite Exercise
</label>
<label
for=
"inputName"
class=
"form-label"
>
Favorite Exercise
</label>
<input
type=
"text"
class=
"form-control"
id=
"favoriteExercise"
name=
"name"
readonly
>
<input
type=
"text"
class=
"form-control"
id=
"favoriteExercise"
name=
"name"
readonly
>
</div>
</div>
<div
class=
"col-lg-6 hide"
id=
"favoriteExercise-select-container"
>
<label
class=
"form-label exercise-type"
>
Favorite Exercise
</label>
<select
class=
"form-select"
id=
"favoriteExercise-select"
name=
"type"
>
</select>
</div>
<div
class=
"col-lg-6"
></div>
<div
class=
"col-lg-6"
></div>
<div
class=
"col-lg-6 "
>
<div
class=
"col-lg-6 "
>
<label
for=
"inputName"
class=
"form-label"
>
Bio
</label>
<label
for=
"inputName"
class=
"form-label"
>
Bio
</label>
...
...
This diff is collapsed.
Click to expand it.
www/scripts/profilepage.js
+
30
−
6
View file @
79733c7d
...
@@ -29,26 +29,50 @@ function displayProfilePage(user) {
...
@@ -29,26 +29,50 @@ function displayProfilePage(user) {
const
favoriteExercise
=
document
.
getElementById
(
'
favoriteExercise
'
);
const
favoriteExercise
=
document
.
getElementById
(
'
favoriteExercise
'
);
favoriteExercise
.
value
=
user
.
favorite_exercise
favoriteExercise
.
value
=
user
.
favorite_exercise
// favoriteExercise.disabled = true;
// let option = document.createElement("option");
// option.value = user.favorite_exercise
// option.innerText = user.favorite_exercise
// favoriteExercise.append(option);
const
bio
=
document
.
getElementById
(
'
bio
'
);
const
bio
=
document
.
getElementById
(
'
bio
'
);
bio
.
value
=
user
.
bio
bio
.
value
=
user
.
bio
}
}
}
}
function
handleCancelDuringProfileEdit
()
{
function
handleCancelDuringProfileEdit
(
user
)
{
location
.
reload
();
location
.
reload
();
}
}
function
handleEditProfileButtonClick
()
{
async
function
handleEditProfileButtonClick
()
{
let
editProfileButton
=
document
.
querySelector
(
"
#edit-profile-page-button
"
);
const
editProfileButton
=
document
.
querySelector
(
"
#edit-profile-page-button
"
);
let
saveProfileButton
=
document
.
querySelector
(
"
#save-profile-page-button
"
);
const
saveProfileButton
=
document
.
querySelector
(
"
#save-profile-page-button
"
);
let
cancelProfileButton
=
document
.
querySelector
(
"
#cancel-profile-page-button
"
);
const
cancelProfileButton
=
document
.
querySelector
(
"
#cancel-profile-page-button
"
);
const
favoriteExercise
=
document
.
getElementById
(
'
favoriteExercise
'
);
const
favoriteExercise_select
=
document
.
getElementById
(
'
favoriteExercise-select
'
);
const
favoriteExercise_select_container
=
document
.
getElementById
(
'
favoriteExercise-select-container
'
);
const
favoriteExercise_container
=
document
.
getElementById
(
'
favoriteExercise-container
'
);
let
exerciseTypeResponse
=
await
sendRequest
(
"
GET
"
,
`
${
HOST
}
/api/exercises/`
);
let
exerciseTypes
=
await
exerciseTypeResponse
.
json
();
cancelProfileButton
.
addEventListener
(
"
click
"
,
handleCancelDuringProfileEdit
);
cancelProfileButton
.
addEventListener
(
"
click
"
,
handleCancelDuringProfileEdit
);
saveProfileButton
.
addEventListener
(
"
click
"
,
updateProfilePage
);
saveProfileButton
.
addEventListener
(
"
click
"
,
updateProfilePage
);
editProfileButton
.
classList
.
add
(
"
hide
"
);
editProfileButton
.
classList
.
add
(
"
hide
"
);
favoriteExercise_container
.
classList
.
add
(
"
hide
"
)
saveProfileButton
.
classList
.
remove
(
"
hide
"
);
saveProfileButton
.
classList
.
remove
(
"
hide
"
);
cancelProfileButton
.
classList
.
remove
(
"
hide
"
);
cancelProfileButton
.
classList
.
remove
(
"
hide
"
);
favoriteExercise_select_container
.
classList
.
remove
(
"
hide
"
)
favoriteExercise_select
.
disabled
=
false
;
for
(
let
j
=
0
;
j
<
exerciseTypes
.
count
;
j
++
)
{
let
option
=
document
.
createElement
(
"
option
"
);
option
.
value
=
exerciseTypes
.
results
[
j
].
name
;
option
.
innerText
=
exerciseTypes
.
results
[
j
].
name
;
favoriteExercise_select
.
append
(
option
);
}
setReadOnly
(
false
,
"
#form-profile
"
);
setReadOnly
(
false
,
"
#form-profile
"
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment