Changeset - bd7608fb3d38
[Not reviewed]
Dennis Fink - 9 years ago 2015-10-22 22:35:37
dennis.fink@c3l.lu
Making status tables responsive

We wrap a div with the table-responsive class around the tables.
1 file changed with 41 insertions and 39 deletions:
0 comments (0 inline, 0 general)
ennstatus/templates/status/macros.html
Show inline comments
 
@@ -34,71 +34,73 @@
 
  {% elif '.bit' in request.url_root %}
 
    {% set url_root = '//%s' % config['ENNSTATUS_GLOBE_BIT_ADDRESS'] %}
 
  {% else %}
 
    {% set url_root = '//globe.enn.lu' %}
 
  {% endif %}
 
  <a href="{{ url_root }}/#/{{ url_type }}/{{ fingerprint }}">{{ fingerprint|upper}}</a>
 
{% endmacro %}
 

	
 
{% macro create_name(name) %}
 
  <a href="http://{{ name|lower }}.enn.lu">{{ name }}</a>
 
{% endmacro %}
 

	
 
{% macro create_date(date) %}
 
  {{ moment(date).format(config['ENNSTATUS_MOMENTJS_FORMAT']) }}
 
  <noscript>{{ date.strftime(config['ENNSTATUS_STRFTIME_FORMAT']) }}</noscript>
 
{% endmacro %}
 

	
 
{% macro create_server_table(server_type, servers) %}
 
  {% if server_type in ('exit', 'relay') %}
 
    {% set headers = ('#', 'Name', 'IP', 'IP6', 'Tor Status', 'Country', 'Fingerprint', 'Last Updated <noscript>(UTC)</noscript>') %}
 
  {% else %}
 
    {% set headers = ('#', 'Name', 'Tor Status', 'Country', 'Fingerprint', 'OBFS', 'FTEProxy', 'Flashproxy', 'meek', 'Last Updated <noscript>(UTC)</noscript>') %}
 
  {% endif %}
 
  <h2>{{ server_type|title }}</h2>
 
  <table class="table table-bordered table-striped sortable">
 
    <thead>
 
      <tr>
 
        {% for name in headers %}
 
          <th>{{ name|safe }}</th>
 
  <div class="table-responsive">
 
    <table class="table table-bordered table-striped sortable">
 
      <thead>
 
        <tr>
 
          {% for name in headers %}
 
            <th>{{ name|safe }}</th>
 
          {% endfor %}
 
        </tr>
 
      </thead>
 
      <tbody>
 
        {% for server in servers|sort(attribute='name')|sort(attribute='country') %}
 
        <tr {% if server.name in config['ENNSTATUS_BRIDGE_PROGRAM'] %}class="info"{% endif %}>
 
            <td>{{ loop.index }}</td>
 
            {% if server_type in ('exit', 'relay') %}
 
              <td>{{ create_name(server.name) }}</td>
 
              <td>{{ server.ip }}</td>
 
              <td>{{ server.ip6 or 'N/A' }}</td>
 
            {% else %}
 
              <td>
 
                {% if server.name in config['ENNSTATUS_BRIDGE_PROGRAM'] %}
 
                  <a href="{{ url_for('root.bridgeprogram') }}">{{ server.name }}</a>
 
                {% else %}
 
                  {{ server.name }}
 
                {% endif %}
 
              </td>
 
            {% endif %}
 
            <td>{{ colorize_status(server.status) }}</td>
 
            <td>{{ create_country(server.country) }}</td>
 
            <td>{{ create_fingerprint(server.fingerprint, server.type) }}</td>
 
            {% if server_type == 'bridge' %}
 
              <td>{{ colorize_obfs(server.obfs) }}</td>
 
              <td>{{ colorize_obfs(server.fteproxy) }}</td>
 
              <td>{{ colorize_obfs(server.flashproxy) }}</td>
 
              <td>{{ colorize_obfs(server.meek) }}</td>
 
            {% endif %}
 
            <td>{{ create_date(server.last_updated) }}
 
            </td>
 
          </tr>
 
        {% endfor %}
 
      </tr>
 
    </thead>
 
    <tbody>
 
      {% for server in servers|sort(attribute='name')|sort(attribute='country') %}
 
      <tr {% if server.name in config['ENNSTATUS_BRIDGE_PROGRAM'] %}class="info"{% endif %}>
 
          <td>{{ loop.index }}</td>
 
          {% if server_type in ('exit', 'relay') %}
 
            <td>{{ create_name(server.name) }}</td>
 
            <td>{{ server.ip }}</td>
 
            <td>{{ server.ip6 or 'N/A' }}</td>
 
          {% else %}
 
            <td>
 
              {% if server.name in config['ENNSTATUS_BRIDGE_PROGRAM'] %}
 
                <a href="{{ url_for('root.bridgeprogram') }}">{{ server.name }}</a>
 
              {% else %}
 
                {{ server.name }}
 
              {% endif %}
 
            </td>
 
          {% endif %}
 
          <td>{{ colorize_status(server.status) }}</td>
 
          <td>{{ create_country(server.country) }}</td>
 
          <td>{{ create_fingerprint(server.fingerprint, server.type) }}</td>
 
          {% if server_type == 'bridge' %}
 
            <td>{{ colorize_obfs(server.obfs) }}</td>
 
            <td>{{ colorize_obfs(server.fteproxy) }}</td>
 
            <td>{{ colorize_obfs(server.flashproxy) }}</td>
 
            <td>{{ colorize_obfs(server.meek) }}</td>
 
          {% endif %}
 
          <td>{{ create_date(server.last_updated) }}
 
          </td>
 
        </tr>
 
      {% endfor %}
 
    </tbody>
 
  </table>
 
      </tbody>
 
    </table>
 
  </div>
 
  {% if server_type == 'bridge' %}
 
    <div class="alert alert-info alert-dismissible" role="alert">
 
      <button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
 
      <p>See our <a class="alert-link" href="{{ url_for('root.bridgeprogram') }}">bridge program</a>, if you want to fund some bridges!</p>
 
    </div>
 
  {% endif %}
 
{% endmacro %}
0 comments (0 inline, 0 general)