Mercurial > public > sg101
changeset 1097:deed541ca79d
Get rid of GCalendar thanks pages.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sun, 26 Jun 2016 21:27:31 -0500 |
parents | d9cd3180c12c |
children | c245caccbbb3 |
files | gcalendar/urls.py gcalendar/views.py sg101/templates/gcalendar/edit.html sg101/templates/gcalendar/event.html sg101/templates/gcalendar/thanks_add.html sg101/templates/gcalendar/thanks_edit.html |
diffstat | 6 files changed, 36 insertions(+), 35 deletions(-) [+] |
line wrap: on
line diff
--- a/gcalendar/urls.py Tue Jun 14 21:16:09 2016 -0500 +++ b/gcalendar/urls.py Sun Jun 26 21:27:31 2016 -0500 @@ -12,6 +12,4 @@ url(r'^change/$', gcalendar.views.edit_events, name='gcalendar-edit_events'), url(r'^change/(\d+)/$', gcalendar.views.edit_event, name='gcalendar-edit_event'), url(r'^delete/$', gcalendar.views.delete_event, name='gcalendar-delete'), - url(r'^thanks/add/$', gcalendar.views.add_thanks, name='gcalendar-add_thanks'), - url(r'^thanks/change/$', gcalendar.views.edit_thanks, name='gcalendar-edit_thanks'), ]
--- a/gcalendar/views.py Tue Jun 14 21:16:09 2016 -0500 +++ b/gcalendar/views.py Sun Jun 26 21:27:31 2016 -0500 @@ -35,6 +35,7 @@ @login_required def add_event(request): + thanks_flag = False if request.method == 'POST': form = EventEntryForm(request.POST) if form.is_valid(): @@ -42,25 +43,21 @@ event.user = request.user event.repeat = 'none' event.save(html=form.html) - return HttpResponseRedirect(reverse('gcalendar-add_thanks')) + return HttpResponseRedirect(reverse('gcalendar-add') + '?thanks=1') else: form = EventEntryForm() + thanks_flag = bool(request.GET.get('thanks', False)) return render(request, 'gcalendar/event.html', { 'title': 'Add Calendar Event', 'form': form, 'is_new': True, + 'thanks_flag': thanks_flag, 'V3_DESIGN': True, }) @login_required -def add_thanks(request): - return render(request, 'gcalendar/thanks_add.html', { - }) - - -@login_required def edit_events(request): events = Event.objects.filter(user=request.user, status=Event.ON_CAL).\ order_by('-start_date') @@ -73,6 +70,7 @@ return render(request, 'gcalendar/edit.html', { 'page': page, + 'thanks_flag': bool(request.GET.get('thanks', False)), 'V3_DESIGN': True, }) @@ -91,7 +89,7 @@ event.repeat = 'none' event.status = Event.EDIT_REQ event.save() - return HttpResponseRedirect(reverse('gcalendar-edit_thanks')) + return HttpResponseRedirect(reverse('gcalendar-edit_events') + '?thanks=1') else: form = EventEntryForm(instance=event) @@ -103,12 +101,6 @@ }) -@login_required -def edit_thanks(request): - return render(request, 'gcalendar/thanks_edit.html', { - }) - - def delete_event(request): """This view marks an event for deletion. It is called via AJAX.""" if request.user.is_authenticated():
--- a/sg101/templates/gcalendar/edit.html Tue Jun 14 21:16:09 2016 -0500 +++ b/sg101/templates/gcalendar/edit.html Sun Jun 26 21:27:31 2016 -0500 @@ -12,6 +12,20 @@ </ul> </nav> +{% if thanks_flag %} +<div class="success callout" data-closable> + <h5>Event Calendar Changes Received</h5> + <p> + Thanks for updating your event. + Your changes will be reviewed by the staff, and should appear on the calendar + shortly. You may be contacted if we have any questions. + </p> + <button class="close-button" aria-label="Dismiss message" type="button" data-close> + <span aria-hidden="true">×</span> + </button> +</div> +{% endif %} + <h2>Edit Calendar Events</h2> {% if page.object_list %} <p>
--- a/sg101/templates/gcalendar/event.html Tue Jun 14 21:16:09 2016 -0500 +++ b/sg101/templates/gcalendar/event.html Sun Jun 26 21:27:31 2016 -0500 @@ -21,6 +21,19 @@ </ul> </nav> +{% if thanks_flag %} +<div class="success callout" data-closable> + <h5>Thanks for submitting an event!</h5> + <p> + Thanks for submitting an event to our calendar. Your event will be reviewed by the staff, + and should appear on the calendar shortly. You may be contacted if we have any questions. + </p> + <button class="close-button" aria-label="Dismiss message" type="button" data-close> + <span aria-hidden="true">×</span> + </button> +</div> +{% endif %} + <h2>{{ title }}</h2> <p>Use this form to add or change an event on our calendar. Please note the following:</p> <ul> @@ -140,7 +153,9 @@ </div> {% endif %} {{ form.time_zone }} - <input type="submit" name="submit_button" value="Add Event" class="primary button" /> + <input type="submit" name="submit_button" + value="{% if is_new %}Add{% else %}Update{% endif %} Event" + class="primary button" /> </form> <div class="small reveal" id="hot-link-modal" data-reveal>
--- a/sg101/templates/gcalendar/thanks_add.html Tue Jun 14 21:16:09 2016 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -{% extends 'base.html' %} -{% block title %}Event Calendar - Thanks{% endblock %} -{% block content %} -<div class="breadcrumbs"><a href="{% url 'gcalendar-index' %}">Calendar</a> » Thanks</div> -<h2>Thanks for Submitting an Event!</h2> -<p>Thanks for submitting an event to our calendar. Your event will be reviewed by the staff, -and should appear on the calendar shortly. You may be contacted if we have any questions.</p> -<p><a href="{% url 'gcalendar-index' %}">« Back to the Event Calendar</a></p> -{% endblock %}
--- a/sg101/templates/gcalendar/thanks_edit.html Tue Jun 14 21:16:09 2016 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -{% extends 'base.html' %} -{% block title %}Event Calendar Changes Received{% endblock %} -{% block content %} -<div class="breadcrumbs"><a href="{% url 'gcalendar-index' %}">Calendar</a> » Edit Events</div> -<h2>Event Calendar Changes Received</h2> -<p>We've received the changes to your calendar event. Your changes will be reviewed by the staff, -and should appear on the calendar shortly. You may be contacted if we have any questions.</p> -<p><a href="{% url 'gcalendar-index' %}">« Back to the Event Calendar</a></p> -{% endblock %}