-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from OfirMatasas/profile-sidebar
Adding user's info to the navbar
- Loading branch information
Showing
15 changed files
with
138 additions
and
36,777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from daycare.models import DayCare | ||
from dogowner.models import DogOwner | ||
|
||
|
||
def navbar_extras(request): | ||
navbar_picture_url = navbar_name = None | ||
if request.user.is_authenticated: | ||
if DogOwner.objects.filter(user=request.user).exists(): | ||
dog_owner = DogOwner.objects.filter(user=request.user).first() | ||
navbar_name = dog_owner.__str__() | ||
navbar_picture_url = dog_owner.get_dog_owner_profile_image_url() | ||
else: | ||
daycare = DayCare.objects.filter(user=request.user).first() | ||
navbar_name = daycare.name | ||
navbar_picture_url = daycare.get_daycare_primary_image_url() | ||
|
||
context = { | ||
'navbar_picture_url': navbar_picture_url, | ||
'navbar_name': navbar_name, | ||
} | ||
return context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,36 +12,43 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> | ||
<link rel="stylesheet" href="{% static 'css/navbar.css' %}"> | ||
{% block stylesheets %} | ||
{% endblock %} | ||
</head> | ||
<header> | ||
<nav class="navbar navbar-expand-lg navbar-light bg-dark"> | ||
<nav class="navbar navbar-expand-lg navbar-light bg-dark" style="padding: 0 10px 0 10px;"> | ||
<a class="navbar-brand" href="..\"> | ||
<img src="..\..\..\static\images\Hotails-logo-smaller.png" style="width:50px; height:50px;" class="d-inline-block align-top" loading="lazy"></a> | ||
<button class="navbar-toggler" type="button" data-target="#navbarText" | ||
aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"> | ||
</button> | ||
<ul class="navbar-nav mr-auto"> | ||
{% if request.user.is_authenticated %} | ||
<img src="{% static 'images/Hotails-logo-smaller.png' %}" style="width:50px; height:50px;" class="d-inline-block align-top" loading="lazy"> | ||
</a> | ||
<button class="navbar-toggler" type="button" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation"></button> | ||
<ul class="navbar-nav mr-auto"> | ||
{% if request.user.is_authenticated %} | ||
<li class="nav-item"><a class="nav-link text-white" href="/profile">Profile</a></li> | ||
<li class="nav-item"><a class="nav-link text-white" href="">Orders</a></li> | ||
<li class="nav-item"><a class="nav-link text-white" href="">Search</a></li> | ||
<li class="nav-item"><a class="nav-link text-white" href="">Chats</a></li> | ||
{% endif %} | ||
<li class="nav-item"><a class="nav-link text-white" href="/about">About</a></li> | ||
</ul> | ||
<li class="nav-item"><a class="nav-link text-white" href="">Orders</a></li> | ||
<li class="nav-item"><a class="nav-link text-white" href="">Search</a></li> | ||
<li class="nav-item"><a class="nav-link text-white" href="">Chats</a></li> | ||
{% endif %} | ||
<li class="nav-item"><a class="nav-link text-white" href="/about">About</a></li> | ||
</ul> | ||
{% if request.user.is_authenticated %} | ||
<ul class="nav navbar-nav navbar-right"> | ||
<li class="nav-item"><a class="nav-link text-white" style="font-size:1.3rem" href="/logout">Logout</a></li> | ||
<li class="nav-item"><img src="{{ navbar_picture_url }}" alt="{{ name }} image" class="navbar-profile-img"></li> | ||
<li class="nav-item"> | ||
<span id="welcomeMsg">Welcome, {{ navbar_name }}!</span><a class="nav-link" id="logoutHref" href="/logout">Logout</a> | ||
</li> | ||
</ul> | ||
{% endif %} | ||
</nav> | ||
</header> | ||
|
||
<body> | ||
{% block content %} | ||
{% endblock %} | ||
<div class="row"> | ||
<div class="col-12 col-lg-12"> | ||
{% block content %} | ||
{% endblock %} | ||
</div> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
header ul li { | ||
font-size: 1.1rem; | ||
} | ||
|
||
.navbar-profile-img | ||
{ | ||
border-radius: 50%; | ||
height: 2.5rem; | ||
width: 2.5rem; | ||
} | ||
|
||
#welcomeMsg { | ||
padding-left:10px; | ||
padding-bottom:0; | ||
margin-top:5px; | ||
color:#FFF; | ||
float:left; | ||
} | ||
|
||
#logoutHref { | ||
background-color:#1e1e1e; | ||
border-radius:12px; | ||
color:#E19512; | ||
font-weight:bold; | ||
float:right; | ||
padding: 5px 10px 5px 10px; | ||
font-size:1rem; | ||
margin:1px 0 0 20px; | ||
} |
Oops, something went wrong.