Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SkuciSe
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tim 2 - 2022
SkuciSe
Commits
c00ddb48
Commit
c00ddb48
authored
Sep 04, 2022
by
Bogdan Andjelkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profile edit i profil edit save
parent
e8371de9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
SkuciSe/src/main/java/com/example/SkuciSe/controller/ProfileController.java
+11
-3
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
+0
-1
SkuciSe/src/main/resources/templates/profile-edit.html
+1
-1
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/ProfileController.java
View file @
c00ddb48
...
@@ -37,11 +37,19 @@ public class ProfileController
...
@@ -37,11 +37,19 @@ public class ProfileController
return
(
"profile"
);
return
(
"profile"
);
}
}
@PostMapping
(
"/profile-update"
)
@GetMapping
(
"/profile/edit"
)
public
String
postProfileEdit
(
Model
model
,
@ModelAttribute
Korisnik
korisnik
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
)
public
String
getProfileEdit
(
Model
model
,
@ModelAttribute
Korisnik
korisnik
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
)
{
model
.
addAttribute
(
"loggedUser"
,
loggedUser
);
model
.
addAttribute
(
"editUser"
,
loggedUser
.
getKorisnik
());
model
.
addAttribute
(
"lokacije"
,
lRepo
.
findAll
());
loggedUser
.
setKorisnik
(
korisnik
);
return
"/profile-edit"
;
}
@PostMapping
(
"/profile/edit-save"
)
public
String
postProfileEditSave
(
Model
model
,
@ModelAttribute
Korisnik
korisnik
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
)
{
{
kRepo
.
update
(
korisnik
);
kRepo
.
update
(
korisnik
);
System
.
out
.
println
(
korisnik
.
toString
());
loggedUser
.
setKorisnik
(
korisnik
);
loggedUser
.
setKorisnik
(
korisnik
);
return
"redirect:/profile"
;
return
"redirect:/profile"
;
}
}
...
...
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
View file @
c00ddb48
...
@@ -45,7 +45,6 @@ public class KorisnikRepository
...
@@ -45,7 +45,6 @@ public class KorisnikRepository
"',gradId = '"
+
korisnik
.
getGradId
()
+
"',gradId = '"
+
korisnik
.
getGradId
()
+
"' where korisnikid = "
+
korisnik
.
getKorisnikId
();
"' where korisnikid = "
+
korisnik
.
getKorisnikId
();
try
{
try
{
System
.
out
.
println
(
sql
);
dataBase
.
statement
.
executeUpdate
(
sql
);
dataBase
.
statement
.
executeUpdate
(
sql
);
}
catch
(
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
throw
new
RuntimeException
(
e
);
...
...
SkuciSe/src/main/resources/templates/profil-edit.html
→
SkuciSe/src/main/resources/templates/profil
e
-edit.html
View file @
c00ddb48
...
@@ -82,7 +82,7 @@
...
@@ -82,7 +82,7 @@
<div
class=
"form-content"
style=
"bottom:50px;"
>
<div
class=
"form-content"
style=
"bottom:50px;"
>
<div
class=
"form-items"
>
<div
class=
"form-items"
>
<form
class=
"requires-validation"
novalidate
th:object=
"${editUser}"
method=
"POST"
<form
class=
"requires-validation"
novalidate
th:object=
"${editUser}"
method=
"POST"
th:action=
"@{/profile
-updat
e}"
enctype=
"multipart/form-data"
>
th:action=
"@{/profile
/edit-sav
e}"
enctype=
"multipart/form-data"
>
<input
th:field=
"${editUser.korisnikId}"
class=
"form-control"
type=
"hidden"
<input
th:field=
"${editUser.korisnikId}"
class=
"form-control"
type=
"hidden"
name=
"name"
placeholder=
"Ime"
required
>
name=
"name"
placeholder=
"Ime"
required
>
<div
class=
"col-md-12"
>
<div
class=
"col-md-12"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment