Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDT4242-group15
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
Vegard Murvold Sporstøl
TDT4242-group15
Commits
355e9d97
Commit
355e9d97
authored
4 years ago
by
Irina Kera Gundersen
Browse files
Options
Downloads
Patches
Plain Diff
Add everything except backend
parent
9bd5e066
No related branches found
No related tags found
1 merge request
!6
Uc 1
Pipeline
#113682
passed
4 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/www/scripts/workout.js
+30
-1
30 additions, 1 deletion
frontend/www/scripts/workout.js
frontend/www/workout.html
+2
-4
2 additions, 4 deletions
frontend/www/workout.html
with
32 additions
and
5 deletions
frontend/www/scripts/workout.js
+
30
−
1
View file @
355e9d97
...
...
@@ -134,6 +134,22 @@ function athleteChecked() {
myself
.
style
.
display
=
"
block
"
;
}
}
async
function
athletesInDropdown
()
{
let
ath
=
document
.
getElementById
(
"
athletes
"
);
let
currentUser
=
await
getCurrentUser
();
console
.
log
(
"
hei
"
);
console
.
log
(
currentUser
.
username
);
console
.
log
(
currentUser
.
athletes
);
for
(
let
athleteUrl
of
currentUser
.
athletes
)
{
let
newElement
=
document
.
createElement
(
"
option
"
);
let
response
=
await
sendRequest
(
"
GET
"
,
athleteUrl
);
let
athlete
=
await
response
.
json
();
console
.
log
(
athlete
);
newElement
.
text
=
athlete
.
username
;
ath
.
add
(
newElement
);
}
click
=
true
;
}
function
handleEditWorkoutButtonClick
()
{
let
addExerciseButton
=
document
.
querySelector
(
"
#btn-add-exercise
"
);
...
...
@@ -192,6 +208,9 @@ async function updateWorkout(id) {
location
.
reload
();
}
}
function
getOwnerID
(
username
)
{
return
username
.
url
;
}
function
generateWorkoutForm
()
{
let
form
=
document
.
querySelector
(
"
#form-workout
"
);
...
...
@@ -380,6 +399,7 @@ window.addEventListener("DOMContentLoaded", async () => {
const
id
=
urlParams
.
get
(
"
id
"
);
let
workoutData
=
await
retrieveWorkout
(
id
);
await
retrieveComments
(
id
);
console
.
log
(
currentUser
.
url
);
if
(
workoutData
[
"
owner
"
]
==
currentUser
.
url
)
{
editWorkoutButton
.
classList
.
remove
(
"
hide
"
);
...
...
@@ -400,8 +420,17 @@ window.addEventListener("DOMContentLoaded", async () => {
}
}
else
{
await
createBlankExercise
();
let
ownerInput
=
document
.
querySelector
(
"
#inputOwner
"
);
coach
=
false
;
//sjekke om den er huket av
let
query
=
"
#inputOwner
"
;
let
ownerInput
=
document
.
querySelector
(
query
);
ownerInput
.
value
=
currentUser
.
username
;
if
(
coach
)
{
query
=
"
#athletes
"
;
ownerInput
=
document
.
querySelector
(
query
);
ownerInput
.
value
=
"
athlete1
"
;
}
console
.
log
(
ownerInput
.
value
);
setReadOnly
(
false
,
"
#form-workout
"
);
ownerInput
.
readOnly
=
!
ownerInput
.
readOnly
;
...
...
This diff is collapsed.
Click to expand it.
frontend/www/workout.html
+
2
−
4
View file @
355e9d97
...
...
@@ -69,12 +69,10 @@
<select
id=
"athletes"
class=
"form-select"
name=
"
athletes
"
name=
"
owner_username
"
style=
"display:none"
onclick=
"athletesInDropdown(); this.onclick=null;"
>
<option
value=
"1"
>
athlete 1
</option>
<option
value=
"2"
>
athlete 2
</option>
<option
value=
"3"
>
athlete 3
</option>
</select>
<input
...
...
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