Skip to content

Commit

Permalink
dynamic dashboard columns 18c76e9
Browse files Browse the repository at this point in the history
  • Loading branch information
parsch committed Aug 22, 2024
1 parent 9ba4a5d commit b43a9d8
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions grappelli/dashboard/templates/grappelli/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@
{{ dashboard.media }}

<div class="g-d-c">
<div class="g-d-12 g-d-f" id="column_1">
{% for module in dashboard.children %}
{% if module.column == 1 %}
{% grp_render_dashboard_module module forloop.counter %}
{% with ''|ljust:dashboard.columns as range %}
{% with '0' as outer_counter %}
{% for _ in range %}
{% with outer_counter|add:'1' as outer_counter %}
<div
{% if forloop.first %}
class="g-d-{% widthratio 23 dashboard.columns|add:'1' 2 %} g-d-f"
{% else %}
{% if range|length == outer_counter %}
class="g-d-{% widthratio 23 dashboard.columns|add:'1' 1 %} g-d-l"
{% else %}
class="g-d-{% widthratio 23 dashboard.columns|add:'1' 1 %}"
{% endif %}
{% endif %}
{% endfor %}
</div>
<div class="g-d-6" id="column_2">
{% for module in dashboard.children %}
{% if module.column == 2 %}
{% grp_render_dashboard_module module forloop.counter %}
{% endif %}
{% endfor %}
</div>
<div class="g-d-6 g-d-l" id="column_3">
{% for module in dashboard.children %}
{% if module.column == 3 %}
{% grp_render_dashboard_module module forloop.counter %}
{% endif %}
{% endfor %}
</div>
</div>
id="column_{{outer_counter}}"
>
{% for module in dashboard.children %}
{% if module.column == outer_counter %}
{% grp_render_dashboard_module module forloop.counter %}
{% endif %}
{% endfor %}
</div>
{% endwith %}
{% endfor %}
{% endwith %}
{% endwith %}
</div>

0 comments on commit b43a9d8

Please sign in to comment.