diff --git a/rowers/views.py b/rowers/views.py index b2ab8752..15f51f08 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -103,6 +103,7 @@ import rowers.uploads as uploads from django.forms.formsets import formset_factory from django.forms import modelformset_factory import StringIO +import cStringIO from django.contrib.auth.decorators import login_required #,user_passes_test from rowers.decorators import user_passes_test from time import strftime,strptime,mktime,time,daylight @@ -1457,31 +1458,9 @@ def plannedsessions_icsemail_view(request,userid=0): event.add('comment',comment) cal.add_component(event) - icsfilename = 'calendar_{id}.ics'.format(id=request.user.id) - - with open(icsfilename,'wb') as f: - f.write(cal.to_ical()) - res = myqueue(queuehigh,handle_sendemailics, - request.user.first_name, - request.user.last_name, - request.user.email,icsfilename, - emailbounced = r.emailbounced - ) - - - successmessage = "The calendar file was sent to you per email" - messages.info(request,successmessage) - url = reverse(plannedsessions_view, - kwargs = { - 'userid':r.user.id, - }) - startdatestring = startdate.strftime('%Y-%m-%d') - enddatestring = enddate.strftime('%Y-%m-%d') - url+='?when='+startdatestring+'/'+enddatestring - - - response = HttpResponseRedirect(url) + response = HttpResponse(cal.to_ical(),content_type = 'text/plain') + response['Content-Disposition'] = 'attachment; filename="training_plan_%s.ics"' % request.user.id return response diff --git a/static/css/styles2.css b/static/css/styles2.css index 96d7bb23..216ac4fc 100644 --- a/static/css/styles2.css +++ b/static/css/styles2.css @@ -660,10 +660,51 @@ } @media print { - header, user, nav, aside, footer { + .wrapper { + display: grid; + grid-template-columns: repeat(4,1fr); + grid-template-areas: + "content content content content" + } + + header, ad, user, nav, aside, footer { display: none; } + * { + -webkit-transition: none !important; + transition: none !important; + } + + + body { + color:#000; + background: #fff; + } + + body, content { + width: 100%; + display: block; + min-height: 100%; + } + + @page { + margin: 2cm; + } + + h1, h2, h3 { + page-break-after: avoid; + } + + ul, img { + page-break-inside: avoid; + } + + table tr td { + vertical-align: middle; + } +} + 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; diff --git a/templates/newbase.html b/templates/newbase.html index ebeb7bb6..11a5ece0 100644 --- a/templates/newbase.html +++ b/templates/newbase.html @@ -289,14 +289,14 @@ {% endblock %} -
+ {% block ad %}

Prygl Rowing Camps

{% endblock %} -
+