Commits

Luke Plant committed 875f25c Merge

Merged from default

Comments (0)

Files changed (3)

cciw/officers/views.py

                                      self.cleaned_data['last_name'],
                                      self.cleaned_data['email'])
 
+
 @staff_member_required
 @user_passes_test(_is_camp_admin)
 def create_officer(request):
                 try:
                     u = form.save()
                     form = CreateOfficerForm()
-                    message = "Officer %s has been added and e-mailed.  You can add another if required, or close this popup to continue." % u.username
+                    messages.info(request, "Officer %s has been added and e-mailed.  You can add another if required, or close this popup to continue." % u.username)
+                    camp_id = request.GET.get('camp_id')
+                    if camp_id is not None:
+                        Invitation.objects.get_or_create(camp=Camp.objects.get(id=camp_id), officer=u)
                 except create.EmailError:
-                    message = "Due to a problem sending e-mail, the officer has not been added to the system.  Please try again later"
+                    messages.error(request, "Due to a problem sending e-mail, the officer has not been added to the system.  Please try again later.")
 
     else:
         form = CreateOfficerForm()

templates/cciw/officers/create_officer.html

 {% endif %}
 
 <h2>Enter details for officer</h2>
-<form action="." method="post">{% csrf_token %}
+<form action="" method="post">{% csrf_token %}
 <div>
     <table>
       {{ form.as_table }}

templates/cciw/officers/officer_list.html

 
     var newOfficerHandler = function(ev) {
         var popup = $('#id_add_officer_popup');
-        popup.find(".iframe_container").html('<iframe src="{% url cciw.officers.views.create_officer %}?is_popup=1" width="780" frameborder=0 height="400">');
+        popup.find(".iframe_container").html('<iframe src="{% url cciw.officers.views.create_officer %}?is_popup=1&camp_id={{ camp.id }}" width="780" frameborder=0 height="400">');
         popup.css({
             "position": "fixed",
             "top": ($(window).height()/2 - popup.height()/2).toString() + "px",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.