Write on the template when there is no blog for the user.
authorAditi Mittal <aditi.iitr@gmail.com>
Sat, 7 Sep 2013 06:36:35 +0000 (12:06 +0530)
committerAditi Mittal <aditi.iitr@gmail.com>
Sat, 7 Sep 2013 06:36:35 +0000 (12:06 +0530)
mediagoblin/media_types/blog/templates/mediagoblin/blog/list_of_blogs.html

index a362c7aceea8d29b0fabb30a24409a4ac2cc20f0..c1eed9e4aa25b1034d2cefcad971ecda6e267050 100644 (file)
 
 {% block mediagoblin_head%}
 <style type = "text/css">
-    td > a { text-decoration:none; font-weight: bold; }
+    tr > a { text-decoration:none; font-weight: bold; }
 </style>
 {% endblock %}
 
 {% block mediagoblin_content %}
 <table>
+    {% if blogs%}
        {% for blog in blogs %}
-       {% set my_blog_url = request.urlgen('mediagoblin.media_types.blog.blog-dashboard', 
-                                      blog_slug=blog.slug, user=request.user.username) %}
     {% set others_blog_url = request.urlgen('mediagoblin.media_types.blog.blog_post_listing', 
-                                      blog_slug=blog.slug, user=url_user) %}
-     {% if request.user.username == url_user%}                                    
+                                      blog_slug=blog.slug, user=user.username) %}
+     {% if not request.user or request.user.username != user%}  
+            <tr><a href="{{ others_blog_url }}">{{ blog.title }}</a></tr>
+    {% else %}      
+            {% set my_blog_url = request.urlgen('mediagoblin.media_types.blog.blog-dashboard', 
+           blog_slug=blog.slug, user=request.user.username) %}                                
                <tr><a href="{{ my_blog_url }}">{{ blog.title }}</a></tr>
-        {% else %}
-               <tr><a href="{{ others_blog_url }}">{{ blog.title }}</a></tr>
        {% endif %}
        <br>
        {% endfor %}
+    {% else %}
+    <p>No blog has been created yet.</p>
+    {% endif %}
 </table>
 {% endblock mediagoblin_content %}