Skip to content

Commit

Permalink
feat: links barra de navegacao
Browse files Browse the repository at this point in the history
  • Loading branch information
michelebswm committed Sep 28, 2023
1 parent 99e4879 commit 0de47c1
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 16 deletions.
Binary file modified db.sqlite3
Binary file not shown.
17 changes: 17 additions & 0 deletions filme/templates/criarconta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'base.html' %}

{% block title %}
Criar Conta
{% endblock %}

{% block head %}
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'css/style_criarconta.css' %}"/>
{% endblock %}

{% block content %}
<div class="content">
<h2>Criar Conta</h2>

</div>
{% endblock %}
17 changes: 17 additions & 0 deletions filme/templates/editarperfil.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends 'base.html' %}

{% block title %}
Edição de Perfil
{% endblock %}

{% block head %}
{% load static %}
<link rel="stylesheet" type="text/css" href="{% static 'css/style_editarperfil.css' %}"/>
{% endblock %}

{% block content %}
<div class="content">
<h2>Edição do Perfil</h2>

</div>
{% endblock %}
20 changes: 19 additions & 1 deletion filme/templates/logout.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@

{% block content %}
<div class="content">
<h2>Logout</h2>
<header class="header">
<div class="title-header">
Logout realizado com sucesso.
</div>
<div class="group-btn">
<div class="btn-access">
<a href="{% url 'filme:login' %}">
Fazer Login
</a>
</div>
<div class="btn-access">
<a href="{% url 'filme:criarconta' %}">
Criar uma Conta
</a>
</div>
</div>

</header>

</div>
{% endblock %}
10 changes: 6 additions & 4 deletions filme/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.urls import path, include
from .views import Homepage, HomeFilmes, DetalhesFilme, PesquisaFilme
from .views import Homepage, HomeFilmes, DetalhesFilme, PesquisaFilme, EditarPerfil, CriarConta
from django.contrib.auth import views as auth_view


Expand All @@ -10,9 +10,11 @@
path('', Homepage.as_view(), name='homepage'),
path('filmes/', HomeFilmes.as_view(), name='homefilmes'),
path('filmes/<int:pk>', DetalhesFilme.as_view(), name='detalhesfilme'),
path('pesquisa', PesquisaFilme.as_view(), name='pesquisafilme'),
path('login', auth_view.LoginView.as_view(
path('pesquisa/', PesquisaFilme.as_view(), name='pesquisafilme'),
path('login/', auth_view.LoginView.as_view(
template_name='login.html'), name='login'),
path('logout', auth_view.LogoutView.as_view(
path('logout/', auth_view.LogoutView.as_view(
template_name='logout.html'), name='logout'),
path('editarperfil/', EditarPerfil.as_view(), name='editarperfil'),
path('criarconta/', CriarConta.as_view(), name='criarconta'),
]
24 changes: 15 additions & 9 deletions filme/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.shortcuts import render
from django.shortcuts import render, redirect
from .models import Filme
from django.views.generic import TemplateView, ListView, DetailView
from django.contrib.auth.mixins import LoginRequiredMixin
Expand All @@ -9,6 +9,14 @@
class Homepage(TemplateView):
template_name = 'homepage.html'

def get(self, request, *args, **kwargs):
if request.user.is_authenticated:
# Redireciona para o app_name filme url name homefilmes
return redirect('filme:homefilmes')
else:
# Redireciona para a url final da view neste caso a homepage
return super().get(request, *args, **kwargs)


class HomeFilmes(LoginRequiredMixin, ListView):
template_name = "homefilmes.html"
Expand Down Expand Up @@ -55,12 +63,10 @@ def get_queryset(self):
else:
return None

# def homepage(request):
# return render(request, "homepage.html")

#url - view - template
# def homefilmes(request):
# context = {}
# lista_filmes = Filme.objects.all() # pega todos os objetos do banco de dados
# context['lista_filmes'] = lista_filmes
# return render(request, "homefilmes.html", context)
class EditarPerfil(LoginRequiredMixin, TemplateView):
template_name = 'editarperfil.html'


class CriarConta(TemplateView):
template_name = 'criarconta.html'
3 changes: 3 additions & 0 deletions static/css/style_criarconta.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.content {
padding-top: 4.68rem;
}
4 changes: 4 additions & 0 deletions static/css/style_editarperfil.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.content{
padding-top: 4.68rem;
min-height: 100vh;
}
50 changes: 50 additions & 0 deletions static/css/style_logout.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

.header {
min-height: 100vh;
position: relative; /* Adicione uma posição relativa para que possamos posicionar o pseudo-elemento */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}

.header::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url("../images/background_netflix.jpg");
background-repeat: no-repeat;
background-blend-mode: overlay;
background-size: cover; /* Ajuste para cobrir todo o cabeçalho */
background-color: rgb(0, 0, 0, 0.7);
opacity: 0.7; /* Opacidade para a imagem de fundo */
z-index: -1; /* Coloque o pseudo-elemento atrás do conteúdo */
}

.title-header {
color: rgb(255, 255, 255);
font: 2rem bold;
padding: 0.8rem;
}

.paragraph {
padding: 0.8rem;
font: 1.2rem bold;
}

.group-btn {
display: flex;
flex-direction: row;
gap: 0.3rem;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}

.btn-access {
background-color: rgb(255, 0, 0);
padding: 0.55rem;
}
16 changes: 14 additions & 2 deletions templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@
<img src="{% static 'images/hashflix.png' %}" alt="logo-hashflix">
</a>
</div>

<div class="group-nav">
{% if user.is_authenticated %}
<form method="get" action="{% url 'filme:pesquisafilme' %}" class="nav-search">
<input type="search" name="query" id="search" value="{{ request.GET.query }}" placeholder="Pesquisar...">
<input type="submit" value="" class="nav-submit">
</form>
{% endif %}
{% if user.is_authenticated %}
<div class="nav-btn">
<a href="#">Sair</a>
<a href="{% url 'filme:logout' %}">Sair</a>
</div>
{% else %}
<div class="nav-btn">
<a href="{% url 'filme:login' %}">Login</a>
</div>
{% endif %}
{% if user.is_authenticated %}
<div class="nav-btn">
<a href="#">Editar Perfil</a>
<a href="{% url 'filme:editarperfil' %}">Editar Perfil</a>
</div>
{% endif %}
</div>

</nav>

0 comments on commit 0de47c1

Please sign in to comment.