]> git.parisson.com Git - telemeta.git/commitdiff
add user playlists to profile, fix 33% for right modules
authoryomguy <yomguy@parisson.com>
Wed, 30 Mar 2011 10:51:33 +0000 (12:51 +0200)
committeryomguy <yomguy@parisson.com>
Wed, 30 Mar 2011 10:51:33 +0000 (12:51 +0200)
telemeta/templates/telemeta_default/enumeration_edit.html
telemeta/templates/telemeta_default/home.html
telemeta/templates/telemeta_default/profile_detail.html
telemeta/web/base.py

index 5ce44000eb78a5b9552cff0488d2a4e89930c9d7..01f41c77d8a57b85a7a3f73495fd58885cb1cab5 100644 (file)
 
    </div>
    <div class="buttons">
-    <input type="submit" name="add" value="{% trans 'Add' %}">
+    <br />
+    <a href="#" class="component_icon button icon_add"
+      onclick="document.getElementById('addenum').submit(); return false;">{% trans "Add" %}</a>
    </div>
   </fieldset>
  </form>
  {% if enumeration_values %}
- <form method="POST" action="{% url telemeta-enumeration-update enumeration_id %}">{% csrf_token %}
+ <form method="POST" id="editenum" action="{% url telemeta-enumeration-update enumeration_id %}">{% csrf_token %}
   <table class="listing">
    <thead>
     <tr><th class="sel">&nbsp;</th><th>{% trans "Value"%}</th>
@@ -29,7 +31,7 @@
    </thead><tbody>
     {% for record in enumeration_values %}
     <tr>
-     <td><input type="checkbox" name="sel" value="{{record.id}}" /></td>
+     <td><input type="checkbox" name="sel" value="{{instrument.id}}" /></td>
      <td><a href="{% url telemeta-enumeration-record-edit enumeration_id,record.id %}">
         {{record.value}}</a></td>
     </tr>
@@ -37,7 +39,9 @@
     </tbody>
   </table>
   <div class="buttons">
-   <input type="submit" name="remove" value="{% trans 'Remove selected items' %}" />
+   <br />
+   <a href="#" class="component_icon button icon_cancel"
+      onclick="document.getElementById('editenum').submit(); return false;">{% trans "Remove selected items" %}</a>
   </div>
  </form>
  {% else %}
index 881911a56ae5301a01a0f9431e89c8678d1eb56d..6c1e32cef98386a642f870ef8ff722d088a958d4 100644 (file)
@@ -16,7 +16,7 @@
 
 {% block content %}
 
-<div class="module-set">
+<div class="module-set" style="width: 33%">
 
 {% block modules %}
 
@@ -24,7 +24,7 @@
     <h3><a href="{% url telemeta-rss %}">
       <img src="{% url telemeta-images "rss.png" %}" style="vertical-align:middle" /></a>
       {% trans "Last changes" %}</h3>
-    <table class="listing" bgcolor="#FFFFFF" width="390px">
+    <table class="listing" bgcolor="#FFFFFF" style="width: 100%">
       <tr>
         <th class="highlight">{% trans "Date" %}</th>
         <th>{% trans "Title" %}</th>
index 83aea3b0477f3ea8944b874da89d960b67564d54..4589484eb6659d8a8af109cdd987e7f3b0b5920c 100644 (file)
@@ -4,18 +4,31 @@
 
 {% block head_title %}{% trans "User Profile" %} : {{ usr.username }}{% endblock %}
 
-{% block submenu %}
-    <div>
-    {% block tools %}
-    {% if user.is_authenticated %}
-      <a href="{% url telemeta-profile-edit usr.username %}" class="component_icon button icon_edit">{% trans "Edit" %}</a>
-     {% endif %}
-    {% endblock tools %}
-    </div>
-{% endblock %}
+
 
 {% block content %}
-    <h3>{% trans "User profile" %} : {{ usr.username }}</h3>
+  <div class="module-set" style="width: 33%">
+  {% block modules %}
+  <div id="module" class="module">
+    <h3><img src="{% url telemeta-images "module_playlist.png" %}" style="vertical-align:middle" />
+    {% trans "Playlists" %}</h3>
+    <ul class="playlist">
+    {% for p in playlists %}
+    <li>
+        <b>{{ p.playlist.title }}</b>
+        <br />
+        <span class="info">{{ p.playlist.description }}</span>
+    </li>
+    {% endfor %}
+    </ul>
+   </div>
+  {% endblock %}
+  </div>
+
+  <h3>{% trans "User profile" %} : {{ usr.username }}</h3>
+{% if user.is_authenticated %}
+      <a href="{% url telemeta-profile-edit usr.username %}" class="component_icon button icon_edit" style="float:right">{% trans "Edit" %}</a>
+     {% endif %}
     <div class="infos" style="padding-top: 1em;">
      <dl class="listing">
       <dt>{% trans "First Name" %}</dt><dd>{{ usr.first_name }}</dd>
@@ -33,5 +46,6 @@
       <dt>{% trans "Last login" %}</dt><dd>{{ usr.last_login }}</dd>
      </dl>
     </div>
+   </div>
 {% endblock %}
 
index 8275aa8edcdc74d86f3cfec4ccd2d8c4a4aaf3ae..cd19b2e8fc1977e0d2f78553036207942a8dc67d 100644 (file)
@@ -890,8 +890,9 @@ class WebView(object):
         m = Playlist.objects.get(public_id=public_id)
         m.delete()
         
-    def get_playlists(self, request):
-        user = request.user
+    def get_playlists(self, request, user=None):
+        if not user:
+            user = request.user
         playlists = []
         if user.is_authenticated():
             user_playlists = Playlist.objects.filter(author=user)
@@ -1043,7 +1044,8 @@ class WebView(object):
             profile = user.get_profile()
         except:
             profile = None
-        return render(request, template, {'profile' : profile, 'usr': user})
+        playlists = self.get_playlists(request, user)
+        return render(request, template, {'profile' : profile, 'usr': user, 'playlists': playlists})
         
     def profile_edit(self, request, username, template='telemeta/profile_edit.html'):
         if request.user.is_staff: