Index: ow/templates/profile.pt
===================================================================
--- ow/templates/profile.pt	(revision 8c2b0949ae91540ee5c8101b9d5ff39003773da3)
+++ ow/templates/profile.pt	(revision 5ec3a0b5cf5640304a0953320daef2a28bbca9a5)
@@ -12,533 +12,74 @@
   </metal:head-title>
 
-  <metal:css metal:fill-slot="css">
-    <link rel="stylesheet" href="${request.static_url('ow:static/components/jquery-dropdown/jquery.dropdown.css')}" />
-  </metal:css>
-
   <metal:content metal:fill-slot="content">
 
     <div class="user-profile">
-      <div class="user-profile-account">
-        <div>
-          <tal:c tal:condition="getattr(user, 'picture', None)">
-            <img tal:attributes="src request.resource_path(user, 'picture', query={'size': 200})"
-                 width="450" />
-          </tal:c>
-          <div>
-            <h2>
-              <tal:fullname tal:content="user.fullname"></tal:fullname>
-            </h2>
-            <p>
-              <tal:has-nickname tal:condition="user.nickname">
-                <a href=""
-                   tal:attributes="href request.resource_url(request.root, 'profile', user.nickname)"
-                   tal:content="request.resource_url(request.root, 'profile', user.nickname)">
-                </a> |
-              </tal:has-nickname>
-              <span><tal:email tal:content="user.email"></tal:email></span>
-            </p>
-            <div class="profile-bio">
-              <p tal:repeat="paragraph getattr(user, 'bio', '').split('\n')"
-                 tal:content="paragraph"></p>
-            </div>
-            <ul class="workout-options">
-              <li><a href=""
-                     tal:attributes="href request.resource_url(user, 'edit')"
-                     i18n:translate="">edit profile</a></li>
-              <li><a href=""
-                     tal:attributes="href request.resource_url(user, 'passwd')"
-                     i18n:translate="">change password</a></li>
-            </ul>
-          </div>
-          <div class="calendar-heatmap js-calendar-heatmap">
-          </div>
-          <div class="calendar-heatmap-tooltip js-ch-tooltip">
-            <ul class="profile-data">
-              <li>
-                <span class="js-ch-tooltip-date"></span>
-              </li>
-              <li>
-                <span><tal:t i18n:translate="">Workouts:</tal:t></span>
-                <span class="js-ch-tooltip-workouts"></span>
-              </li>
-              <li>
-                <span><tal:t i18n:translate="">Time:</tal:t></span>
-                <span class="js-ch-tooltip-time"></span>
-              </li>
-              <li>
-                <span><tal:t i18n:translate="">Distance:</tal:t></span>
-                <span class="js-ch-tooltip-distance"></span>
-              </li>
-              <li>
-                <span><tal:t i18n:translate="">Elevation:</tal:t></span>
-                <span class="js-ch-tooltip-elevation"></span>
-              </li>
-            </ul>
-          </div>
-        </div>
-
-      </div>
-
-      <div class="workout-content">
-        <div class="workout-list">
-          <div class="total-workouts">
-            <span>
-              <tal:w tal:replace="len(workouts)"></tal:w>
-              <tal:t i18n:translate="">workouts</tal:t>
-            </span>
-            <span>
-              <tal:hms tal:define="hms timedelta_to_hms(totals['time'])">
-                <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                <tal:t i18n:translate="">hours</tal:t>,
-                <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                <tal:t i18n:translate="">min.</tal:t>
-              </tal:hms>
-            </span>
-            <span>
-              <tal:w tal:replace="round(totals['distance'])"></tal:w>
-              <tal:t i18n:translate="">km</tal:t>
-            </span>
-            <span>
-              <tal:w tal:replace="round(totals['elevation'])"></tal:w>
-              <tal:t i18n:translate="">m</tal:t>
-            </span>
-          </div>
-
-          <div class="month-stats js-month-stats">
-            <div class="svg-content">
-              <svg width="900" height="180" viewBox="0 0 900 180"></svg>
-            </div>
-            <div class="center">
-              <ul class="workout-options filters js-filters">
-                <li>
-                  <a href="#" class="js-distance is-active"
-                     tal:attributes="class 'js-distance is-active' if filter_by == 'distance' else 'js-distance'"
-                     i18n:translate="">distance</a>
-                </li>
-                <li>
-                  <a href="#" class="js-time"
-                     tal:attributes="class 'js-time is-active' if filter_by == 'time' else 'js-time'"
-                     i18n:translate="">time</a>
-                </li>
-                <li>
-                  <a href="#" class="js-elevation"
-                     tal:attributes="class 'js-elevation is-active' if filter_by == 'elevation' else 'js-elevation'"
-                     i18n:translate="">elevation</a>
-                </li>
-              </ul>
-
-              <ul class="workout-options switcher js-switcher"
-                  tal:define="weekly 'week' in request.GET">
-                <li>
-                  <a href="#" class="" i18n:translate=""
-                     tal:attributes="class 'js-weekly is-active' if weekly else 'js-weekly'">
-                    weekly</a></li>
-                <li>
-                  <a href="#" class="" i18n:translate=""
-                     tal:attributes="class 'js-monthly is-active' if not weekly else 'js-monthly'">
-                    monthly</a></li>
-              </ul>
-            </div>
-          </div>
-
-
-          <tal:r tal:repeat="workout workouts">
-
-            <article class="workout-resume">
-
-              <h2 class="workout-title">
-                <a href="" tal:content="workout.title"
-                   tal:attributes="href request.resource_url(workout)"></a>
-              </h2>
-
-              <ul class="workout-info">
-                <li>
-                  <tal:c tal:content="workout.start_in_timezone(user.timezone)"></tal:c>
-                </li>
-                <li>
-                  <!--! use the properly formatted duration instead of the timedelta object -->
-                  <tal:c tal:content="workout._duration"></tal:c>
-                </li>
-                <li tal:condition="workout.distance">
-                  <tal:c tal:content="workout.rounded_distance"></tal:c> km
-                </li>
-                <li tal:condition="workout.uphill">
-                  +<tal:c tal:content="workout.uphill"></tal:c> m
-                </li>
-              </ul>
-
-              <ul class="workout-info" tal:define="hr workout.hr; cad workout.cad">
-                <li tal:condition="hr">
-                  <span i18n:translate="">HR (bpm)</span>:
-                  <tal:c tal:content="hr['avg']"></tal:c>
-                  <tal:t i18n:translate="">Avg.</tal:t>,
-                  <tal:c tal:content="hr['max']"></tal:c>
-                  <tal:t i18n:translate="">Max.</tal:t>
-                </li>
-                <li tal:condition="cad">
-                  <span i18n:translate="">Cad</span>:
-                  <tal:c tal:content="cad['avg']"></tal:c>
-                  <tal:t i18n:translate="">Avg.</tal:t>,
-                  <tal:c tal:content="cad['max']"></tal:c>
-                  <tal:t i18n:translate="">Max.</tal:t>
-                </li>
-              </ul>
-
-              <div class="workout-intro">
-                <p tal:repeat="paragraph workout.trimmed_notes.split('\n')"
-                   tal:content="paragraph"></p>
-              </div>
-
-              <div class="workout-map" tal:condition="workout.has_gpx">
-                <a href="" tal:attributes="href request.resource_url(workout)">
-                  <tal:has-screenshot tal:condition="workout.map_screenshot is not None">
-                    <img src="" tal:attributes="src request.static_url(workout.map_screenshot);
-                              alt workout.title; title workout.title">
-                  </tal:has-screenshot>
-                  <tal:has-not-screenshot tal:condition="workout.map_screenshot is None">
-                    <img src="" tal:attributes="src request.static_url('ow:static/media/img/no_map.gif');
-                              alt workout.title; title workout.title; class 'js-needs-map'">
-                  </tal:has-not-screenshot>
-                </a>
-              </div>
-
-            </article>
-
-          </tal:r>
-        </div>
-
-        <div class="workout-aside">
-
-          <h3 i18n:translate="">Profile info</h3>
-
-          <ul class="profile-data">
-            <li>
-              <span><tal:t i18n:translate="">Gender:</tal:t></span>
-              <tal:c tal:content="user_gender"></tal:c>
-            </li>
-            <li tal:define="birth_date getattr(user, 'birth_date', None)">
-              <span><tal:t i18n:translate="">Birth date:</tal:t></span>
-              <tal:c tal:condition="birth_date"
-                     tal:content="birth_date.strftime('%d/%m/%Y')"></tal:c>
-              <tal:c tal:condition="birth_date is None">-</tal:c>
-            </li>
-            <li>
-              <span><tal:t i18n:translate="">Height:</tal:t></span>
-              <tal:c tal:content="getattr(user, 'height', '-')"></tal:c> meters
-            </li>
-            <li>
-              <span><tal:t i18n:translate="">Weight:</tal:t></span>
-              <tal:c tal:content="getattr(user, 'weight', '-')"></tal:c> kg
-            </li>
-          </ul>
-
-          <tal:has-workouts tal:condition="profile_stats['sports']">
-
-            <h3 i18n:translate="">Workout stats</h3>
-
-            <p>
-              <a href="" data-jq-dropdown="#jq-dropdown-sports"
-                 class="profile-dropdown-sports js-jq-dropdown-sel-sports">
-                <strong tal:content="profile_stats['current_sport']"></strong>
-                <i class="arrow down"></i>
-              </a>
-            </p>
-
-            <tal:sports tal:repeat="sport profile_stats['sports']">
-              <div class="" tal:attributes="class 'js-sport-stats js-' + sport">
-
-                <a href="" data-jq-dropdown=""
-                   tal:attributes="data-jq-dropdown '#jq-dropdown-' + sport;
-                         class 'profile-dropdown-years js-jq-dropdown-sel-' + sport">
-                  <strong tal:content="profile_stats['current_year']"></strong>
-                  <i class="arrow down"></i>
-                </a>
-
-                <tal:years tal:repeat="year profile_stats['years']">
-                  <div class="" tal:attributes="class 'js-year-stats js-' + sport + '-' + str(year)">
-                    <ul class="profile-data"
-                        tal:define="sport_totals user.sport_totals(sport, year)">
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Workouts</tal:t>
-                        </span>
-                        <tal:w tal:replace="sport_totals['workouts']"></tal:w>
-                      </li>
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Time</tal:t>
-                        </span>
-                        <tal:hms tal:define="hms timedelta_to_hms(sport_totals['time'])">
-                          <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                          <tal:t i18n:translate="">hours</tal:t>,
-                          <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                          <tal:t i18n:translate="">min.</tal:t>
-                        </tal:hms>
-                      </li>
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Distance</tal:t>
-                        </span>
-                        <tal:w tal:replace="round(sport_totals['distance'])"></tal:w>
-                        <tal:t i18n:translate="">km</tal:t>
-                      </li>
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Elevation</tal:t>
-                        </span>
-                        <tal:w tal:replace="round(sport_totals['elevation'])"></tal:w>
-                        <tal:t i18n:translate="">m</tal:t>
-                      </li>
-                      <li><span i18n:translate="">Single workout records:</span></li>
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Farthest distance</tal:t>
-                        </span>
-                        <tal:has-wid tal:condition="sport_totals['max_distance_wid'] is not None">
-                          <a href="" tal:attributes="href request.resource_url(user[sport_totals['max_distance_wid']])">
-                            <tal:w tal:replace="round(sport_totals['max_distance'])"></tal:w>
-                            <tal:t i18n:translate="">km</tal:t>
-                          </a>
-                        </tal:has-wid>
-                        <tal:has-not-wid tal:condition="sport_totals['max_distance_wid'] is None">
-                          <tal:w tal:replace="round(sport_totals['max_distance'])"></tal:w>
-                          <tal:t i18n:translate="">km</tal:t>
-                        </tal:has-not-wid>
-                      </li>
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Longer workout</tal:t>
-                        </span>
-                        <tal:has-wid tal:condition="sport_totals['max_time_wid'] is not None">
-                          <a href="" tal:attributes="href request.resource_url(user[sport_totals['max_time_wid']])">
-                            <tal:hms tal:define="hms timedelta_to_hms(sport_totals['max_time'])">
-                              <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                              <tal:t i18n:translate="">hours</tal:t>,
-                              <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                              <tal:t i18n:translate="">min.</tal:t>
-                            </tal:hms>
-                          </a>
-                        </tal:has-wid>
-                        <tal:has-not-wid tal:condition="sport_totals['max_time_wid'] is None">
-                          <tal:hms tal:define="hms timedelta_to_hms(sport_totals['max_time'])">
-                            <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                            <tal:t i18n:translate="">hours</tal:t>,
-                            <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                            <tal:t i18n:translate="">min.</tal:t>
-                          </tal:hms>
-                        </tal:has-not-wid>
-                      </li>
-                      <li>
-                        <span>
-                          <tal:t i18n:translate="">Higher elevation gain</tal:t>
-                        </span>
-                        <tal:has-wid tal:condition="sport_totals['max_elevation_wid'] is not None">
-                          <a href="" tal:attributes="href request.resource_url(user[sport_totals['max_elevation_wid']])">
-                            <tal:w tal:replace="round(sport_totals['max_elevation'])"></tal:w>
-                            <tal:t i18n:translate="">m</tal:t>
-                          </a>
-                        </tal:has-wid>
-                        <tal:has-not-wid tal:condition="sport_totals['max_elevation_wid'] is None">
-                          <tal:w tal:replace="round(sport_totals['max_elevation'])"></tal:w>
-                          <tal:t i18n:translate="">m</tal:t>
-                        </tal:has-not-wid>
-                      </li>
-                    </ul>
-                  </div>
-                </tal:years>
-
-                <strong i18n:translate="">All time</strong>
-                <ul class="profile-data"
-                    tal:define="sport_totals user.sport_totals(sport)">
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Workouts</tal:t>
-                    </span>
-                    <tal:w tal:replace="sport_totals['workouts']"></tal:w>
-                  </li>
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Time</tal:t>
-                    </span>
-                    <tal:hms tal:define="hms timedelta_to_hms(sport_totals['time'])">
-                      <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                      <tal:t i18n:translate="">hours</tal:t>,
-                      <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                      <tal:t i18n:translate="">min.</tal:t>
-                    </tal:hms>
-                  </li>
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Distance</tal:t>
-                    </span>
-                    <tal:w tal:replace="round(sport_totals['distance'])"></tal:w>
-                    <tal:t i18n:translate="">km</tal:t>
-                  </li>
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Elevation</tal:t>
-                    </span>
-                    <tal:w tal:replace="round(sport_totals['elevation'])"></tal:w>
-                    <tal:t i18n:translate="">m</tal:t>
-                  </li>
-                  <li><span i18n:translate="">Single workout records:</span></li>
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Farthest distance</tal:t>
-                    </span>
-                    <tal:has-wid tal:condition="sport_totals['max_distance_wid'] is not None">
-                      <a href="" tal:attributes="href request.resource_url(user[sport_totals['max_distance_wid']])">
-                        <tal:w tal:replace="round(sport_totals['max_distance'])"></tal:w>
-                        <tal:t i18n:translate="">km</tal:t>
-                      </a>
-                    </tal:has-wid>
-                    <tal:has-not-wid tal:condition="sport_totals['max_distance_wid'] is None">
-                      <tal:w tal:replace="round(sport_totals['max_distance'])"></tal:w>
-                      <tal:t i18n:translate="">km</tal:t>
-                    </tal:has-not-wid>
-                  </li>
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Longer workout</tal:t>
-                    </span>
-                    <tal:has-wid tal:condition="sport_totals['max_time_wid'] is not None">
-                      <a href="" tal:attributes="href request.resource_url(user[sport_totals['max_time_wid']])">
-                        <tal:hms tal:define="hms timedelta_to_hms(sport_totals['max_time'])">
-                          <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                          <tal:t i18n:translate="">hours</tal:t>,
-                          <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                          <tal:t i18n:translate="">min.</tal:t>
-                        </tal:hms>
-                      </a>
-                    </tal:has-wid>
-                    <tal:has-not-wid tal:condition="sport_totals['max_time_wid'] is None">
-                      <tal:hms tal:define="hms timedelta_to_hms(sport_totals['max_time'])">
-                        <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
-                        <tal:t i18n:translate="">hours</tal:t>,
-                        <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
-                        <tal:t i18n:translate="">min.</tal:t>
-                      </tal:hms>
-                    </tal:has-not-wid>
-                  </li>
-                  <li>
-                    <span>
-                      <tal:t i18n:translate="">Higher elevation gain</tal:t>
-                    </span>
-                    <tal:has-wid tal:condition="sport_totals['max_elevation_wid'] is not None">
-                      <a href="" tal:attributes="href request.resource_url(user[sport_totals['max_elevation_wid']])">
-                        <tal:w tal:replace="round(sport_totals['max_elevation'])"></tal:w>
-                        <tal:t i18n:translate="">m</tal:t>
-                      </a>
-                    </tal:has-wid>
-                    <tal:has-not-wid tal:condition="sport_totals['max_elevation_wid'] is None">
-                      <tal:w tal:replace="round(sport_totals['max_elevation'])"></tal:w>
-                      <tal:t i18n:translate="">m</tal:t>
-                    </tal:has-not-wid>
-                  </li>
-                </ul>
-              </div>
-            </tal:sports>
-
-          </tal:has-workouts>
-
-        </div>
-      </div>
-    </div>
-
-      <div id="jq-dropdown-sports" class="jq-dropdown jq-dropdown-tip">
-        <ul class="jq-dropdown-menu">
-          <tal:sports tal:repeat="sport profile_stats['sports']">
-            <li>
-              <a href="#" class="" tal:content="sport"
-                 tal:attributes="class 'js-choose-sport-stats js-' + sport">
-              </a>
-            </li>
-          </tal:sports>
+      <tal:c tal:condition="getattr(context, 'picture', None)">
+        <img tal:attributes="src request.resource_path(context, 'picture')"
+             width="450" />
+      </tal:c>
+      <h2>
+        <tal:fullname tal:content="context.fullname"></tal:fullname>
+        (<tal:user_id tal:content="context.user_id"></tal:user_id>)
+      </h2>
+      <h3>
+        <tal:email tal:content="context.email"></tal:email>
+      </h3>
+      <h4>
+        <a href=""
+           tal:attributes="href request.resource_url(context, 'edit')"
+           i18n:translate="">edit profile</a> |
+        <a href=""
+           tal:attributes="href request.resource_url(context, 'passwd')"
+           i18n:translate="">change password</a>
+      </h4>
+      <div class="profile-info">
+        <ul>
+          <li>
+            <tal:t i18n:translate="">Gender:</tal:t>
+            <tal:c tal:content="getattr(context, 'gender', '-')"></tal:c>
+          </li>
+          <li tal:define="birth_date getattr(context, 'birth_date', None)">
+            <tal:t i18n:translate="">Birth date:</tal:t>
+            <tal:c tal:condition="birth_date"
+                   tal:content="birth_date.strftime('%d/%m/%Y')"></tal:c>
+            <tal:c tal:condition="birth_date is None">-</tal:c>
+          </li>
+          <li>
+            <tal:t i18n:translate="">Height:</tal:t>
+            <tal:c tal:content="getattr(context, 'height', '-')"></tal:c> meters
+          </li>
+          <li>
+            <tal:t i18n:translate="">Weight:</tal:t>
+            <tal:c tal:content="getattr(context, 'weight', '-')"></tal:c> kg
+          </li>
         </ul>
       </div>
 
+      <div class="profile-bio" tal:content="getattr(context, 'bio', '')">
+      </div>
 
-    <tal:sports tal:repeat="sport profile_stats['sports']">
-      <div id="" class="jq-dropdown jq-dropdown-tip"
-           tal:attributes="id 'jq-dropdown-' + sport">
-        <ul class="jq-dropdown-menu">
-          <tal:years tal:repeat="year profile_stats['years']">
-            <li>
-              <a href="#" class="" tal:content="year"
-                 tal:attributes="class 'js-choose-year-stats js-' + sport + '-' + str(year)">
-              </a>
-            </li>
-          </tal:years>
-        </ul>
+      <div class="workouts">
+        <tal:t i18n:translate="">Total number of workouts</tal:t>:
+        <tal:w tal:replace="context.num_workouts"></tal:w>
       </div>
-    </tal:sports>
 
+      <div class="latest-workouts">
+        <p i18n:translate="">Latest workouts</p>
+        <tal:r tal:repeat="workout context.workouts()[:5]">
+          <div class="workout">
+            <tal:c tal:content="workout.sport"></tal:c> -
+            <a href="" tal:content="workout.title"
+               tal:attributes="href request.resource_url(workout)"></a>
+            (<tal:c tal:content="workout.start"></tal:c>,
+            <tal:c tal:content="workout.duration"></tal:c>,
+            <tal:c tal:content="workout.rounded_distance"></tal:c> km)
+          </div>
+        </tal:r>
+      </div>
+
+    </div>
 
   </metal:content>
 
-  <metal:body-js metal:fill-slot="body-js">
-
-    <script src="${request.static_url('ow:static/components/jquery-dropdown/jquery.dropdown.js')}"></script>
-    <script src="${request.static_url('ow:static/components/d3/d3.min.js')}"></script>
-    <script src="${request.static_url('ow:static/js/ow.js')}"></script>
-
-    <script type="text/javascript">
-     var map_shots = owjs.map_shots({
-         img_selector: 'img.js-needs-map',
-     })
-     map_shots.run();
-
-     var sport_stats = owjs.sport_stats({
-         link_selector: 'a.js-choose-sport-stats',
-         stats_selector: 'div.js-sport-stats',
-         selected: 'div.js-sport-stats.js-${profile_stats['current_sport']}',
-         dropdown_selector: 'a.js-jq-dropdown-sel-sports',
-         current_year: '${profile_stats['current_year']}',
-         year_link_selector: 'a.js-choose-year-stats.js-'
-     })
-     sport_stats.setup();
-
-     var heatmap_chart = owjs.calendar_heatmap_chart({
-         chart_selector: 'div.js-calendar-heatmap',
-         tooltip_selector: '.js-ch-tooltip',
-         url: "${request.resource_url(user, 'month')}",
-         // Trick to have all those shortened day names translated
-         day_names_list: "${_('Mo Tu We Th Fr Sa Su')}".split(' ')
-     });
-     heatmap_chart.render();
-
-     var year_stats = owjs.year_stats({
-         link_selector: 'a.js-choose-year-stats',
-         stats_selector: 'div.js-year-stats',
-         selected: 'div.js-year-stats.js-${profile_stats['current_sport']}-${profile_stats['current_year']}',
-         dropdown_selector: 'a.js-jq-dropdown-sel-'
-     })
-     year_stats.setup();
-
-     var y_axis_labels = {
-         "distance": "Kilometers",
-         "time": "Hours",
-         "elevation": "Meters"
-     };
-
-     var year_chart = owjs.year_chart({
-         chart_selector: '.js-month-stats svg',
-         filters_selector: '.js-month-stats .js-filters a',
-         switcher_selector: '.js-month-stats .js-switcher a',
-         is_active_class: 'is-active',
-         urls: {"monthly": "${request.resource_url(user, 'monthly')}",
-                "weekly": "${request.resource_url(user, 'weekly')}"},
-         current_month: "${current_month}",
-         current_week: "${current_week}",
-         y_axis_labels: y_axis_labels,
-         filter_by: "${filter_by}",
-         url: "${'monthly' if current_week is None else 'weekly'}",
-     });
-     year_chart.render("${filter_by}", "${'monthly' if current_week is None else 'weekly'}");
-     year_chart.filters_setup();
-     year_chart.switcher_setup();
-    </script>
-
-  </metal:body-js>
-
 </html>
