Skip to content

Commit

Permalink
Move data prep workspace tables into their own template snippet
Browse files Browse the repository at this point in the history
This way, we only have to change the code only in place.
  • Loading branch information
amstilp committed Mar 14, 2024
1 parent 6d8fd7d commit bf13f82
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 37 deletions.
19 changes: 1 addition & 18 deletions primed/templates/cdsa/cdsaworkspace_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,7 @@ <h2 class="accordion-header" id="headingAcknowledgments">
</div>
</div>

<div class="my-3">
<div class="accordion" id="accordionDataPrepWorkspace">
<div class="accordion-item">
<h2 class="accordion-header" id="headingDataPrepWorkspace">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseDataPrepWorkspace" aria-expanded="false" aria-controls="collapseDataPrepWorkspace">
<span class="fa-solid fa-computer mx-2"></span>
Associated data prep workspaces
<span class="badge mx-2 bg-secondary pill"> {{ associated_data_prep_workspace.rows|length }}</span>
</button>
</h2>
<div id="collapseDataPrepWorkspace" class="accordion-collapse collapse" aria-labelledby="headingDataPrepWorkspace" data-bs-parent="#accordionDataPrepWorkspace">
<div class="accordion-body">
{% render_table associated_data_prep_workspaces %}
</div>
</div>
</div>
</div>
</div>
{% include "snippets/data_prep_workspace_table.html" with table=associated_data_prep_workspaces %}

{{block.super}}
{% endblock after_panel %}
21 changes: 2 additions & 19 deletions primed/templates/dbgap/dbgapworkspace_detail.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "anvil_consortium_manager/workspace_detail.html" %}
{% load render_table from django_tables2 %}
{% load render_table from django_tables2%}

{% block pills %}
{% if workspace_data_object.gsr_restricted %}
Expand Down Expand Up @@ -94,24 +94,7 @@ <h2 class="accordion-header" id="headingAcknowledgments">
</div>
</div>

<div class="my-3">
<div class="accordion" id="accordionDataPrepWorkspace">
<div class="accordion-item">
<h2 class="accordion-header" id="headingDataPrepWorkspace">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseDataPrepWorkspace" aria-expanded="false" aria-controls="collapseDataPrepWorkspace">
<span class="fa-solid fa-computer mx-2"></span>
Associated data prep workspaces
<span class="badge mx-2 bg-secondary pill"> {{ associated_data_prep_workspace.rows|length }}</span>
</button>
</h2>
<div id="collapseDataPrepWorkspace" class="accordion-collapse collapse" aria-labelledby="headingDataPrepWorkspace" data-bs-parent="#accordionDataPrepWorkspace">
<div class="accordion-body">
{% render_table associated_data_prep_workspaces %}
</div>
</div>
</div>
</div>
</div>
{% include "snippets/data_prep_workspace_table.html" with table=associated_data_prep_workspaces %}

{{block.super}}
{% endblock after_panel %}
Expand Down
20 changes: 20 additions & 0 deletions primed/templates/snippets/data_prep_workspace_table.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{% load render_table from django_tables2 %}

<div class="my-3">
<div class="accordion" id="accordionDataPrepWorkspace">
<div class="accordion-item">
<h2 class="accordion-header" id="headingDataPrepWorkspace">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseDataPrepWorkspace" aria-expanded="false" aria-controls="collapseDataPrepWorkspace">
<span class="fa-solid fa-spinner mx-2"></span>
Associated data prep workspaces
<span class="badge mx-2 bg-secondary pill"> {{ table.rows|length }}</span>
</button>
</h2>
<div id="collapseDataPrepWorkspace" class="accordion-collapse collapse" aria-labelledby="headingDataPrepWorkspace" data-bs-parent="#accordionDataPrepWorkspace">
<div class="accordion-body">
{% render_table table %}
</div>
</div>
</div>
</div>
</div>

0 comments on commit bf13f82

Please sign in to comment.