Skip to content

Commit 11143e4

Browse files
Surface contact management panel
1 parent b21d802 commit 11143e4

3 files changed

Lines changed: 53 additions & 31 deletions

File tree

mailing/tests/test_operator_ui.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,16 @@ def test_contact_detail_renders_summary_before_management_and_debug_sections(
915915
assert "Last sent" in html
916916
assert "Long Newsletter Audience Tag" in html
917917
assert "Recent Activity" in html
918+
assert "Manage contact" in html
919+
assert "Manage contact state, subscriptions, and tags" not in html
918920
assert "Campaign: Weekly update" in html
919921
assert f"/campaigns/{campaign.id}/#recipient-{recipient.id}" in html
920-
assert html.index("Send Eligibility") < html.index("Membership and Tags") < html.index("Recent Activity")
921-
assert html.index("Recent Activity") < html.index("Manage contact state, subscriptions, and tags")
922+
assert html.index('id="sendability">Send Eligibility') < html.index('id="membership">Membership and Tags')
923+
assert html.index('id="membership">Membership and Tags') < html.index('id="manage-contact-heading">Manage contact')
924+
assert html.index('id="manage-contact-heading">Manage contact') < html.index('id="recent-activity">Recent Activity')
925+
manage_html = html[html.index('<section class="detail-section manage-contact-panel"') :]
926+
assert manage_html.index("Subscription") < manage_html.index("State") < manage_html.index("Add tag")
927+
assert manage_html.index("Add tag") < manage_html.index("Remove tag")
922928
assert html.index("Full event timeline and audit details") > html.index("Recent Activity")
923929

924930

static/mailing/css/app.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,16 @@ a.stat-link:focus {
611611
gap: var(--dm-space-3);
612612
}
613613

614+
.manage-form-grid {
615+
display: grid;
616+
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
617+
gap: var(--dm-space-3);
618+
}
619+
620+
.manage-form h3 {
621+
margin-top: 0;
622+
}
623+
614624
.compact-row {
615625
display: grid;
616626
gap: var(--dm-space-2);

templates/mailing/operator/contact_detail.html

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,41 @@ <h3>Tags</h3>
127127
</div>
128128
</section>
129129

130+
<section class="detail-section manage-contact-panel" id="manage-contact" aria-labelledby="manage-contact-heading">
131+
<div class="section-header">
132+
<h2 id="manage-contact-heading">Manage contact</h2>
133+
</div>
134+
<div class="manage-form-grid">
135+
<form class="summary-panel manage-form" method="post" action="{% url 'mailing:contact_subscription_update' contact.normalized_email %}">
136+
{% csrf_token %}
137+
<h3>Subscription</h3>
138+
{% include "mailing/operator/_form_fields.html" with form=subscription_form %}
139+
<div class="toolbar"><button type="submit">Update subscription</button></div>
140+
</form>
141+
142+
<form class="summary-panel manage-form" method="post" action="{% url 'mailing:contact_state_update' contact.normalized_email %}">
143+
{% csrf_token %}
144+
<h3>State</h3>
145+
{% include "mailing/operator/_form_fields.html" with form=contact_state_form %}
146+
<div class="toolbar"><button type="submit">Update state</button></div>
147+
</form>
148+
149+
<form class="summary-panel manage-form" method="post" action="{% url 'mailing:contact_tag_add' contact.normalized_email %}">
150+
{% csrf_token %}
151+
<h3>Add tag</h3>
152+
{% include "mailing/operator/_form_fields.html" with form=tag_add_form %}
153+
<div class="toolbar"><button type="submit">Add tag</button></div>
154+
</form>
155+
156+
<form class="summary-panel manage-form" method="post" action="{% url 'mailing:contact_tag_remove' contact.normalized_email %}">
157+
{% csrf_token %}
158+
<h3>Remove tag</h3>
159+
{% include "mailing/operator/_form_fields.html" with form=tag_remove_form %}
160+
<div class="toolbar"><button type="submit">Remove tag</button></div>
161+
</form>
162+
</div>
163+
</section>
164+
130165
<section class="detail-section" aria-labelledby="recent-activity">
131166
<div class="section-header">
132167
<h2 id="recent-activity">Recent Activity</h2>
@@ -158,35 +193,6 @@ <h2 id="recent-activity">Recent Activity</h2>
158193
{% endif %}
159194
</section>
160195

161-
<details class="detail-section secondary-section" id="manage-contact">
162-
<summary>Manage contact state, subscriptions, and tags</summary>
163-
<div class="form-stack">
164-
<form method="post" action="{% url 'mailing:contact_state_update' contact.normalized_email %}">
165-
<h3>State</h3>
166-
{% include "mailing/operator/_form_fields.html" with form=contact_state_form %}
167-
<div class="toolbar"><button type="submit">Update state</button></div>
168-
</form>
169-
170-
<form method="post" action="{% url 'mailing:contact_subscription_update' contact.normalized_email %}">
171-
<h3>Subscription</h3>
172-
{% include "mailing/operator/_form_fields.html" with form=subscription_form %}
173-
<div class="toolbar"><button type="submit">Update subscription</button></div>
174-
</form>
175-
176-
<form method="post" action="{% url 'mailing:contact_tag_add' contact.normalized_email %}">
177-
<h3>Add tag</h3>
178-
{% include "mailing/operator/_form_fields.html" with form=tag_add_form %}
179-
<div class="toolbar"><button type="submit">Add tag</button></div>
180-
</form>
181-
182-
<form method="post" action="{% url 'mailing:contact_tag_remove' contact.normalized_email %}">
183-
<h3>Remove tag</h3>
184-
{% include "mailing/operator/_form_fields.html" with form=tag_remove_form %}
185-
<div class="toolbar"><button type="submit">Remove tag</button></div>
186-
</form>
187-
</div>
188-
</details>
189-
190196
<details class="detail-section secondary-section">
191197
<summary>Full send eligibility by scope</summary>
192198
{% if eligibility %}

0 commit comments

Comments
 (0)