Changeset 2d91474 in OpenWorkouts-current for ow/templates


Ignore:
Timestamp:
Jan 15, 2019, 10:13:57 PM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
0c18869
Parents:
9bee49d
Message:

(#23) - Show workouts in the dashboard with date filtering

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/templates/dashboard.pt

    r9bee49d r2d91474  
    2727        <h2 tal:content="context.fullname"></h2>
    2828
    29         <tal:r tal:repeat="workout context.workouts()">
     29        <h3>
     30            (<tal:n tal:content="len(workouts)"></tal:n>/<tal:n tal:content="context.num_workouts"></tal:n>) <tal:t i18n:translate="">workouts</tal:t>
     31        </h3>
     32
     33        <tal:no-workouts tal:condition="context.num_workouts == 0">
     34            <div class="warning">
     35                <p i18n:translate="">You haven't added any workouts yet</p>
     36                <p>
     37                    <a href="" i18n:translate=""
     38                       tal:attributes="href request.resource_url(context, 'add-workout')">
     39                        Upload one</a> |
     40                    <a href="" i18n:translate=""
     41                       tal:attributes="href request.resource_url(context, 'add-workout-manually')">
     42                        Add one manually</a>
     43                </p>
     44            </div>
     45        </tal:no-workouts>
     46
     47        <tal:r tal:repeat="workout workouts">
    3048
    3149          <article class="workout-resume">
     
    85103
    86104      <aside class="workout-aside">
    87         <h2>...</h2>
     105          <tal:activity_tree tal:condition="context.num_workouts > 0">
     106              <ul class="workout-activity-tree" tal:define="tree context.activity_dates_tree">
     107                  <tal:years tal:repeat="year sorted(tree.keys(), reverse=True )">
     108                      <li tal:define="is_viewing_year year == viewing_year">
     109                          <a href="" tal:content="year"
     110                             tal:attributes="href request.resource_url(context, query={'year': year});
     111                                             class 'js-year viewing-year' if is_viewing_year  else 'js-year'">
     112                          </a>
     113                          <ul class="workout-activity-tree-year"
     114                              tal:attributes="class 'workout-activity-tree-year' if is_viewing_year  else 'workout-activity-tree-year hidden'">
     115                              <tal:months tal:repeat="month sorted(tree[year].keys())">
     116                                  <li tal:define="is_viewing_month is_viewing_year and month == viewing_month">
     117                                      <a href="" tal:content="month_name[month]"
     118                                         tal:attributes="href request.resource_url(context, query={'year': year, 'month': month});
     119                                                         class 'viewing-month' if is_viewing_month else ''">
     120                                      </a>
     121                                      <ul class="workout-activity-tree-month">
     122                                          <tal:sports tal:repeat="sport sorted(tree[year][month].keys())">
     123                                              <li>
     124                                                  <a href="#">
     125                                                      <tal:sport tal:content="sport"></tal:sport> (<tal:workouts tal:content="tree[year][month][sport]"></tal:workouts>)
     126                                                  </a>
     127                                              </li>
     128                                          </tal:sports>
     129                                      </ul>
     130                                  </li>
     131                              </tal:months>
     132                          </ul>
     133                      </li>
     134                  </tal:years>
     135              </ul>
     136          </tal:activity_tree>
    88137      </aside>
    89138
Note: See TracChangeset for help on using the changeset viewer.