* feat: Add "generate email" to action on nominees page (#4893) * fix: Use bare email address for now
This commit is contained in:
parent
83a13a58ba
commit
0693a4357d
|
@ -190,6 +190,7 @@ def private_index(request, year):
|
||||||
nomcom = get_nomcom_by_year(year)
|
nomcom = get_nomcom_by_year(year)
|
||||||
all_nominee_positions = NomineePosition.objects.get_by_nomcom(nomcom).not_duplicated()
|
all_nominee_positions = NomineePosition.objects.get_by_nomcom(nomcom).not_duplicated()
|
||||||
is_chair = nomcom.group.has_role(request.user, "chair")
|
is_chair = nomcom.group.has_role(request.user, "chair")
|
||||||
|
mailto = None
|
||||||
if is_chair and request.method == 'POST':
|
if is_chair and request.method == 'POST':
|
||||||
if nomcom.group.state_id != 'active':
|
if nomcom.group.state_id != 'active':
|
||||||
messages.warning(request, "This nomcom is not active. Request administrative assistance if Nominee state needs to change.")
|
messages.warning(request, "This nomcom is not active. Request administrative assistance if Nominee state needs to change.")
|
||||||
|
@ -207,6 +208,8 @@ def private_index(request, year):
|
||||||
elif action == "set_as_pending":
|
elif action == "set_as_pending":
|
||||||
nominations.update(state='pending')
|
nominations.update(state='pending')
|
||||||
messages.success(request,'The selected nominations have been set as pending')
|
messages.success(request,'The selected nominations have been set as pending')
|
||||||
|
elif action == 'email':
|
||||||
|
mailto = ','.join([np.nominee.email.email_address() for np in nominations])
|
||||||
else:
|
else:
|
||||||
messages.warning(request, "Please, select some nominations to work with")
|
messages.warning(request, "Please, select some nominations to work with")
|
||||||
|
|
||||||
|
@ -278,6 +281,7 @@ def private_index(request, year):
|
||||||
'selected_position': selected_position and int(selected_position) or None,
|
'selected_position': selected_position and int(selected_position) or None,
|
||||||
'selected': 'index',
|
'selected': 'index',
|
||||||
'is_chair': is_chair,
|
'is_chair': is_chair,
|
||||||
|
'mailto': mailto,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -234,12 +234,21 @@
|
||||||
<option value="set_as_declined">
|
<option value="set_as_declined">
|
||||||
Set as declined
|
Set as declined
|
||||||
</option>
|
</option>
|
||||||
|
<option value="email">
|
||||||
|
Generate email list
|
||||||
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-warning" type="submit" title="Run action">
|
<button class="btn btn-warning" type="submit" title="Run action">
|
||||||
Apply
|
Apply
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
{% if mailto %}
|
||||||
|
<br>
|
||||||
|
<a class="btn btn-primary btn-sm"
|
||||||
|
href="mailto:{{ mailto }}">Mail to selected nominees
|
||||||
|
</a>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue