mwielgoszewski/doorman

View on GitHub
doorman/templates/manage/_activity.html

Summary

Maintainability
Test Coverage

            <div class="col-md-3">
                <ul class="nav nav-tabs tabs-left" role="tablist">
                    {% if queries %}
                    <li class="active">
                        <a href="#distributed_queries" aria-controls="distributed_queries" role="tab" data-toggle="tab">distributed queries
                            <span class="badge">{{ queries | count }}</span>
                        </a>
                    </li>
                    {% endif %}

                    {% for group in recent | groupby('name') %}
                    <li class="{% if not queries and loop.first %}active{% endif %}">
                        <a href="#{{ loop.index }}" aria-controls="{{ loop.index }}" role="tab" data-toggle="tab">{{ group.grouper }}
                            <span class="badge">{{ group.list | count }}</span>
                        </a>
                    </li>
                    {% endfor %}
                </ul>
            </div>

            <div class="col-md-9">
                <div class="tab-content">

                    {% if queries %}
                    <div role="tabpanel" class="tab-pane active" id="distributed_queries">
                        {% include "tables/distributed.html" %}
                    </div>
                    {% endif %}

                    {% for grouper, results in recent | groupby('name') %}
                    <div role="tabpanel" class="tab-pane{% if not queries and loop.first %} active{% endif %}" id="{{ loop.index }}">

                        {% set columns = results | first | attr('columns') | list | sort %}

                        <div class="table-responsive">
                            <table class="table table-striped table-condensed">
                                <thead>
                                    <th>activity</th>
                                    <th>timestamp</th>
                                    {% for column in columns %}
                                    <th>{{ column }}</th>
                                    {% endfor %}
                                </thead>

                                <tbody>
                                    {% for result in results %}
                                    <tr>
                                        <td>{{ result.action }}</td>
                                        <td>{{ result.timestamp }}</td>
                                        {% for column in columns %}
                                        <td>{{ result.columns[column] | render(column) }}</td>
                                        {% endfor %}
                                    </tr>
                                    {% endfor %}

                                </tbody>
                            </table>
                        </div>

                    </div><!-- ./tab-pane -->

                    {% endfor %}

                </div><!-- ./tab-content -->
            </div>