Code login template.

- Add base bootstrap files
- Enable musician app
This commit is contained in:
Santiago Lamora 2019-10-23 13:35:43 +02:00
parent 041f6f79da
commit da8b91d892
12 changed files with 261 additions and 1 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,44 @@
a, a:hover, a:focus {
text-decoration: none;
transition: all 0.3s;
}
a:hover {
color: rgba(0,0,0,.7);
}
.wrapper {
display: flex;
width: 100%;
align-items: stretch;
}
#sidebar {
min-width: 250px;
max-width: 250px;
min-height: 100vh;
}
#sidebar.active {
margin-left: -250px;
}
#sidebar ul.components {
padding: 20px 0;
}
#sidebar ul li a {
padding: 10px;
font-size: 1.1em;
display: block;
}
#sidebar ul li a:hover {
color: #777;
background: #efefef;
}
/*#sidebar ul li.active > a, a[aria-expanded="true"] {
color: #fff;
background: #6d7fcc;
}*/

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
{% extends "auth/login_base.html" %}
{% load i18n %}
{% block login_content %}
<div>
<form action="{% url 'musician:login' %}" role="form" method="post">
{% csrf_token %}
<input type="hidden" name="next" value="{{ next }}" />
<div id="div_id_username" class="clearfix control-group {% if form.username.errors %}error{% endif %}">
<div class="form-group">
<label for="id_username">{{ form.username.label }}:</label>
<input type="text" name="username" maxlength="100" autocapitalize="off" autocorrect="off"
class="form-control textinput textInput" id="id_username" required autofocus
{% if form.username.value %}value="{{ form.username.value }}" {% endif %}>
{% if form.username.errors %}
<p class="text-error">
{{ form.username.errors|striptags }}
</p>
{% endif %}
</div>
</div>
<div id="div_id_password" class="clearfix control-group {% if form.password.errors %}error{% endif %}">
<div class="form-group">
<label for="id_password">{{ form.password.label }}:</label>
<input type="password" name="password" maxlength="100" autocapitalize="off" autocorrect="off"
class="form-control textinput textInput" id="id_password" required>
{% if form.password.errors %}
<p class="text-error">
{{ form.password.errors|striptags }}
</p>
{% endif %}
</div>
</div>
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="well well-small text-error" style="border: none">{{ error }}</div>
{% endfor %}
{% endif %}
<div><a href=#password_reset">{% trans "Have you forgot the password?" %}</a></div>
<div class="form-actions-no-box">
<input type="submit" name="submit" value="{% trans 'Log in' %}" class="btn btn-primary form-control"
id="submit-id-submit">
</div>
</form>
</div>
{% endblock login_content %}

View File

@ -0,0 +1,22 @@
{% extends "musician/base.html" %}
{% block body %}
<body class="container">
<div class="container-fluid" style="margin-top: 30px;">
<div class="row-fluid">
<div class="well rounded" style="width: 320px; margin-left: auto; margin-right: auto; background: rgba(169, 169, 169, 0.25); padding: 1em;">
<div class="row-fluid">
<div>
{% block branding %}<h3 style="margin: 0 0 20px;">Musician <span class="small">v{{ version }}</span></h3>{% endblock %}
</div>
</div><!-- /row fluid -->
<div class="row-fluid">
{% block login_content %}
{% endblock login_content %}
</div><!-- /.row-fluid -->
</div><!--/.well-->
</div><!-- /.row-fluid -->
</div><!-- /.container-fluid -->
</body>
{% endblock %}

View File

@ -0,0 +1,115 @@
{% load i18n static %}
<!DOCTYPE html>
<html>
<head>
{% block head %}
{% block meta %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="NONE,NOARCHIVE" />
{% endblock %}
<title>{% block title %}{% if name %}{{ name }} {% endif %}ICO monitoring{% endblock %}</title>
{% block style %}
{% block bootstrap_theme %}
<link rel="stylesheet" type="text/css" href="{% static "musician/css/bootstrap.min.css" %}" />
{% endblock %}
<link rel="stylesheet" type="text/css" href="{% static "musician/css/default.css" %}" />
{% if code_style %}<style>
{{ code_style }}
</style>{% endif %}
{% endblock %}
{% endblock %}
</head>
{% block body %}
<body class="{% block bodyclass %}{% endblock %}">
{% block navbar %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="/">ICO monitoring</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown"
aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="javascript:void(0)" id="navbarDropdownMenuLink" role="button"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Projects
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{% for project in projects %}
<a class="dropdown-item" href="{% url 'project_detail' project.slug %}">{{ project.name }}</a>
{% endfor %}
</div>
</li>
</ul>
</div>
<ul class="nav navbar-nav pull-right">
{% block userlinks %}
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a href="{% url 'logout' %}" class="nav-link dropdown-toggle" data-toggle="dropdown">
{{ user.username }}
</a>
<b class="caret"></b>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li class="nav-item dropdown">
<a class="dropdown-item" href="{% url 'logout' %}">{% trans 'Log out' %}</a>
</li>
</ul>
</li>
{% else %}
<li><a href="{% url 'login' %}">{% trans 'Log in' %}</a></li>
{% endif %}
{% endblock %}
</ul>
</nav>
{% endblock %}
<div class="wrapper">
<nav id="sidebar" class="border-right pt-4">
{% block sidebar %}
{% if actual_project %}
<div class="sidebar-header mb-3">
<span class="rounded-circle" style="padding: 8px 8px 8px 12px; margin-right: 10px; background-color: #fcaf3e">
{{actual_project.name|first|capfirst }}
</span>
{{ actual_project.name }} ({{ actual_project.location.name }})
</div>
<div class="dropdown-divider"></div>
<ul class="list-unstyled components">
<li><a href="{% url 'project_detail' actual_project.slug %}">{% trans 'Project Details' %}</a></li>
<li><a href="{% url 'monitoringsite_list' actual_project.slug %}">{% trans 'Monitoring Sites' %}</a></li>
<li><a href="{% url 'project_users_list' actual_project.slug %}">{% trans 'Users' %}</a></li>
</ul>
{% else %}
<!-- TODO (slamora) create another menu? -->
{% endif %}
{% endblock sidebar %}
</nav><!-- ./sidebar -->
<div id="content" class="container-fluid pt-4">
{% block content %}
{% endblock content %}
</div><!-- ./content -->
</div><!-- ./wrapper -->
{% block script %}
<script src="{% static "musician/js/jquery-3.3.1.slim.min.js" %}"></script>
<script src="{% static "musician/js/popper.min.js" %}"></script>
<script src="{% static "musician/js/bootstrap.min.js" %}"></script>
{% endblock %}
</body>
{% endblock %}
</html>

View File

@ -4,11 +4,16 @@ URL routes definition.
Describe the paths where the views are accesible.
"""
from django.contrib.auth import views as auth_views
from django.urls import path
from . import views
app_name = 'musician'
urlpatterns = [
# path('auth/login/', views.LoginView.as_view(), name='login'),
path('auth/login/', auth_views.LoginView.as_view(template_name='auth/login.html',
extra_context={'version': '0.1'}), name='login'),
# path('auth/logout/', views.LogoutView.as_view(), name='logout'),
]

View File

@ -50,6 +50,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'django_extensions',
'musician',
]
MIDDLEWARE = [