<commit_before>{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% load staticfiles %}
{% load wger_extras %}

{% block title %}{% trans "Workout log calendar" %}{% endblock %}

{% block header %}
<script>
$(document).ready(function() {
    $('table.month td.filled a').click(function(e){
        e.preventDefault();
        $('.calendar-log-data').hide();
        $('#' + $(this).data('log')).toggle();
        $('html, body').animate({
            scrollTop: $('#' + $(this).data('log')).offset().top
        }, 500);
    });
 });
</script>
{% endblock %}

{% block content %}
{{calendar|safe}}

{% for date in logs %}
<div id="log-{{date|date:'Y-m-d'}}" class="calendar-log-data">
    <h3>{{date}}</h3>

    {% regroup logs|get_item:date by exercise as grouped_logs %}

    {# TODO: what if some of the entries don't belong to a workout? #}
    {% with tmp=grouped_logs|first %}
    {% with first_log=tmp.list|first %}
    <div class="ui-grid-a">
        <div class="ui-block-a">
            <a href="{{first_log.workout.get_absolute_url}}" data-role="button">{% trans "Workout" %}</a>
        </div>
        <div class="ui-block-b">
            <a href="{% url 'workout-log' first_log.workout.id %}" data-role="button">{% trans "Log overview" %}</a>
        </div>
    </div>
    {% endwith %}
    {% endwith %}
    <ul class="grouper-list">
    {% for i in grouped_logs %}
        <li>{{i.grouper}}
        <ul>
        {% for log in i.list %}
            <li>{{log.reps}} × {{log.weight}}</li>
        {% endfor %}
        </ul>
        </li>
    {% endfor %}
    </ul>
</div>
{% endfor %}
{% endblock %}



{% block sidebar %}
<div data-role="popup"
     id="calendar-day-select-popup"
     data-overlay-theme="a"
     class="ui-content">
     <div>
     <h3>{% trans "Add log to day" %}</h3>
         {% if current_workout %}
         <p>{% blocktrans %}Click to add weight logs to a training
day in your current workout:{% endblocktrans %} {{current_workout}}</p>

         <ul data-role="listview" data-inset="true">
            {% for day in current_workout.day_set.all %}
                <li><a href="{% url 'day-log' day.pk %}">{{day.description}}</a></li>
            {% endfor %}
         </ul>
         {% else %}
         <p><em>{% trans "No workouts found." %}</em></p>
         <a href="{% url 'wger.manager.views.workout.add' %}" data-role="button">
            <img src="{% static 'images/icons/add.svg' %}"
                 width="22"
                height="22"
                alt="">
             {% trans "Add one now." %}
         </a>
         {% endif %}
    </div>
</div>
<commit_msg>Update the calendar workout log popup style<commit_after>{% extends "base.html" %}
{% load url from future %}
{% load i18n %}
{% load staticfiles %}
{% load wger_extras %}

{% block title %}{% trans "Workout log calendar" %}{% endblock %}

{% block header %}
<script>
$(document).ready(function() {
    $('table.month td.filled a').click(function(e){
        e.preventDefault();
        $('.calendar-log-data').hide();
        $('#' + $(this).data('log')).toggle();
        $('html, body').animate({
            scrollTop: $('#' + $(this).data('log')).offset().top
        }, 500);
    });
 });
</script>
{% endblock %}

{% block content %}
{{calendar|safe}}

{% for date in logs %}
<div id="log-{{date|date:'Y-m-d'}}" class="calendar-log-data">
    <h3>{{date}}</h3>

    {% regroup logs|get_item:date by exercise as grouped_logs %}

    {# TODO: what if some of the entries don't belong to a workout? #}
    {% with tmp=grouped_logs|first %}
    {% with first_log=tmp.list|first %}
    <div class="ui-grid-a">
        <div class="ui-block-a">
            <a href="{{first_log.workout.get_absolute_url}}" data-role="button">{% trans "Workout" %}</a>
        </div>
        <div class="ui-block-b">
            <a href="{% url 'workout-log' first_log.workout.id %}" data-role="button">{% trans "Log overview" %}</a>
        </div>
    </div>
    {% endwith %}
    {% endwith %}
    <ul class="grouper-list">
    {% for i in grouped_logs %}
        <li>{{i.grouper}}
        <ul>
        {% for log in i.list %}
            <li>{{log.reps}} × {{log.weight}}</li>
        {% endfor %}
        </ul>
        </li>
    {% endfor %}
    </ul>
</div>
{% endfor %}
{% endblock %}



{% block sidebar %}
<div data-role="popup"
     id="calendar-day-select-popup"
     data-overlay-theme="a">
    <div data-role="header" data-theme="b">
    <h3>{% trans "Add log to day" %}</h3>
    </div>
    <div role="main" class="ui-content">
         {% if current_workout %}
         <p>{% blocktrans %}Click to add weight logs to a training
day in your current workout:{% endblocktrans %} {{current_workout}}</p>

         <ul data-role="listview" data-inset="true">
            {% for day in current_workout.day_set.all %}
                <li><a href="{% url 'day-log' day.pk %}">{{day.description}}</a></li>
            {% endfor %}
         </ul>
         {% else %}
         <p><em>{% trans "No workouts found." %}</em></p>
         <a href="{% url 'wger.manager.views.workout.add' %}" data-role="button">
            <img src="{% static 'images/icons/add.svg' %}"
                 width="22"
                height="22"
                alt="">
             {% trans "Add one now." %}
         </a>
         {% endif %}
    </div>
</div>

{'fraction_non_alphanumeric': 0.21388577827547592, 'fraction_numerical': 0.0048525569242254575, 'mean_word_length': 2.2518203883495147, 'pattern_counts': {'":': 0, '<': 95, '<?xml version=': 0, '>': 95, 'https://': 0, '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': '3013378', 'n_tokens_mistral': 1942, 'n_tokens_neox': 1762, 'n_words': 403}