25
trading/templates/trading/account/login.html
Normal file
25
trading/templates/trading/account/login.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Login" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Log in</h4>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_messages %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons submit="Log in" %}{% endbuttons %}
|
||||
{% if next %}
|
||||
<input type="hidden" name="next" value="{{next}}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
27
trading/templates/trading/account/password_change.html
Normal file
27
trading/templates/trading/account/password_change.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Password change" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Update your password</h4>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="submit">Change password</button>
|
||||
<a class="btn btn-link" href="{% url "trading:index" %}" role="button">Cancel</a>
|
||||
</div>
|
||||
{% if next %}
|
||||
<input type="hidden" name="next" value="{{next}}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
27
trading/templates/trading/account/password_change_done.html
Normal file
27
trading/templates/trading/account/password_change_done.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{% extends "trading/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Password change - success" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h2>Your password has been changed.</h2>
|
||||
<p>
|
||||
You will be redirected in 3 seconds.
|
||||
<a href="{{next|default:"/"}}" target="_blank">Click here if you are not automatically redirected.</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
setTimeout(function() {
|
||||
document.location = "{{next|default:"/"}}";
|
||||
}, 3000);
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
24
trading/templates/trading/account/password_reset.html
Normal file
24
trading/templates/trading/account/password_reset.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Password reset" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4 class="text-center">Reset your password</h4>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons submit="Reset password" %}{% endbuttons %}
|
||||
{% if next %}
|
||||
<input type="hidden" name="next" value="{{next}}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,17 @@
|
||||
{% extends "trading/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Password reset" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Success</h4>
|
||||
Your password has successfully been reset. You may now use your new password to
|
||||
<a href="{% url 'trading:login'%}"> log in</a>.
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,34 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Reset" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
{% if form %}
|
||||
<h4 class="text-center">Reset your password</h4>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
{% buttons submit="Reset password" %}{% endbuttons %}
|
||||
{% if next %}
|
||||
<input type="hidden" name="next" value="{{next}}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% else %}
|
||||
<h4 class="text-center">Password reset error</h4>
|
||||
<p>
|
||||
The password reset link you are trying to use is either invalid
|
||||
or has expired. If you need to reset your password,
|
||||
<a href="{% url 'trading:password_reset' %}">click here</a> to
|
||||
do so.
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
20
trading/templates/trading/account/password_reset_done.html
Normal file
20
trading/templates/trading/account/password_reset_done.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "trading/base.html" %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Password reset" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Check your email</h4>
|
||||
<p>
|
||||
A password reset link has been sent to your email address. Please check your email
|
||||
and follow the instructions to finish resetting your password.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
75
trading/templates/trading/account/settings.html
Normal file
75
trading/templates/trading/account/settings.html
Normal file
@@ -0,0 +1,75 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Settings" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h2>User settings</h2>
|
||||
<strong> (<a href="{% url "trading:user_profile" object.id %}">view profile</a>)
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary" type="submit">Update</button>
|
||||
</div>
|
||||
{% if next %}
|
||||
<input type="hidden" name="next" value="{{next}}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
<p>
|
||||
<a href="{% url "trading:password_change" %}">Change your password here</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Invites</h4>
|
||||
{% if object.unused_invites %}
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Invite #</th>
|
||||
<th>Link</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for invite in object.invite_set.all %}
|
||||
{% if not invite.accepted_user %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>TODO Copy link script</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
No invites available.
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% comment %}
|
||||
<script>
|
||||
const copyToClipboard = str => {
|
||||
const el = document.createElement('textarea');
|
||||
el.value = str;
|
||||
el.setAttribute('readonly', '');
|
||||
el.style.position = 'absolute';
|
||||
el.style.left = '-9999px';
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(el);
|
||||
};
|
||||
</script>
|
||||
{% endcomment %}
|
||||
34
trading/templates/trading/base.html
Normal file
34
trading/templates/trading/base.html
Normal file
@@ -0,0 +1,34 @@
|
||||
{% load staticfiles %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{# TODO l8n #}
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<link rel="stylesheet" href="{% static 'trading/css/bootstrap.min.css' %}" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T">
|
||||
<title>{% block title %}Trading{% if title %} - {{ title }}{% endif %}{% endblock title %}</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% block navbar %}
|
||||
{% include "trading/navbar.html" %}
|
||||
{% endblock navbar %}
|
||||
|
||||
|
||||
<main>
|
||||
<div class="container mt-5"> <!-- -->
|
||||
{% block messages %}
|
||||
{% bootstrap_messages %}
|
||||
{% endblock %}
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script src="{% static 'trading/js/jquery-3.3.1.slim.min.js' %}" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"></script>
|
||||
<script src="{% static 'trading/js/popper.min.js' %}" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"></script>
|
||||
<script src="{% static 'trading/js/bootstrap.min.js' %}" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"></script>
|
||||
|
||||
{% block scripts %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
18
trading/templates/trading/c/balances.html
Normal file
18
trading/templates/trading/c/balances.html
Normal file
@@ -0,0 +1,18 @@
|
||||
{% load humanize %}
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Commodity</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for commodity, balance in object.balances.items %}
|
||||
<tr>
|
||||
<td>{{commodity.name}}</td>
|
||||
<td>{{balance|intcomma}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
40
trading/templates/trading/c/create.html
Normal file
40
trading/templates/trading/c/create.html
Normal file
@@ -0,0 +1,40 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Create commodity" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Create commodity</h4>
|
||||
{% if object.can_create_commodity %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{% bootstrap_form form %}
|
||||
<div class="form-group">
|
||||
<div class="alert alert-light">
|
||||
<strong>Note:</strong> You have <strong>{{ object.unused_commodities|default:"unlimited" }}</strong>
|
||||
{% if object.unused_commodities %}
|
||||
commodit{{ object.unused_commodities|pluralize:"y,ies"}}
|
||||
{% else %}
|
||||
commodities
|
||||
{% endif %} available to create.
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Create</button>
|
||||
<a class="btn btn-link" href="{% url "trading:index" %}" role="button">Cancel</a>
|
||||
</div>
|
||||
{% if next %}
|
||||
<input type="hidden" name="next" value="{{next}}"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% else %}
|
||||
<p>You have created the maximum number of commodities you are allowed to create.</p>
|
||||
<p><a href="{% url "trading:settings" %}">Click here to view your settings.</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
16
trading/templates/trading/c/detail.html
Normal file
16
trading/templates/trading/c/detail.html
Normal file
@@ -0,0 +1,16 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Commodity detail" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>{{object.name}}</h4>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
15
trading/templates/trading/index.html
Normal file
15
trading/templates/trading/index.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "trading/base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h4>Balances</h4>
|
||||
<p>{% include "trading/c/balances.html" with object=request.user %}</p>
|
||||
{% if request.user.can_create_commodity %}
|
||||
<p><a href="{% url "trading:commodity_create" %}">Create a new commodity</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
3
trading/templates/trading/navbar.html
Normal file
3
trading/templates/trading/navbar.html
Normal file
@@ -0,0 +1,3 @@
|
||||
{% load staticfiles %}
|
||||
<nav class="navbar navbar-expand-lg">
|
||||
</nav>
|
||||
51
trading/templates/trading/u/profile.html
Normal file
51
trading/templates/trading/u/profile.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{% extends "trading/base.html" %}
|
||||
{% load bootstrap4 %}
|
||||
{% load humanize %}
|
||||
|
||||
{% block title %}
|
||||
{% with title="Profile" %}
|
||||
{{ block.super }}
|
||||
{% endwith %}
|
||||
{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<h2>{{ object.username }}</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>Status</td>
|
||||
<td>{{ object_status }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Date joined</td>
|
||||
<td>{{ object.date_joined.date }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<h4>Commodities owned by this user</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Commodity</th>
|
||||
<th>Circulation</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for commodity in object.commodity_set.all %}
|
||||
<tr>
|
||||
<td><a href="{% url "trading:commodity_detail" commodity.pk %}">{{ commodity.name }}</a></td>
|
||||
<td>{{ commodity.in_circulation|intcomma }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user