diff --git a/rowers/imports.py b/rowers/imports.py index 44453c72..c1e150cc 100644 --- a/rowers/imports.py +++ b/rowers/imports.py @@ -122,6 +122,13 @@ def imports_do_refresh_token(refreshtoken,oauth_data,access_token=''): 'Accept': 'application/json', 'Content-Type': oauth_data['content_type']} + # for Strava + if 'grant_type' in oauth_data: + if oauth_data['grant_type']: + post_data['grant_type'] = oauth_data['grant_type'] + else: + grant_type = post_data.pop('grant_type',None) + if oauth_data['bearer_auth']: headers['authorization'] = 'Bearer %s' % access_token @@ -193,6 +200,13 @@ def imports_get_token( 'Content-Type': 'application/json', 'user-agent': 'sanderroosendaal'} + if 'grant_type' in oauth_data: + if oauth_data['grant_type']: + post_data['grant_type'] = oauth_data['grant_type'] + else: + grant_type = post_data.pop('grant_type',None) + + if 'json' in oauth_data['content_type']: response = requests.post( base_uri, diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 46b7f326..da035b17 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -451,7 +451,8 @@ def get_sessions_manager(m,teamid=0,startdate=date.today(), manager=m, startdate__lte=enddate, enddate__gte=startdate, - ).order_by("preferreddate","startdate","enddate") + ).order_by("preferreddate","startdate","enddate").exclude( + sessiontype='race') return sps @@ -462,14 +463,16 @@ def get_sessions(r,startdate=date.today(), rower__in=[r], startdate__lte=enddate, enddate__gte=startdate, - ).order_by("preferreddate","startdate","enddate") + ).order_by("preferreddate","startdate","enddate").exclude( + sessiontype='race') return sps def get_my_session_ids(r): sps = PlannedSession.objects.filter( rower__in=[r] - ).order_by("preferreddate","startdate","enddate") + ).order_by("preferreddate","startdate","enddate").exclude( + sessiontype='race') return [ps.id for ps in sps] diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index de47568d..32587db8 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -44,6 +44,7 @@ oauth_data = { 'expirydatename': '', 'bearer_auth': True, 'base_url': "https://www.strava.com/oauth/token", + 'grant_type': None, } diff --git a/rowers/templates/menu_demo.html b/rowers/templates/menu_demo.html new file mode 100644 index 00000000..e742af16 --- /dev/null +++ b/rowers/templates/menu_demo.html @@ -0,0 +1,77 @@ +
diff --git a/rowers/templates/menu_workouts.html b/rowers/templates/menu_workouts.html new file mode 100644 index 00000000..dff2a0a3 --- /dev/null +++ b/rowers/templates/menu_workouts.html @@ -0,0 +1,27 @@ + diff --git a/rowers/templates/redesign.html b/rowers/templates/redesign.html index 85bf97db..79779d35 100644 --- a/rowers/templates/redesign.html +++ b/rowers/templates/redesign.html @@ -6,8 +6,10 @@Vestibulum consectetur sit amet nisi ut consectetur. Praesent efficitur, nibh vitae fringilla scelerisque, est neque faucibus quam, in iaculis purus libero eget mauris. Curabitur et luctus sapien, ac gravida orci. Aliquam erat volutpat. In hac habitasse platea dictumst. Aenean commodo, arcu a commodo efficitur, libero dolor mollis turpis, non posuere orci leo eget enim. Curabitur sit amet elementum orci, pulvinar dignissim urna. Morbi id ex eu ex congue laoreet. Aenean tincidunt dolor justo, semper pretium libero luctus nec. Ut vulputate metus accumsan leo imperdiet tincidunt. Phasellus nec rutrum dolor. Cras imperdiet sollicitudin arcu, id interdum nibh fermentum in.
+Vestibulum consectetur sit amet nisi ut consectetur. Praesent efficitur, nibh vitae fringilla scelerisque, est neque faucibus quam, in iaculis purus libero eget mauris. Curabitur et luctus sapien, ac gravida orci. Aliquam erat volutpat. In hac habitasse platea dictumst. Aenean commodo, arcu a commodo efficitur, libero dolor mollis turpis, non posuere orci leo eget enim. Curabitur sit amet elementum orci, pulvinar dignissim urna. Morbi id ex eu ex congue laoreet. Aenean tincidunt dolor justo, semper pretium libero luctus nec. Ut vulputate metus accumsan leo imperdiet tincidunt. Phasellus nec rutrum dolor. Cras imperdiet sollicitudin arcu, id interdum nibh fermentum in. +
{% endblock %} {% block sidebar %} -Context Related Links +{% include 'menu_workouts.html' %} {% endblock %} diff --git a/rowers/views.py b/rowers/views.py index 72a2ea17..4a06cb58 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -12387,13 +12387,6 @@ def plannedsession_multiclone_view( r = getrequestrower(request,rowerid=rowerid) -# if 'startdate' in request.session: -# startdate = iso8601.parse_date(request.session['startdate']) - - -# if 'enddate' in request.session: -# enddate = iso8601.parse_date(request.session['enddate']) - if timeperiod != 'none': startdate,enddate = get_dates_timeperiod(timeperiod) @@ -12448,7 +12441,8 @@ def plannedsession_multiclone_view( rower__in=[r], startdate__lte=enddate, enddate__gte=startdate).order_by( - "startdate","preferreddate","enddate") + "startdate","preferreddate","enddate").exclude( + sessiontype='race') query = request.GET.get('q') if query: @@ -12590,7 +12584,8 @@ def plannedsession_create_view(request,timeperiod='thisweek',rowerid=0): sessioncreateform = PlannedSessionForm(initial=forminitial) - sps = get_sessions(r,startdate=startdate,enddate=enddate) + sps = get_sessions(r,startdate=startdate,enddate=enddate).exclude( + sessiontype='race') try: trainingplan = TrainingPlan.objects.filter( startdate__lte = startdate, @@ -12640,7 +12635,8 @@ def plannedsession_multicreate_view(request,timeperiod='thisweek', rower__in=[r], startdate__lte=enddate, enddate__gte=startdate, - ).order_by("startdate","preferreddate","enddate") + ).order_by("startdate","preferreddate","enddate").exclude( + sessiontype='race') else: qset = [] else: @@ -12652,7 +12648,8 @@ def plannedsession_multicreate_view(request,timeperiod='thisweek', manager = request.user, startdate__lte=enddate, enddate__gte=startdate, - ).order_by("startdate","preferreddate","enddate") + ).order_by("startdate","preferreddate","enddate").exclude( + sessiontype='race') @@ -12728,13 +12725,7 @@ def plannedsession_teamcreate_view(request,timeperiod='thisweek', startdate,enddate = get_dates_timeperiod(timeperiod) - try: - trainingplan = TrainingPlan.objects.filter( - startdate__lte = startdate, - rower = r, - enddate__gte = enddate)[0] - except IndexError: - trainingplan = None + trainingplan = None sps = [] for team in teams: @@ -14553,7 +14544,7 @@ def rower_trainingplan_view(request,id=0): if ps.sessionmode == 'time': mm.plantime += ps.sessionvalue mm.actualtime += int(ps.sessionvalue*ratio) - elif ps.sessionmode == 'distance': + elif ps.sessionmode == 'distance' and ps.sessiontype != 'race': mm.plandistance += ps.sessionvalue mm.actualdistance += int(ps.sessionvalue*ratio) elif ps.sessionmode == 'rScore': diff --git a/static/css/rowsandall2.css b/static/css/rowsandall2.css index 49634e36..719d573f 100644 --- a/static/css/rowsandall2.css +++ b/static/css/rowsandall2.css @@ -292,6 +292,16 @@ th.rotate > div > span { text-align: center; } +.blueicon { + text-decoration: none; + display: block; + /* width: 100%; */ + color: #1c75bc; + padding: 0.2em 0.0em 0.2em 0.0em; + zoom: 1; + + + a.button { color: white; } @@ -871,10 +881,34 @@ a.wh:hover { .icon-link a { text-decoration: none; - color: #27aae1; +/* color: #27aae1; */ } .icon-link a:hover, a:active, a:visited, a:link { - color: #1c75bc; - text-decoration: none; + /* color: #1c75bc; */ + text-decoration: none; } + + +.cd-accordion-menu input[type=checkbox] { + /* hide native checkbox */ + position: absolute; + opacity: 0; +} +.cd-accordion-menu label, .cd-accordion-menu a { + position: relative; + display: block; + padding: 18px 18px 18px 64px; + background: #4d5158; + box-shadow: inset 0 -1px #555960; + color: #ffffff; + font-size: 1.6rem; +} + + +.cd-accordion-menu input[type=checkbox]:checked + label + ul, +.cd-accordion-menu input[type=checkbox]:checked + label:nth-of-type(n) + ul { + /* use label:nth-of-type(n) to fix a bug on safari (<= 8.0.8) with multiple adjacent-sibling selectors*/ + /* show children when item is checked */ + display: block; +} diff --git a/static/css/styles2.css b/static/css/styles2.css index ccdd6c09..6cee6ed5 100644 --- a/static/css/styles2.css +++ b/static/css/styles2.css @@ -6,17 +6,50 @@ font: 1.2em Helvetica, arial, sans-serif; } + .wrapper > * { - border: 2px solid #f08c00; - padding: 5px; + /* border: 2px solid #f08c00; */ + border 0; + padding: 5px; + } + + a { + text-decoration: none; + color: #1c75bc; } nav ul { list-style: none; margin: 0; - padding: 0; - display: flex; - justify-content: space-between; + display: flex; + justify-content: space-between; + } + + footer ul { + list-style: none; + display: flex; + justify-content: space-between; + /* justify-content: flex-start; */ + flex-direction: row; + } + + footer ul ul { + flex-direction: column; + padding-top: 0; + padding-bottom: 0; + padding-left: 0; + padding-right: 2em; + } + + footer li { + margin: 0; + padding-bottom: 0.4em; + } + + footer h1 { + font-weight: bold; + text-align: left; + font-size: 1.0em; } header ul { @@ -26,44 +59,219 @@ } aside ul { - list-style: none; - margin: 0; - padding: 0; + margin-bottom: 0; + margin-top: 15px; + margin-bottom: 15px; + left: 15px; } + aside ul label, + aside ul a { + padding-left: 15px; + } + + aside ul ul label, + aside ul ul a { + padding-left: 30px; + } + + aside ul ul ul label, + aside ul ul ul a { + padding-left: 45px; + } + + aside ul ul ul ul label, + aside ul ul ul ul a { + padding-left: 60px; + } + + aside li, + aside a, + aside ul label, + aside ul li, + aside ul a, + aside ul ul label, + aside ul ul li, + aside ul ul a, + aside ul ul ul label, + aside ul ul ul li, + aside ul ul ul a { + list-style: none; + margin: 0; + background: #35383d; + } + + + aside ul label:hover, + aside ul a:hover, + aside ul ul label:hover, + aside ul ul a:hover, + aside ul ul ul label:hover, + aside ul ul ul a:hover { + background: #4d5158; + } + + + aside a { + color: #a0f6aa; + text-decoration: none; + padding: 0.2em 0em 0.2em 0em; + } + + + + + aside .cd-accordion-menu { + width: 100%; + max-width: 600px; + background: #35383d; + } + + aside .cd-accordion-menu ul { + /* by default hide all sub menus */ + display: none; + } + + aside .cd-accordion-menu li { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + } + + aside .cd-accordion-menu input[type=checkbox] { + /* hide native checkbox */ + position: absolute; + opacity: 0; + } + + aside .cd-accordion-menu label, + aside .cd-accordion-menu a { + position: relative; + display: block; + color: #dddddd; + font-size: 1.2em; + } + + aside i { + font-size: 1.2em; + } + + aside a::before { + content: '\00a0'; + width: 16px; + height: 16px; + display: inline-block; + font-size: inherit; + text-rendering: auto; + } + + + aside .cd-accordion-menu label::before + { + /* icons */ + font: normal normal normal 1.2em/1 FontAwesome; + font-size: inherit; + text-rendering: auto; + content: '\f0da'; + display: inline-block; + width: 16px; + height: 16px; + + -webkit-transform: translateY(0%); + -moz-transform: translateY(0%); + -ms-transform: translateY(0%); + -o-transform: translateY(0%); + transform: translateY(0%); + } + + aside .cd-accordion-menu label { + cursor: pointer; + background: #35383d; + } + + + aside .cd-accordion-menu input[type=checkbox]:checked + label::before { + /* rotate arrow */ + -webkit-transform: translateY(20%) rotate(90deg); + -moz-transform: translateY(20%) rotate(90deg); + -ms-transform: translateY(20%) rotate(90deg); + -o-transform: translateY(20%) rotate(90deg); + transform: translateY(20%) rotate(90deg); + + } + + + aside .cd-accordion-menu input[type=checkbox]:checked + label + ul, + aside .cd-accordion-menu input[type=checkbox]:checked + label:nth-of-type(n) + ul { + /* use label:nth-of-type(n) to fix a bug on safari (<= 8.0.8) with multiple adjacent-sibling selectors*/ + /* show children when item is checked */ + display: block; + } + + + user ul { list-style: none; margin: 0; - padding: 0; + padding: 0.2em 0.0em 0.2em 0.0em; display: flex; justify-content: flex-end; } + + user a i { + color: #1c75c; + } + + nav li { + padding: 0.2em 0.0em 0.2em 0.0em; + } + + nav a { + color: white; + } + nav a i { + color: white; + } + .main-head { - grid-area: header; + grid-area: header; } .main-user { grid-area: user; + background: #ededed; } .content { grid-area: content; + padding: 1.2em 1.2em 1.2em 1.2em; } .main-nav { grid-area: nav; + background: #1c75bc; } .side { grid-area: sidebar; + background: #35383d; + padding: 0; } + .ad { grid-area: ad; + background: #35383d; + color: #dddddd; + padding: 1em 1em 1em 1em; } .main-footer { grid-area: footer; + background: #ededed; + padding: 1.2em 1.2em 1.2em 1.2em; } + .wrapper { display: grid; - grid-gap: 2px; +/* grid-gap: 2px; */ grid-template-areas: "header" "user" @@ -113,13 +321,13 @@ @media (min-width: 768px) { .wrapper { - grid-template-columns: 1fr 5fr 1fr; + grid-template-columns: 1fr 4fr 1fr; grid-template-areas: - "header header header user" - "nav nav nav nav" - "sidebar content content content" - "sidebar content content content" - "ad footer footer footer" + "header header user" + "nav nav nav" + "sidebar content content" + "sidebar content content" + "ad footer footer" } nav ul { @@ -130,6 +338,18 @@ header ul { flex-direction: row; - } + } + + } + + +aside .cd-accordion-menu.animated label::before { + /* this class is used if you're using jquery to animate the accordion */ + -webkit-transition: -webkit-transform 0.3s; + -moz-transition: -moz-transform 0.3s; + transition: transform 0.3s; +} + + diff --git a/static/css/text2.css b/static/css/text2.css index 3e6772d8..a0cc72e8 100644 --- a/static/css/text2.css +++ b/static/css/text2.css @@ -67,12 +67,7 @@ h3 { font-size: 1em; } -h3 { - /* padding-top: 20px; */ - font-weight: normal; - text-align: left; - font-size: 1em; -} + h4 { @@ -103,7 +98,7 @@ li { margin-left: 30px; } -p, +p, dl, hr, h1, diff --git a/static/img/cd-icons.svg b/static/img/cd-icons.svg new file mode 100644 index 00000000..a6e5b2a4 --- /dev/null +++ b/static/img/cd-icons.svg @@ -0,0 +1,846 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +