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
c39022db
Commit
c39022db
authored
Sep 01, 2022
by
Bogdan Andjelkovic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
profile picture upload - solved
parent
bc58a92b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
9 deletions
+23
-9
SkuciSe/src/main/java/com/example/SkuciSe/controller/AppController.java
+3
-5
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
+16
-0
SkuciSe/src/main/resources/templates/index.html
+3
-3
SkuciSe/src/main/resources/templates/profile.html
+1
-1
No files found.
SkuciSe/src/main/java/com/example/SkuciSe/controller/AppController.java
View file @
c39022db
...
@@ -54,13 +54,11 @@ public class AppController
...
@@ -54,13 +54,11 @@ public class AppController
return
(
"redirect:/login"
);
return
(
"redirect:/login"
);
}
}
@GetMapping
(
"/profile
/{korisnikid}
"
)
@GetMapping
(
"/profile"
)
public
String
getProfile
(
@PathVariable
(
"korisnikid"
)
int
korisnikid
,
Model
model
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
)
public
String
getProfile
(
Model
model
,
@AuthenticationPrincipal
KorisnikDetails
loggedUser
)
{
{
Korisnik
profile
=
kRepo
.
findById
(
korisnikid
);
System
.
out
.
println
(
profile
.
toString
());
model
.
addAttribute
(
"korisnik"
,
profile
);
model
.
addAttribute
(
"loggedUser"
,
loggedUser
);
model
.
addAttribute
(
"loggedUser"
,
loggedUser
);
model
.
addAttribute
(
"profileRole"
,
kRepo
.
findRoleById
(
loggedUser
.
getKorisnik
().
getTipId
()));
return
(
"profile"
);
return
(
"profile"
);
}
}
}
}
SkuciSe/src/main/java/com/example/SkuciSe/repository/KorisnikRepository.java
View file @
c39022db
...
@@ -69,4 +69,20 @@ public class KorisnikRepository
...
@@ -69,4 +69,20 @@ public class KorisnikRepository
}
}
return
(
null
);
return
(
null
);
}
}
public
String
findRoleById
(
int
tipid
)
{
String
sql
=
"select * from tipkorisnika where tipId = "
+
tipid
;
ResultSet
rs
=
null
;
try
{
rs
=
statement
.
executeQuery
(
sql
);
while
(
rs
.
next
())
{
return
rs
.
getString
(
"naziv"
);
}
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
e
);
}
return
(
null
);
}
}
}
SkuciSe/src/main/resources/templates/index.html
View file @
c39022db
...
@@ -40,9 +40,9 @@
...
@@ -40,9 +40,9 @@
<i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span>
<i
class=
"fa-solid fa-circle-user"
></i><span
style=
"padding:5px;"
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span>
</button>
</button>
<div
class=
"dropdown-menu"
aria-labelledby=
"dropdownMenuButton"
>
<div
class=
"dropdown-menu"
aria-labelledby=
"dropdownMenuButton"
>
<a
class=
"dropdown-item"
th:href=
"@{/profile
/{korisnikid}(korisnikid=${loggedUser.getKorisnik().getKorisnikId()})
}"
>
Moj Profil
</a>
<a
class=
"dropdown-item"
th:href=
"@{/profile}"
>
Moj Profil
</a>
<a
class=
"dropdown-item"
th:href=
"@{/mojioglasi
/{korisnikid}(korisnikid=${loggedUser.getKorisnik().getKorisnikId()})
}"
>
Moji Oglasi
</a>
<a
class=
"dropdown-item"
th:href=
"@{/mojioglasi}"
>
Moji Oglasi
</a>
<a
class=
"dropdown-item"
th:href=
"@{/mojizahtevi
/{korisnikid}(korisnikid=${loggedUser.getKorisnik().getKorisnikId()})
}"
>
Moji Zahtevi
</a>
<a
class=
"dropdown-item"
th:href=
"@{/mojizahtevi}"
>
Moji Zahtevi
</a>
<form
th:action=
"@{/logout}"
method=
"post"
id=
"my_form"
class=
"dropdown-item"
>
<form
th:action=
"@{/logout}"
method=
"post"
id=
"my_form"
class=
"dropdown-item"
>
<a
href=
"#"
onclick=
"document.getElementById('my_form').submit(); return false;"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Odjavi se
</span></a>
<a
href=
"#"
onclick=
"document.getElementById('my_form').submit(); return false;"
><i
class=
"fas fa-sign-in-alt"
></i><span
style=
"padding:5px;"
>
Odjavi se
</span></a>
</form>
</form>
...
...
SkuciSe/src/main/resources/templates/profile.html
View file @
c39022db
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
<div
class=
"d-flex flex-column align-items-center"
>
<div
class=
"d-flex flex-column align-items-center"
>
<img
class=
"photo"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${loggedUser.getKorisnik().getSlika()}}"
alt=
"slika korisnika"
>
<img
class=
"photo"
th:src=
"@{'data:image/png;charset=utf-8;base64,'+${loggedUser.getKorisnik().getSlika()}}"
alt=
"slika korisnika"
>
<p
class=
"fw-bold h4 mt-3"
><span
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span></p>
<p
class=
"fw-bold h4 mt-3"
><span
th:text=
"${loggedUser.getKorisnik().getIme()}"
></span></p>
<p
class=
"text-muted"
>
Korisnik
</p>
<p
class=
"text-muted"
th:object=
"${profileRole}"
th:text=
"${profileRole}"
>
</p>
<br>
<br>
<div
class=
"d-flex "
>
<div
class=
"d-flex "
>
<div
class=
"btn btn-outline-primary message"
>
Poruka
</div>
<div
class=
"btn btn-outline-primary message"
>
Poruka
</div>
...
...
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