feat: add user-scoped favorites and notes
This commit is contained in:
@ -7,9 +7,14 @@
|
||||
<body>
|
||||
<p>
|
||||
<a href="{% url 'scouting:player_list' %}">Back to search</a>
|
||||
| Signed in as {{ request.user.username }}
|
||||
| <form method="post" action="{% url 'logout' %}" style="display:inline;">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Log out</button>
|
||||
</form>
|
||||
</p>
|
||||
<h1>Shared Development Shortlist</h1>
|
||||
<p>This MVP shortlist is shared across the local development environment.</p>
|
||||
<h1>Your Shortlist</h1>
|
||||
<p>This page shows favorites saved only for your account.</p>
|
||||
|
||||
<ul>
|
||||
{% for entry in favorites %}
|
||||
|
||||
@ -7,23 +7,36 @@
|
||||
<body>
|
||||
<p>
|
||||
<a href="{% url 'scouting:player_list' %}">Back to search</a>
|
||||
| <a href="{% url 'scouting:favorites_list' %}">View shortlist</a>
|
||||
{% if request.user.is_authenticated %}
|
||||
| <a href="{% url 'scouting:favorites_list' %}">View shortlist</a>
|
||||
| Signed in as {{ request.user.username }}
|
||||
| <form method="post" action="{% url 'logout' %}" style="display:inline;">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Log out</button>
|
||||
</form>
|
||||
{% else %}
|
||||
| <a href="{% url 'login' %}?next={{ request.get_full_path|urlencode }}">Log in</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
<h1>{{ player.full_name }}</h1>
|
||||
|
||||
{% if is_favorite %}
|
||||
<p><strong>On the shared development shortlist.</strong></p>
|
||||
<form method="post" action="{% url 'scouting:remove_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Remove from shortlist</button>
|
||||
</form>
|
||||
{% if request.user.is_authenticated %}
|
||||
{% if is_favorite %}
|
||||
<p><strong>On your shortlist.</strong></p>
|
||||
<form method="post" action="{% url 'scouting:remove_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Remove from shortlist</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form method="post" action="{% url 'scouting:add_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Add to shortlist</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<form method="post" action="{% url 'scouting:add_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Add to shortlist</button>
|
||||
</form>
|
||||
<p><a href="{% url 'login' %}?next={{ request.get_full_path|urlencode }}">Log in to manage your shortlist</a></p>
|
||||
{% endif %}
|
||||
|
||||
<p>Position: {{ player.position }}</p>
|
||||
@ -52,25 +65,31 @@
|
||||
</p>
|
||||
|
||||
<h2>Scouting Notes</h2>
|
||||
<p>Notes are shared across the local development shortlist workflow in this MVP.</p>
|
||||
<form method="post" action="{% url 'scouting:add_note' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<label for="id_body">Add note</label>
|
||||
<textarea id="id_body" name="body" rows="4" cols="60"></textarea>
|
||||
<button type="submit">Save note</button>
|
||||
</form>
|
||||
{% if request.user.is_authenticated %}
|
||||
<p>These notes are visible only to your account.</p>
|
||||
<form method="post" action="{% url 'scouting:add_note' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<label for="id_body">Add note</label>
|
||||
<textarea id="id_body" name="body" rows="4" cols="60"></textarea>
|
||||
<button type="submit">Save note</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<p><a href="{% url 'login' %}?next={{ request.get_full_path|urlencode }}">Log in to add personal notes</a></p>
|
||||
{% endif %}
|
||||
|
||||
<ul>
|
||||
{% for note in notes %}
|
||||
<li>
|
||||
<div>{{ note.body|linebreaksbr }}</div>
|
||||
<small>Created: {{ note.created_at }}</small>
|
||||
<form method="post" action="{% url 'scouting:delete_note' player.id note.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Delete note</button>
|
||||
</form>
|
||||
{% if request.user.is_authenticated %}
|
||||
<form method="post" action="{% url 'scouting:delete_note' player.id note.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Delete note</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% empty %}
|
||||
<li>No notes yet.</li>
|
||||
|
||||
@ -6,7 +6,18 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>Scout Search</h1>
|
||||
<p><a href="{% url 'scouting:favorites_list' %}">View shortlist</a></p>
|
||||
<p>
|
||||
{% if request.user.is_authenticated %}
|
||||
Signed in as {{ request.user.username }} |
|
||||
<a href="{% url 'scouting:favorites_list' %}">View shortlist</a> |
|
||||
<form method="post" action="{% url 'logout' %}" style="display:inline;">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Log out</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<a href="{% url 'login' %}?next={{ request.get_full_path|urlencode }}">Log in</a>
|
||||
{% endif %}
|
||||
</p>
|
||||
|
||||
<form method="get">
|
||||
<fieldset>
|
||||
@ -65,19 +76,23 @@
|
||||
<li>
|
||||
<a href="{% url 'scouting:player_detail' player.id %}">{{ player.full_name }}</a>
|
||||
({{ player.position }})
|
||||
{% if player.is_favorite %}
|
||||
<strong>Shortlisted</strong>
|
||||
<form method="post" action="{% url 'scouting:remove_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Remove from shortlist</button>
|
||||
</form>
|
||||
{% if request.user.is_authenticated %}
|
||||
{% if player.is_favorite %}
|
||||
<strong>Shortlisted</strong>
|
||||
<form method="post" action="{% url 'scouting:remove_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Remove from shortlist</button>
|
||||
</form>
|
||||
{% else %}
|
||||
<form method="post" action="{% url 'scouting:add_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Add to shortlist</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<form method="post" action="{% url 'scouting:add_favorite' player.id %}">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="next" value="{{ request.get_full_path }}">
|
||||
<button type="submit">Add to shortlist</button>
|
||||
</form>
|
||||
<a href="{% url 'login' %}?next={{ request.get_full_path|urlencode }}">Log in to shortlist</a>
|
||||
{% endif %}
|
||||
{% if player.matching_context %}
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user