Ignore:
Timestamp:
Apr 7, 2011, 8:56:04 PM (14 years ago)
Author:
Rick van der Zwet
Message:
  • Login/logout
  • Revised admin form admin form
Location:
django_apps/running/templates
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • django_apps/running/templates/index.html

    r291 r301  
    11<ul>
    22{% for user in user_list %}
    3 <li><a href="{% url running.views.user_index user.name %}">{{ user }}</li>
     3<li><a href="{% url running.views.user_index user.username %}">{{ user }}</li>
    44{%endfor %}
    55</ul>
  • django_apps/running/templates/user_index.html

    r298 r301  
    2020  </head>
    2121  <body>
    22     <a href="{% url running.views.index %}">User Overview</a><p />
    23     <h1>Welcome {{ user }}</h1>
     22  <table>
     23  <tr>
     24  <td>
     25    <a href="{% url running.views.index %}">User Overview</a>
     26  </td>
     27  <td>-</td>
     28  <td>
     29    {% if user.is_authenticated %}
     30<form method="post" action="{% url logout %}">
     31      <input type="submit" value="logout" />
     32  {% csrf_token %}
     33  <input type="hidden" name="next" value="{{ request.path }}" />
     34</form>
     35    {% else %}
     36<form method="post" action="{% url login %}">
     37  {% csrf_token %}
     38  <table>
     39  <tr>
     40      <td><input type="text" name="username" /></td>
     41      <td><input type="password" name="password" /></td>
     42      <td><input type="submit" value="login" /></td>
     43  </tr>
     44  </table>
     45  <input type="hidden" name="next" value="{{ request.path }}" />
     46</form>
     47{% endif %}
     48</td>
     49</tr>
     50</table>
     51   <h1>Welcome {{ user.username|default:"New User" }}</h1>
     52   <a href="#results">Add new results</a>
     53
    2454    <div id="center">
    25       <h3>Week totals</h3>
     55      <h3>Week totals in KM</h3>
    2656      <div id="fig2">
    2757        <div id="week-statistics"> </div>
    2858      </div>
    29       <h3>Accumulated Totals</h3>
     59      <h3>Accumulated Totals in KM</h3>
    3060      <div id="fig">
    3161        <div style="text-align:right;padding-right:20;">
     
    3565        <div id="total-statistics"> </div>
    3666      </div>
     67      <h3>Avergage Speed in KM</h3>
     68      <div id="fig">
     69        <div style="text-align:right;padding-right:20;">
     70          <input checked id="scale" type="checkbox" onchange="vis.render()"
     71          ><label for="scale">Scale to fit</label>
     72        </div>
     73        <div id="speed-statistics"> </div>
     74      </div>
    3775    </div>
     76    {% if user.is_authenticated %}
     77    {% if user.id == runninguser.id %}
    3878    <form method="post" action="">
    3979    {% csrf_token %}
     
    63103    <input type="submit" value="Submit Values"/>
    64104    </form>
    65     Beheer al je gegevens <a href="{% url admin:running_user_change user.id %}">hier</a>.
     105    {% else %}
     106      Bewerk je eigen gegevens <a href="{% url running.views.user_index user.username %}">hier</a>.
     107    {% endif %}
     108    {% else %}
     109    Login om je gegevens toe te voegen.
     110    {% endif %}
     111    <a name="results" />
    66112
    67113
     
    69115  // Graph Week totals
    70116  var xhr = new XMLHttpRequest();
    71   xhr.open('GET', '{% url running.views.json_user_column user.id %}', false);
     117  xhr.open('GET', '{% url running.views.json_user_column runninguser.id %}', false);
    72118  xhr.send(null);
    73119  var myData = JSON.parse(xhr.responseText, function (key, value) {
     
    81127  // Graph Year totals
    82128  var xhr = new XMLHttpRequest();
    83   xhr.open('GET', '{% url running.views.json_user_total user.id %}', false);
     129  xhr.open('GET', '{% url running.views.json_user_total runninguser.id %}', false);
    84130  xhr.send(null);
    85131 
     
    95141  yearTotalGraph(data, 'total-statistics');
    96142</script>
     143
     144
     145<script type="text/javascript+protovis">
     146  // Graph Average Speed
     147  var xhr = new XMLHttpRequest();
     148  xhr.open('GET', '{% url running.views.json_user_speed runninguser.id %}', false);
     149  xhr.send(null);
     150 
     151  var data = JSON.parse(xhr.responseText, function (key, value) {
     152      var type;
     153      if ( value != null) {
     154        if ( key === 'x') {
     155           return new Date(value);
     156        }
     157      }
     158      return value;
     159  });
     160  yearTotalGraph(data, 'speed-statistics');
     161</script>
    97162  </body>
    98163</html>
Note: See TracChangeset for help on using the changeset viewer.