From 5b5c5c68a96eef6bf0ad379e71327b10447bd106 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 9 Oct 2017 09:32:52 +0200 Subject: [PATCH 1/5] added ranking piece only button --- rowers/templates/list_workouts.html | 16 +++++++++++++--- rowers/urls.py | 1 + rowers/views.py | 6 +++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/rowers/templates/list_workouts.html b/rowers/templates/list_workouts.html index 7ca1476e..9b61d44c 100644 --- a/rowers/templates/list_workouts.html +++ b/rowers/templates/list_workouts.html @@ -17,9 +17,9 @@
{% if team %} -
+ {% else %} - + {% endif %} @@ -46,7 +46,7 @@ {% else %}

My Workouts

{% endif %} - + {% if workouts %}
@@ -196,6 +196,16 @@
+ {% if rankingonly and not team %} + + {% elif not team %} + + {% endif %} +

 

{% if team %} diff --git a/rowers/urls.py b/rowers/urls.py index e395fb87..96199525 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -121,6 +121,7 @@ urlpatterns = [ url(r'^400/$', TemplateView.as_view(template_name='400.html'),name='400'), url(r'^403/$', TemplateView.as_view(template_name='403.html'),name='403'), url(r'^imports/$', TemplateView.as_view(template_name='imports.html'), name='imports'), + url(r'^list-workouts/ranking$',views.workouts_view,{'rankingonly':True}), url(r'^list-workouts/team/(?P\d+)/(?P\w+.*)/(?P\w+.*)$',views.workouts_view), url(r'^list-workouts/team/(?P\d+)/$',views.workouts_view), url(r'^list-workouts/(?P\w+.*)/(?P\w+.*)$',views.workouts_view), diff --git a/rowers/views.py b/rowers/views.py index 18240b21..349feb5d 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -4289,7 +4289,7 @@ def workouts_view(request,message='',successmessage='', startdatestring="",enddatestring="", startdate=timezone.now()-datetime.timedelta(days=365), enddate=timezone.now()+datetime.timedelta(days=1), - teamid=0): + teamid=0,rankingonly=False): request.session['referer'] = absolute(request)['PATH'] try: r = getrower(request.user) @@ -4365,6 +4365,9 @@ def workouts_view(request,message='',successmessage='', startdatetime__gte=activity_startdate, startdatetime__lte=activity_enddate).order_by("-startdatetime") + if rankingonly: + workouts = [w for w in workouts if w.rankingpiece] + query = request.GET.get('q') if query: query_list = query.split() @@ -4407,6 +4410,7 @@ def workouts_view(request,message='',successmessage='', 'enddate':enddate, 'announcements':announcements[0:4], 'team':theteam, + 'rankingonly':rankingonly, 'teams':get_my_teams(request.user), 'interactiveplot':script, 'the_div':div, From 1c137a68523d07faa8bcfcb8299af0cdd49e4392 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 9 Oct 2017 11:07:29 +0200 Subject: [PATCH 2/5] added FB and Twitter share buttons --- rowers/templates/show_graph.html | 19 +++++++++++++++++-- rowers/templates/workout_form.html | 16 ++++++++++++++++ rowers/templates/workout_view.html | 15 +++++++++++++-- rowsandall_app/settings.py | 1 + templates/base.html | 2 ++ templates/basebase.html | 27 +++++++++++++++++++++++++++ 6 files changed, 76 insertions(+), 4 deletions(-) diff --git a/rowers/templates/show_graph.html b/rowers/templates/show_graph.html index 1221cc03..f6ecc9a4 100644 --- a/rowers/templates/show_graph.html +++ b/rowers/templates/show_graph.html @@ -12,8 +12,23 @@ {% endblock %} {% block content %} -

{{ workout.name }}

+

{{ workout.name }}

+
+
+ +
+
+ +
+
+ +

 

+
{% if user.is_authenticated and user == rower.user %}

@@ -34,7 +49,7 @@

 

{% endif %}
- +
+ + +
https://rowsandall.com/rowers/workout/{{ workout.id }}
Share to +
+ +
+
+ +
+
Comments diff --git a/rowers/templates/workout_view.html b/rowers/templates/workout_view.html index a823aec1..75f9b0c6 100644 --- a/rowers/templates/workout_view.html +++ b/rowers/templates/workout_view.html @@ -27,9 +27,20 @@
-

{{ workout.name }}

+

{{ workout.name }}

+
+ +
+
+ +
+ - + diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index 3020084e..a7f25d88 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -64,6 +64,7 @@ INSTALLED_APPS = [ 'cookielaw', 'django_extensions', 'tz_detect', + 'django_social_share', ] AUTHENTICATION_BACKENDS = ( diff --git a/templates/base.html b/templates/base.html index 77fa6213..21de4904 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,6 +3,8 @@ {% load rowerfilters %} {% endblock %} + + {% block teams %} {% if user.is_authenticated and user|has_teams %} From 862df21d2a4999b004180b14cbac148f4783c644 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 9 Oct 2017 12:06:11 +0200 Subject: [PATCH 4/5] added rowingdata tag to tweets --- rowers/templates/show_graph.html | 2 +- rowers/templates/workout_form.html | 2 +- rowers/templates/workout_view.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rowers/templates/show_graph.html b/rowers/templates/show_graph.html index f6ecc9a4..ee240263 100644 --- a/rowers/templates/show_graph.html +++ b/rowers/templates/show_graph.html @@ -22,7 +22,7 @@ + data-text="@rowsandall #rowingdata">Tweet diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index be616ef9..df25600b 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -80,7 +80,7 @@ + data-text="@rowsandall #rowingdata">Tweet diff --git a/rowers/templates/workout_view.html b/rowers/templates/workout_view.html index 75f9b0c6..b088e2cf 100644 --- a/rowers/templates/workout_view.html +++ b/rowers/templates/workout_view.html @@ -36,7 +36,7 @@ + data-text="@rowsandall #rowingdata">Tweet
Rower:{{ first_name }} {{ last_name }}
From ebb10e946565af96ce8c9d1f8079ec0ac8e5a215 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Mon, 9 Oct 2017 15:35:20 +0200 Subject: [PATCH 5/5] moving share buttons to the right --- rowers/templates/workout_form.html | 52 ++++++++++++++++-------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index df25600b..4b89d286 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -55,6 +55,7 @@

+
{% localtime on %} @@ -69,20 +70,6 @@ - - -
https://rowsandall.com/rowers/workout/{{ workout.id }}
Share to -
- -
-
- -
-
Comments @@ -96,6 +83,8 @@
+
+
{{ form.as_table }} @@ -114,7 +103,8 @@ - + +

Images linked to this workout

@@ -214,19 +204,33 @@
-

Workout Summary

+
+

Workout Summary

-

-

-        {{ workout.summary }}
-      
-

-

- Update Summary +

+          {{ workout.summary }}
+        
+

+ +
+
+
+ +
+
+

 

+ +
-