Private
Public Access
1
0

Merge branch 'develop' into feature/charts-microservice

This commit is contained in:
2024-04-01 11:18:29 +02:00
8 changed files with 195 additions and 42 deletions

View File

@@ -34,6 +34,21 @@
<th>Manager</th><td>{{ course.manager }}</td>
</tr>
</table>
<p>
{% if course in rower.followed_courses.all %}
You have liked this course. If you use <a href="https://performancephones.com/">CrewNerd</a>, you can synchronize this course to your phone in the app.
{% else %}
By clicking on the link below, you can add the course to your "liked" list, which can be synchronized with the
<a href="https://performancephones.com/">CrewNerd</a> app (from your phone).
{% endif %}
</p>
<p>
{% if course in rower.followed_courses.all %}
<a href="unfollow">Remove this course from your list of liked courses</a>
{% else %}
<a href="follow">Like this course</a>
{% endif %}
</p>
</li>
<li class="grid_2">
<div class="mapdiv">

View File

@@ -3,11 +3,9 @@
{% load rowerfilters %}
{% block title %}Rowsandall Courses List{% endblock %}
{% block scripts %}
{% endblock %}
{% block main %}
<style>
#mypointer {
@@ -20,7 +18,7 @@
<h1>Courses</h1>
<ul class="main-content">
<li class="grid_3">
<li class="grid_4">
{% if courses %}
<p>
<form enctype="multipart/form-data" method="post">
@@ -33,6 +31,8 @@
<th> Country</th>
<th> Name</th>
<th> Distance</th>
<th> Updated on</th>
<th> Like</th>
</tr>
</thead>
<tbody>
@@ -46,7 +46,15 @@
<td>
{{ course.distance }} m
</td>
<td>
{{ course.updated|date:"Y-m-d" }}
</td>
<td>
{% if course in rower.followed_courses.all %}
<a class="unfollow" href="/rowers/courses/{{ course.id }}/unfollow"><i class="fas fa-star"></i></a>
{% else %}
<a class="follow" href="/rowers/courses/{{ course.id }}/follow"><i class="far fa-star"></i></a>
{% endif %}
</tr>
{% endfor %}
@@ -74,6 +82,9 @@
<p>
<a href="/rowers/list-courses/">All courses</a>
</p>
<p>
<a href="/rowers/list-courses/?liked=true">Courses I like</a>
</p>
{% endif %}
<p>
<a href="/rowers/courses/upload/">Add Courses</a>
@@ -143,6 +154,55 @@
</li>
</ul>
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
</script>
<script>
$(document).ready(function() {
$("a.follow").click(function(event) {
event.preventDefault();
var ajaxEndpoint = $(this).attr('href');
var $ajaxLink = $(this);
$.ajax({
url: ajaxEndpoint,
method: 'GET',
success: function(response) {
console.log(response);
$ajaxLink.html('<i class="fas fa-star"></i>');
},
error: function(xhr, status, error) {
console.error(error);
}
});
});
$("a.unfollow").click(function(event) {
event.preventDefault();
var ajaxEndpoint = $(this).attr('href');
var $ajaxLink = $(this);
$.ajax({
url: ajaxEndpoint,
method: 'GET',
success: function(response) {
console.log(response);
$ajaxLink.html('<i class="far fa-star"></i>');
},
error: function(xhr, status, error) {
console.error(error);
}
});
});
});
</script>
{% endblock %}
{% block sidebar %}