Skip to content

Commit

Permalink
Add action button to accessor audit table
Browse files Browse the repository at this point in the history
Add the action button to the accessor audit table. Also add a template
for this action button that can swap its div using htmx upon success.
  • Loading branch information
amstilp committed Jun 21, 2024
1 parent a341a6e commit 6c50e46
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion primed/cdsa/audit/accessor_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class SignedAgreementAccessorAuditTable(tables.Table):
member = tables.Column(linkify=True)
has_access = BooleanIconColumn(show_false_icon=True)
note = tables.Column()
# action = tables.TemplateColumn(template_name="dbgap/snippets/dbgap_collaborator_audit_action_button.html")
action = tables.TemplateColumn(template_name="cdsa/snippets/accessor_audit_action_button.html")

class Meta:
attrs = {"class": "table align-middle"}
Expand Down
22 changes: 22 additions & 0 deletions primed/templates/cdsa/snippets/accessor_audit_action_button.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div>
{% if record.action %}
<form
method="post"
action="{% url 'cdsa:audit:signed_agreements:accessors:resolve' record.signed_agreement.cc_id record.member.email %}">

{% csrf_token %}
<button
type="submit"
class="btn btn-primary btn-sm"
hx-post="{% url 'cdsa:audit:signed_agreements:accessors:resolve' record.signed_agreement.cc_id record.member.email %}"
hx-disabled-elt="this"
hx-target="closest div"
hx-swap="innerHTML">
{{ record.action }}
</button>
</form>

{% else %}
&mdash;
{% endif %}
</div>

0 comments on commit 6c50e46

Please sign in to comment.