Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Frontend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
IDATT2106 Scrum Team 02
Frontend
Commits
c4ba80e2
Commit
c4ba80e2
authored
1 year ago
by
Ingrid Martinsheimen Egge
Browse files
Options
Downloads
Patches
Plain Diff
opprydding og småendringer
parent
c38b0447
No related branches found
Branches containing commit
No related tags found
1 merge request
!21
Merge profilinnstillinger into main
Pipeline
#224318
failed with stages
Stage:
Stage:
in 1 minute and 40 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/components/EditAccount.vue
+10
-1
10 additions, 1 deletion
src/components/EditAccount.vue
src/components/EditProfile.vue
+37
-29
37 additions, 29 deletions
src/components/EditProfile.vue
src/style.scss
+2
-0
2 additions, 0 deletions
src/style.scss
src/util/API.js
+3
-3
3 additions, 3 deletions
src/util/API.js
with
52 additions
and
33 deletions
src/components/EditAccount.vue
+
10
−
1
View file @
c4ba80e2
<
template
>
<
template
>
<h
1
>
Konto-innstillinger
</h
1
>
<h
2
>
Konto-innstillinger
</h
2
>
<form
@
submit.prevent=
"submit"
>
<form
@
submit.prevent=
"submit"
>
<p
class=
"infoText"
>
OBS: Kontakt admin dersom du ønsker å oppdatere epost
</p><br>
<p
class=
"infoText"
>
OBS: Kontakt admin dersom du ønsker å oppdatere epost
</p><br>
...
@@ -203,6 +203,15 @@ button:hover{
...
@@ -203,6 +203,15 @@ button:hover{
background-color
:
darkred
;
background-color
:
darkred
;
}
}
button
:hover
{
background-color
:
base
.
$green-hover
;
}
.delBtn
:hover
{
background-color
:
base
.
$darkred-hover
;
}
#dangerZone
{
#dangerZone
{
color
:
darkred
;
color
:
darkred
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/components/EditProfile.vue
+
37
−
29
View file @
c4ba80e2
<
template
>
<
template
>
<h
1><br><br
>
Profilinnstillinger
<br>
</h
1
>
<h
2
>
Profilinnstillinger
</h
2
>
<div
v-if=
"hasProfileImage"
id =
"profilepicture-container"
>
<div
v-if=
"hasProfileImage"
id =
"profilepicture-container"
>
<img
width=
"100"
:src=
"this.updatedProfile.upImage"
alt=
"profile picture"
>
<img
width=
"100"
:src=
"this.updatedProfile.upImage"
alt=
"profile picture"
>
...
@@ -8,14 +8,14 @@
...
@@ -8,14 +8,14 @@
<Icon
icon=
"material-symbols:person"
:color=
iconColor
:style=
"
{ fontSize: '500px'}" />
<Icon
icon=
"material-symbols:person"
:color=
iconColor
:style=
"
{ fontSize: '500px'}" />
</div>
</div>
<h
2
>
{{
this
.
profile
.
name
}}
</h
2
>
<h
3
>
{{
this
.
profile
.
name
}}
</h
3
>
<button
@
click=
"changeProfile"
id=
"changeUserBtn"
>
Bytt bruker
</button>
<button
@
click=
"changeProfile"
id=
"changeUserBtn"
>
Bytt bruker
</button>
<form
@
submit.prevent=
"submit"
>
<form
@
submit.prevent=
"submit"
>
<label
for=
"brukernavn"
>
Profilnavn
</label><br>
<label
for=
"brukernavn"
>
Profilnavn
</label><br>
<input
type=
"text"
required
v-model=
"this.updatedProfile.upName"
><br>
<input
type=
"text"
required
v-model=
"this.updatedProfile.upName"
><br>
<br>
<br>
<h
4
>
Brukertype
</h
4
>
<h
3
>
Brukertype
</h
3
>
<input
type=
"radio"
id=
"normal"
value=
"false"
name=
"restrict"
v-model=
"this.updatedProfile.upRestricted"
>
<input
type=
"radio"
id=
"normal"
value=
"false"
name=
"restrict"
v-model=
"this.updatedProfile.upRestricted"
>
<label
for=
"normal"
>
Standard
</label><br>
<label
for=
"normal"
>
Standard
</label><br>
...
@@ -32,8 +32,9 @@
...
@@ -32,8 +32,9 @@
<Icon
icon=
"material-symbols:person"
:color=
iconColor
:style=
"
{ fontSize: '30px'}" />
<Icon
icon=
"material-symbols:person"
:color=
iconColor
:style=
"
{ fontSize: '30px'}" />
</div>
</div>
<label
for=
"chooseImageUrl"
>
Bilde-URL:
</label>
<label
for=
"chooseImageUrl"
>
Bilde-URL:
</label><br>
<input
type=
"text"
id=
"chooseImageUrl"
v-model=
"this.updatedProfile.upImage"
>
<input
type=
"file"
id=
"chooseImage"
v-on:change=
"updateImage"
>
<!--
<input
type=
"text"
id=
"chooseImageUrl"
v-model=
"this.updatedProfile.upImage"
>
-->
</div>
</div>
<br><br>
<br><br>
...
@@ -64,7 +65,6 @@ export default {
...
@@ -64,7 +65,6 @@ export default {
}
}
},
},
computed
:
{
computed
:
{
...
mapState
(
useAuthStore
,
[
'
profile
'
]),
...
mapState
(
useAuthStore
,
[
'
profile
'
]),
...
mapStores
(
useAuthStore
),
...
mapStores
(
useAuthStore
),
updatedProfile
()
{
updatedProfile
()
{
...
@@ -75,13 +75,32 @@ export default {
...
@@ -75,13 +75,32 @@ export default {
}
}
},
},
iconColor
()
{
iconColor
()
{
return
"
#
000000
"
return
"
#
D9D9D9
"
},
},
hasProfileImage
()
{
hasProfileImage
()
{
return
this
.
updatedProfile
.
upImage
.
length
>
0
;
return
this
.
updatedProfile
.
upImage
.
length
>
0
;
}
}
},
},
methods
:
{
methods
:
{
changeProfile
(){
router
.
push
(
"
/selectProfile
"
);
},
async
deleteProfile
()
{
const
id
=
this
.
profile
.
id
;
API
.
deleteProfile
(
id
).
then
(()
=>
{
router
.
push
(
'
/selectProfile
'
)
}).
catch
((
error
)
=>
{
this
.
setAlertText
(
"
Det oppsto en feil ved sletting profil:
"
+
error
,
'
red
'
)
})
},
updateImage
(){
//todo update image preview
},
saveUserSettings
(){
saveUserSettings
(){
const
id
=
this
.
profile
.
id
;
const
id
=
this
.
profile
.
id
;
...
@@ -108,22 +127,8 @@ export default {
...
@@ -108,22 +127,8 @@ export default {
chooseProfilePicture
(){
chooseProfilePicture
(){
this
.
setAlertText
(
"
skriv inn bildelenke i feltet, og oppdater innstillinger
"
,
'
black
'
)
this
.
setAlertText
(
"
skriv inn bildelenke i feltet, og oppdater innstillinger
"
,
'
black
'
)
},
},
changeProfile
(){
router
.
push
(
"
/selectProfile
"
);
},
deleteProfile
(){
const
numOfProfiles
=
API
.
getProfiles
().
length
if
(
numOfProfiles
===
1
){
this
.
setAlertText
(
"
Du kan ikke slette profilen. Hver Konto må ha minst en profil
"
,
'
red
'
)
}
else
{
const
id
=
this
.
profile
.
id
;
API
.
deleteProfile
(
id
).
then
(()
=>
{
router
.
push
(
'
/selectProfile
'
)
}).
catch
((
error
)
=>
{
this
.
setAlertText
(
"
Det oppsto en feil ved sletting profil
"
,
'
red
'
)
})
}
},
setAlertText
(
text
,
color
){
setAlertText
(
text
,
color
){
switch
(
color
)
{
switch
(
color
)
{
case
'
red
'
:
case
'
red
'
:
...
@@ -210,29 +215,32 @@ input[type="password"]{
...
@@ -210,29 +215,32 @@ input[type="password"]{
button
{
button
{
background-color
:
base
.
$red
;
background-color
:
base
.
$red
;
color
:
black
;
color
:
black
;
border
:
1px
solid
black
;
border
:
1px
solid
black
;
margin
:
1em
;
margin
:
1em
;
}
}
button
:hover
{
background-color
:
base
.
$red-hover
;
}
#changeUserBtn
{
#changeUserBtn
{
padding
:
.9em
;
padding
:
.9em
;
}
}
button
:hover
{
background-color
:
#282828
;
.delBtn
:hover
{
background-color
:
base
.
$darkred-hover
;
}
}
.saveBtn
,
.delBtn
{
.saveBtn
,
.delBtn
{
background-color
:
base
.
$green
;
background-color
:
base
.
$green
;
color
:
white
;
color
:
white
;
font-weight
:
bold
;
font-weight
:
bold
;
padding
:
.9em
;
padding
:
.9em
;
border
:none
;
border
:none
;
}
}
.saveBtn
:hover
{
background-color
:
base
.
$green-hover
;
}
.delBtn
{
.delBtn
{
background-color
:
darkred
;
background-color
:
darkred
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/style.scss
+
2
−
0
View file @
c4ba80e2
...
@@ -4,10 +4,12 @@ $light-green: hsla(160, 100%, 37%, 1);
...
@@ -4,10 +4,12 @@ $light-green: hsla(160, 100%, 37%, 1);
$white
:
#FFFFFF
;
$white
:
#FFFFFF
;
$grey
:
#D9D9D9
;
$grey
:
#D9D9D9
;
$red
:
#EE6D6D
;
$red
:
#EE6D6D
;
$darkred
:
darkred
;
$red-hover
:
darken
(
$red
,
5%
);
$red-hover
:
darken
(
$red
,
5%
);
$green-hover
:
darken
(
$green
,
8%
);
$green-hover
:
darken
(
$green
,
8%
);
$light-green-hover
:
darken
(
$light-green
,
10%
);
$light-green-hover
:
darken
(
$light-green
,
10%
);
$darkred-hover
:
darken
(
darkred
,
10%
);
$desktop-min
:
800px
;
$desktop-min
:
800px
;
...
...
This diff is collapsed.
Click to expand it.
src/util/API.js
+
3
−
3
View file @
c4ba80e2
...
@@ -235,7 +235,7 @@ export const API = {
...
@@ -235,7 +235,7 @@ export const API = {
throw
new
Error
(
"
Could not fetch fridge item
"
);
throw
new
Error
(
"
Could not fetch fridge item
"
);
});
});
},
},
},
/**
/**
* Deletes account from the
* Deletes account from the
...
@@ -256,8 +256,8 @@ export const API = {
...
@@ -256,8 +256,8 @@ export const API = {
authStore
.
logout
()
authStore
.
logout
()
router
.
push
(
'
/login
'
)
router
.
push
(
'
/login
'
)
})
})
.
catch
(()
=>
{
.
catch
((
error
)
=>
{
throw
new
Error
(
""
);
throw
new
Error
(
error
);
});
});
},
},
...
...
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