Closed Washubrnfg85 closed 7 months ago
You don't need any javascript to implement this. The page should be generated on the server.
Look at this section of the example:
<div class="container">
<div th:if="${notFound != null}" class="alert alert-warning" role="alert">
<h4 class="alert-heading">404</h4>
<p>
Look like there is no data associated with this user.
Please, contact the person who shared this with you.
</p>
</div>
<img class="profile-picture" th:src="@{'/pics/' + ${details.imageUrl}}" alt="Profile picture">
<h1 class="profile-fullname" th:text="${details.firstName + ' ' + details.lastName}"></h1>
<p class="public-email" th:text="${details.publicEmail}"></p>
<div class="links">
<th:block th:each="link : ${details.links}">
<a class="btn btn-outline-dark btn-lg" th:href="${link.url}" th:text="${link.title}"></a>
</th:block>
</div>
</div>
--- there is no javascript/vuejs here.
Because of that, you don't need to use any endpoint of ApiRestController to populate the page with data. All of this will happen inside a method in mvc controller (not rest api).
By the way, before starting the task or in the beginning of the process, did you think about the dependencies (tasks or data which are required for this task)?
The links (addition/removal) functionality is not yet implemented. In addition to that, the profile picture functionality is not implemented as well. So, how are you going to verify your implementation?
By the way, before starting the task or in the beginning of the process, did you think about the dependencies (tasks or data which are required for this task)?
The links (addition/removal) functionality is not yet implemented. In addition to that, the profile picture functionality is not implemented as well. So, how are you going to verify your implementation?
Well, I kept them in mind. My goal for now is to build wireframe. Meanwhile i'll face issues and solve them.
Ok, ok. I got it. We've already did that before.
@GetMapping("/public")
public String userPublicPage(Principal user, Model model) {
UserProfileDetails details = userProfileDetailsRepository.findByEmail(user.getName());
model.addAttribute("details", details);
return "user's_public_page.html";
}
And it seems to work properly for now.
@GetMapping("/public")
public String userPublicPage(Principal user, Model model) {
...
This method maps to url like this http://link-sharing-app.dev/public (the domain name is an example). Can a user share this url with people on the Internet so that they can open the url and see his name, email and links? Keep in mind that you're build a multi-user system.
Good point. Guess we should use some unique users property as parameter in URL. Authentication email for example. Question! How do user itself get to own public_details_page? There should be a link on profile page or somewhere else?
Question! How do user itself get to own public_details_page? There should be a link on profile page or somewhere else?
Yes, you can add a link to a user's public page to the navigation bar here
Guess we should use some unique users property as parameter in URL. Authentication email for example.
What is the purpose of the username then?
Guess we should use some unique users property as parameter in URL. Authentication email for example.
What is the purpose of the username then?
Right. Remember that we made it unique!?))
Need some help to figure out how scripts work. Used Profile_details_page as a template. I'm trying to use @GetMapping(api/profile) getProfileDetails method (which already implemented) to get users details for representation on html page. Just like how we do on profile_details_page. But can't even get controller. Template error occures.