logout button and user in navbar
This commit is contained in:
5
.idea/workspace.xml
generated
5
.idea/workspace.xml
generated
@@ -2,13 +2,12 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="15f590a5-5017-44f1-a85e-17dfe3fc5379" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/static/img/usericon.png" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/config/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/urls.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/static/css/main.css" beforeDir="false" afterPath="$PROJECT_DIR$/static/css/main.css" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/base.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/base.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/templates/inputhours.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/inputhours.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/work/forms.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/forms.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/work/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/models.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/work/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/views.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
|
||||
@@ -73,12 +73,6 @@ a:active {
|
||||
align-content: center;
|
||||
overflow: scroll;
|
||||
}
|
||||
/*
|
||||
@media (max-width: 979px) {
|
||||
.container {
|
||||
padding-top: 0px;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* Hide scrollbar for Chrome, Safari and Opera */
|
||||
.container::-webkit-scrollbar {
|
||||
@@ -122,3 +116,21 @@ a:active {
|
||||
padding: 10px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.nav-logout{
|
||||
opacity: 0.7;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.btn-logout{
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
a.btn-logout {
|
||||
-webkit-appearance: button;
|
||||
-moz-appearance: button;
|
||||
appearance: button;
|
||||
|
||||
text-decoration: none;
|
||||
color: #EDEDED;
|
||||
}
|
||||
BIN
static/img/usericon.png
Normal file
BIN
static/img/usericon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -21,52 +21,58 @@
|
||||
</head>
|
||||
<body class="text-center">
|
||||
<div class="navbar-wrapper">
|
||||
<header>
|
||||
<nav class="navbar fixed-top navbar-light bg-nav navbar-expand-md">
|
||||
<!--Logo-->
|
||||
{% load static %}
|
||||
<a class="navbar-brand" href="#"><img src="{% static 'img/logo.png' %}" width="150" alt="logo"
|
||||
class="d-inline-block mr-1 align-center"></a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainmenu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<nav role="navigation" class="navbar fixed-top navbar-light bg-nav navbar-expand-md">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header pull-left">
|
||||
<!--Logo-->
|
||||
{% load static %}
|
||||
<a class="navbar-brand" href="#"><img src="{% static 'img/logo.png' %}" width="150" alt="logo"
|
||||
class="d-inline-block mr-1 align-center"></a>
|
||||
</div>
|
||||
|
||||
<div class="collapse navbar-collapse" id="mainmenu">
|
||||
<ul class="navbar-nav">
|
||||
<!--Start-->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Start</a>
|
||||
</li>
|
||||
<!--Dodaj godziny-->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Dodaj godziny</a>
|
||||
</li>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
{% load auth_extras %}
|
||||
{% if request.user|has_group:"moderators" %}
|
||||
<!--Dodaj pracownika-->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/register">Dodaj pracownika</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<div class="collapse navbar-collapse navbar-left" id="mainmenu">
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<!--Start-->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#">Start</a>
|
||||
</li>
|
||||
<!--Dodaj godziny-->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/">Dodaj godziny</a>
|
||||
</li>
|
||||
|
||||
{% load auth_extras %}
|
||||
{% if request.user|has_group:"moderators" %}
|
||||
<!--Dodaj pracownika-->
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/register">Dodaj pracownika</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
<div class="collapse navbar-collapse navbar-right pull-right nav-logout">
|
||||
<ul class="nav navbar-nav pull-right">
|
||||
<li>
|
||||
{% if user.is_authenticated %}
|
||||
<!-- <div class="text-right">-->
|
||||
<img src="{% static 'img/usericon.png' %}" width="17" alt="user"
|
||||
class="d-inline-block mr-1"> {{ user.username }}
|
||||
<a href="{% url 'login' %}" class="btn btn-sm btn-secondary text-nowrap btn-logout">Wyloguj</a>
|
||||
<!-- </div>-->
|
||||
{% endif %}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</nav>
|
||||
</header>
|
||||
</div>
|
||||
|
||||
<div class = "container">
|
||||
<div class="row">
|
||||
{% if user.is_authenticated %}
|
||||
Zalogowany: {{ user.username }}
|
||||
<p><a href="{% url 'login' %}">Wyloguj</a></p> <br>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
@@ -75,6 +81,7 @@
|
||||
<footer><p class="mt-5 mb-3 text-muted">
|
||||
© Alicja Cięciwa</p></footer>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
{% block content %}
|
||||
{% load crispy_forms_tags %}
|
||||
|
||||
<div class="container">
|
||||
<!--<div class="container">-->
|
||||
<!-- form to input working hours-->
|
||||
<div class="row">
|
||||
<!-- <div class="row">-->
|
||||
<div class="form-hours">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
@@ -13,6 +13,6 @@
|
||||
<button class="btn btn-lg btn-success btn-block" type="submit">Dodaj</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div>-->
|
||||
<!--</div>-->
|
||||
{% endblock %}
|
||||
Binary file not shown.
@@ -1,9 +1,13 @@
|
||||
from django.db import models
|
||||
import datetime
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
|
||||
|
||||
class HoursInput(models.Model):
|
||||
date = models.DateField(default=datetime.date.today)
|
||||
hours_number = models.IntegerField()
|
||||
hours_number = models.IntegerField(validators=[
|
||||
MaxValueValidator(15, "Niemożliwe, że tyle pracowałeś"),
|
||||
MinValueValidator(0, "Wprowadź liczbę dodatnią 0-15")
|
||||
])
|
||||
workplace = models.CharField(max_length=100)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user