<commit_before>{% from "macros/datetime.jinja" import insert_timeago_date, timeago_script with context %}
{% from "macros/links.jinja" import club_link %}

{% extends "base-page.jinja" %}
{% set active_page = "settings" %}

{% block title %}{{ g.user|e }}{% endblock %}


{% macro add_locations(locations) -%}
{% for location in locations -%}
[{{ location.longitude }}, {{ location.latitude }}]{% if not loop.last %},{% endif %}
{%- endfor %}
{%- endmacro %}


{% block styles -%}
{{ super() }}

{% if takeoff_locations -%}
{% assets 'openlayers_css' -%}
<link href="{{ ASSET_URL }}" rel="stylesheet" type="text/css" />
{%- endassets %}
{%- endif %}
{%- endblock %}


{% block scripts -%}
{{ super() }}

{% if takeoff_locations -%}
{% assets 'openlayers_js' -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

<script type="text/javascript">
  $(function() {
    initOpenLayers("map_canvas",
                 "{{ config.get('SKYLINES_MAP_TILE_URL', '') }}");

    $.getScript("https://maps.google.com/maps/api/js?v=3.7&sensor=false&callback=addGoogleLayer");
    addBingLayers("{{ config.get('SKYLINES_BING_API_KEY', 'null') }}");
    addReliefLayer();

    var vectorLayer = new OpenLayers.Layer.Vector("Takeoff Locations", {
      displayInLayerSwitcher: false
    });
    map.addLayer(vectorLayer);

    var locations = [{{ add_locations(takeoff_locations) }}];
    for (var i = 0; i < locations.length; ++i) {
      point = new OpenLayers.Geometry.Point(locations[i][0], locations[i][1]);
      point = point.transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
      vectorLayer.addFeatures(new OpenLayers.Feature.Vector(point, {},
        {
          externalGraphic: "/vendor/openlayers/img/marker-gold.png",
          graphicHeight: 21,
          graphicWidth: 16,
          graphicXOffset: -16/2,
          graphicYOffset: -21
        }
      ));
    }
    map.zoomToExtent(vectorLayer.getDataExtent().scale(1.1));
    var zoom = map.getZoom();
    if (zoom > 10)
      map.zoomTo(10);

    initInfoBox({flight_info: false, location_info: true});
  });
</script>
{%- endif %}

{{ timeago_script() }}
{%- endblock %}


{%- block content %}
<div itemscope="" itemtype="http://schema.org/Person">
  <meta itemprop="url" content="{{ url_for('.index', _external=True) }}" />
  <div class="row">
    <div class="well col-md-8 col-md-offset-2">
      <table class="right">
        {% if g.user.is_readable(g.current_user) -%}
        <tr>
          <th>{% trans %}Email{% endtrans %}</th>
          <td itemprop="email">{{ g.user.email_address }}</td>
        </tr>
        {%- endif %}

        <tr>
          <th>{% trans %}Name{% endtrans %}</th>
          <td itemprop="name">{{ g.user.name }}</td>
        </tr>

        {% if g.user.club or g.user.is_writable(g.current_user) -%}
        <tr>
          <th>{% trans %}Club{% endtrans %}</th>

          {% if g.user.club -%}
          <td itemprop="memberof" itemscope="" itemtype="http://schema.org/SportsTeam">
            <meta itemprop="url" content="{{ url_for('club.index', club_id=g.user.club_id, _external=True) }}" />
            {{ club_link(g.user.club, ' itemprop="name"') }}
          {%- else %}
          <td>
            [{% trans %}Unspecified{% endtrans %}]
          {%- endif %}

            {% if g.user.is_writable(g.current_user) -%}
            <a href="{{ url_for('settings.club', user=(g.current_user != g.user and g.user_id or None)) }}" class="btn btn-default btn-sm">{% trans %}Change{% endtrans %}</a>
            {%- endif %}
          </td>
        </tr>
        {%- endif %}
      </table>

      <p style="margin-top: 10px">
        {% if g.user.is_writable(g.current_user) -%}
        <a href="{{ url_for('settings.profile', user=(g.current_user != g.user and g.user_id or None)) }}" class="btn btn-default"><i class="icon-cog"></i> {% trans %}Settings{% endtrans %}</a>
        {%- endif %}

        {% if g.current_user and g.current_user != g.user -%}
          {% if g.current_user.follows(g.user) -%}
            <a href="{{ url_for('.unfollow') }}" class="btn btn-default">{% trans %}Unfollow{% endtrans %}</a>
          {%- else %}
            <a href="{{ url_for('.follow') }}" class="btn btn-default">{% trans %}Follow{% endtrans %}</a>
          {%- endif %}
        {%- endif %}

        <a href="{{ url_for('flights.pilot', id=g.user.id) }}" class="btn btn-default"><i class="icon-plane"></i> {% trans %}Flights{% endtrans %}</a>
        <a href="{{ url_for('statistics.index', page='pilot', id=g.user.id) }}" class="btn btn-default"><i class="icon-bar-chart"></i> {% trans %}Statistics{% endtrans %}</a>
        <a href="{{ url_for('timeline.index', user=g.user.id) }}" class="btn btn-default"><i class="icon-time"></i> {{ _('Timeline') }}</a>
      </p>
    </div>
  </div>

  {% if g.user.following -%}
  <div class="row">
    <div class="col-md-12">
      <h2>{% trans %}Following{% endtrans %}</h2>
      <ul class="row list-with-dividers">
        {% for following in g.user.following|sort(attribute='destination.name') -%}
        <li class="col-md-3 col-sm-4 col-xs-6">
          <a href="{{ url_for('user.index', user_id=following.destination_id) }}">{{ following.destination }}</a>
        </li>
        {%- endfor %}
      </ul>
    </div>
  </div>
  {%- endif %}

  {% if g.user.followers -%}
  <div class="row">
    <div class="col-md-12">
      <h2>{% trans %}Followers{% endtrans %}</h2>
      <ul class="row list-with-dividers">
        {% for follower in g.user.followers|sort(attribute='source.name') -%}
        <li class="col-md-3 col-sm-4 col-xs-6">
          <a href="{{ url_for('user.index', user_id=follower.source_id) }}">{{ follower.source }}</a>
        </li>
        {%- endfor %}
      </ul>
    </div>
  </div>
  {%- endif %}

  <div class="row">
    {% if distance_flights -%}
    <div class="col-sm-6 col-md-4 col-md-offset-2">
      <h2>{% trans %}Distance Flights{% endtrans %}</h2>
      <table class="table">
        <thead>
          <tr>
            <th>{% trans %}Distance{% endtrans %}</th>
            <th>{% trans %}Date{% endtrans %}</th>
          </tr>
        </thead>
        <tbody>
          {% for distance_flight in distance_flights -%}
          <tr>
            <td>{{ h.format_distance(distance_flight[0]) }}</td>
            <td class="column-buttons">
              {% if distance_flight[1] -%}
              {{ insert_timeago_date(distance_flight[1].landing_time) }}
              <div class="pull-right">
                <a href="{{ url_for('flight.index', flight_id=distance_flight[1].id) }}" class="btn btn-default btn-sm">Show</a>
              </div>
              {%- endif %}
            </td>
          </tr>
          {%- endfor %}
        </tbody>
      </table>
    </div>
    {%- endif %}

    {% if last_year_statistics and last_year_statistics.flights > 0 -%}
    <div class="col-sm-6 col-md-4">
      <h2>{% trans %}Last 12 Months{% endtrans %}</h2>
      <table class="table">
        <thead>
          <tr>
            <th colspan="2">&nbsp;</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><strong>{% trans %}Flights{% endtrans %}</strong></td>
            <td>{{ h.format_number(last_year_statistics.flights) }}</td>
          </tr>
          <tr>
            <td><strong>{% trans %}Distance{% endtrans %}</strong></td>
            <td>
              <span rel="tooltip" title="{{ _('avg. %(distance)s per flight', distance=h.format_distance(last_year_statistics.average_distance)) }}">
                {{ h.format_distance(last_year_statistics.distance) }}
              </span>
            </td>
          </tr>
          <tr>
            <td><strong>{% trans %}Flight Time{% endtrans %}</strong></td>
            <td>
              <span rel="tooltip" title="{{ _('avg. %(hours)s hours per flight', hours=h.format_timedelta(last_year_statistics.average_duration)) }}">
                {{ _('%(hours)s Hours', hours=h.format_timedelta(last_year_statistics.duration)) }}
              </span>
            </td>
          </tr>
          <tr>
            <td><strong>{% trans %}Average Speed{% endtrans %}</strong></td>
            <td>{{ h.format_speed(last_year_statistics.speed) }}</td>
          </tr>
        </tbody>
      </table>
    </div>
    {%- endif %}
  </div>

  {% if takeoff_locations -%}
  <div class="row">
    <div class="col-md-12">
      <h2>{% trans %}Takeoff Locations{% endtrans %}</h2>
      <div id="map_canvas" style="width:100%; height:400pt;"></div>
    </div>
  </div>
  {%- endif %}
  </div>
</div>
{%- endblock %}
<commit_msg>templates/users: Replaced follower lists on profile with links to new pages<commit_after>{% from "macros/datetime.jinja" import insert_timeago_date, timeago_script with context %}
{% from "macros/links.jinja" import club_link %}

{% extends "base-page.jinja" %}
{% set active_page = "settings" %}

{% block title %}{{ g.user|e }}{% endblock %}


{% macro add_locations(locations) -%}
{% for location in locations -%}
[{{ location.longitude }}, {{ location.latitude }}]{% if not loop.last %},{% endif %}
{%- endfor %}
{%- endmacro %}


{% block styles -%}
{{ super() }}

{% if takeoff_locations -%}
{% assets 'openlayers_css' -%}
<link href="{{ ASSET_URL }}" rel="stylesheet" type="text/css" />
{%- endassets %}
{%- endif %}
{%- endblock %}


{% block scripts -%}
{{ super() }}

{% if takeoff_locations -%}
{% assets 'openlayers_js' -%}
<script type="text/javascript" src="{{ ASSET_URL }}"></script>
{%- endassets %}

<script type="text/javascript">
  $(function() {
    initOpenLayers("map_canvas",
                 "{{ config.get('SKYLINES_MAP_TILE_URL', '') }}");

    $.getScript("https://maps.google.com/maps/api/js?v=3.7&sensor=false&callback=addGoogleLayer");
    addBingLayers("{{ config.get('SKYLINES_BING_API_KEY', 'null') }}");
    addReliefLayer();

    var vectorLayer = new OpenLayers.Layer.Vector("Takeoff Locations", {
      displayInLayerSwitcher: false
    });
    map.addLayer(vectorLayer);

    var locations = [{{ add_locations(takeoff_locations) }}];
    for (var i = 0; i < locations.length; ++i) {
      point = new OpenLayers.Geometry.Point(locations[i][0], locations[i][1]);
      point = point.transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject());
      vectorLayer.addFeatures(new OpenLayers.Feature.Vector(point, {},
        {
          externalGraphic: "/vendor/openlayers/img/marker-gold.png",
          graphicHeight: 21,
          graphicWidth: 16,
          graphicXOffset: -16/2,
          graphicYOffset: -21
        }
      ));
    }
    map.zoomToExtent(vectorLayer.getDataExtent().scale(1.1));
    var zoom = map.getZoom();
    if (zoom > 10)
      map.zoomTo(10);

    initInfoBox({flight_info: false, location_info: true});
  });
</script>
{%- endif %}

{{ timeago_script() }}
{%- endblock %}


{%- block content %}
<div itemscope="" itemtype="http://schema.org/Person">
  <meta itemprop="url" content="{{ url_for('.index', _external=True) }}" />
  <div class="row">
    <div class="well col-md-8 col-md-offset-2">
      <table class="right">
        {% if g.user.is_readable(g.current_user) -%}
        <tr>
          <th>{% trans %}Email{% endtrans %}</th>
          <td itemprop="email">{{ g.user.email_address }}</td>
        </tr>
        {%- endif %}

        <tr>
          <th>{% trans %}Name{% endtrans %}</th>
          <td itemprop="name">{{ g.user.name }}</td>
        </tr>

        {% if g.user.club or g.user.is_writable(g.current_user) -%}
        <tr>
          <th>{% trans %}Club{% endtrans %}</th>

          {% if g.user.club -%}
          <td itemprop="memberof" itemscope="" itemtype="http://schema.org/SportsTeam">
            <meta itemprop="url" content="{{ url_for('club.index', club_id=g.user.club_id, _external=True) }}" />
            {{ club_link(g.user.club, ' itemprop="name"') }}
          {%- else %}
          <td>
            [{% trans %}Unspecified{% endtrans %}]
          {%- endif %}

            {% if g.user.is_writable(g.current_user) -%}
            <a href="{{ url_for('settings.club', user=(g.current_user != g.user and g.user_id or None)) }}" class="btn btn-default btn-sm">{% trans %}Change{% endtrans %}</a>
            {%- endif %}
          </td>
        </tr>
        {%- endif %}

        {% if g.user.followers -%}
        <tr>
          <th>{{ _('Followers') }}</th>
          <td>
            <a href="{{ url_for('user.followers') }}">{{ ngettext('%(num)d pilot', '%(num)d pilots', g.user.followers|count) }}</a>
          </td>
        </tr>
        {%- endif %}

        {% if g.user.following -%}
        <tr>
          <th>{{ _('Following') }}</th>
          <td>
            <a href="{{ url_for('user.following') }}">{{ ngettext('%(num)d pilot', '%(num)d pilots', g.user.following|count) }}</a>
          </td>
        </tr>
        {%- endif %}
      </table>

      <p style="margin-top: 10px">
        {% if g.user.is_writable(g.current_user) -%}
        <a href="{{ url_for('settings.profile', user=(g.current_user != g.user and g.user_id or None)) }}" class="btn btn-default"><i class="icon-cog"></i> {% trans %}Settings{% endtrans %}</a>
        {%- endif %}

        {% if g.current_user and g.current_user != g.user -%}
          {% if g.current_user.follows(g.user) -%}
            <a href="{{ url_for('.unfollow') }}" class="btn btn-default">{% trans %}Unfollow{% endtrans %}</a>
          {%- else %}
            <a href="{{ url_for('.follow') }}" class="btn btn-default">{% trans %}Follow{% endtrans %}</a>
          {%- endif %}
        {%- endif %}

        <a href="{{ url_for('flights.pilot', id=g.user.id) }}" class="btn btn-default"><i class="icon-plane"></i> {% trans %}Flights{% endtrans %}</a>
        <a href="{{ url_for('statistics.index', page='pilot', id=g.user.id) }}" class="btn btn-default"><i class="icon-bar-chart"></i> {% trans %}Statistics{% endtrans %}</a>
        <a href="{{ url_for('timeline.index', user=g.user.id) }}" class="btn btn-default"><i class="icon-time"></i> {{ _('Timeline') }}</a>
      </p>
    </div>
  </div>

  <div class="row">
    {% if distance_flights -%}
    <div class="col-sm-6 col-md-4 col-md-offset-2">
      <h2>{% trans %}Distance Flights{% endtrans %}</h2>
      <table class="table">
        <thead>
          <tr>
            <th>{% trans %}Distance{% endtrans %}</th>
            <th>{% trans %}Date{% endtrans %}</th>
          </tr>
        </thead>
        <tbody>
          {% for distance_flight in distance_flights -%}
          <tr>
            <td>{{ h.format_distance(distance_flight[0]) }}</td>
            <td class="column-buttons">
              {% if distance_flight[1] -%}
              {{ insert_timeago_date(distance_flight[1].landing_time) }}
              <div class="pull-right">
                <a href="{{ url_for('flight.index', flight_id=distance_flight[1].id) }}" class="btn btn-default btn-sm">Show</a>
              </div>
              {%- endif %}
            </td>
          </tr>
          {%- endfor %}
        </tbody>
      </table>
    </div>
    {%- endif %}

    {% if last_year_statistics and last_year_statistics.flights > 0 -%}
    <div class="col-sm-6 col-md-4">
      <h2>{% trans %}Last 12 Months{% endtrans %}</h2>
      <table class="table">
        <thead>
          <tr>
            <th colspan="2">&nbsp;</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td><strong>{% trans %}Flights{% endtrans %}</strong></td>
            <td>{{ h.format_number(last_year_statistics.flights) }}</td>
          </tr>
          <tr>
            <td><strong>{% trans %}Distance{% endtrans %}</strong></td>
            <td>
              <span rel="tooltip" title="{{ _('avg. %(distance)s per flight', distance=h.format_distance(last_year_statistics.average_distance)) }}">
                {{ h.format_distance(last_year_statistics.distance) }}
              </span>
            </td>
          </tr>
          <tr>
            <td><strong>{% trans %}Flight Time{% endtrans %}</strong></td>
            <td>
              <span rel="tooltip" title="{{ _('avg. %(hours)s hours per flight', hours=h.format_timedelta(last_year_statistics.average_duration)) }}">
                {{ _('%(hours)s Hours', hours=h.format_timedelta(last_year_statistics.duration)) }}
              </span>
            </td>
          </tr>
          <tr>
            <td><strong>{% trans %}Average Speed{% endtrans %}</strong></td>
            <td>{{ h.format_speed(last_year_statistics.speed) }}</td>
          </tr>
        </tbody>
      </table>
    </div>
    {%- endif %}
  </div>

  {% if takeoff_locations -%}
  <div class="row">
    <div class="col-md-12">
      <h2>{% trans %}Takeoff Locations{% endtrans %}</h2>
      <div id="map_canvas" style="width:100%; height:400pt;"></div>
    </div>
  </div>
  {%- endif %}
  </div>
</div>
{%- endblock %}

{'fraction_non_alphanumeric': 0.20810683053651619, 'fraction_numerical': 0.007326873079650201, 'mean_word_length': 2.3594680428741563, 'pattern_counts': {'":': 0, '<': 335, '<?xml version=': 0, '>': 337, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2869882', 'n_tokens_mistral': 6117, 'n_tokens_neox': 5630, 'n_words': 1084}