Browse Source

Include rank class in template render.

Ralfp 12 years ago
parent
commit
898045fa94

+ 5 - 0
misago/users/models.py

@@ -380,6 +380,11 @@ class User(models.Model):
             return self.rank.title
         return None
     
+    def get_style(self):
+        if self.rank:
+            return self.rank.style
+        return ''
+    
     def email_user(self, request, template, subject, context={}):
         templates = request.theme.get_email_templates(template)
         context = RequestContext(request, context)

+ 1 - 3
templates/sora/profiles/details.html

@@ -7,9 +7,7 @@
 
 {% block title %}{{ macros.page_title(profile.username, _('Member Details')) }}{% endblock %}
 
-{% block content %}
-{{ super() }}
-
+{% block tab %}
 <div class="row">
   <div class="span6">
   	

+ 8 - 4
templates/sora/profiles/list.html

@@ -39,14 +39,18 @@
 <table class="table table-striped table-users">
   <thead>
     <tr>
-      <th{% if users|length > 1 %} colspan="2"{% endif %}>{% if in_search %}{% trans %}Found Users{% endtrans %}{% else %}{% trans %}Users in this group{% endtrans %}{% endif %}</th>
+      <th colspan="2">{% if in_search %}{% trans %}Found Users{% endtrans %}{% else %}{% trans %}Users in this group{% endtrans %}{% endif %}</th>
     </tr>
   </thead>
   <tbody>
-    <tr>{% for user in users %}    	
-      <td{% if users|length > 1 %} {% if loop.last and loop.index is odd %}colspan="2"{% else %}class="span6"{% endif %}{% endif %}>
+    <tr>{% for user in users %}
+      <td class="span6{% if user.get_style() %} {{ user.get_style() }}{% endif %}">
         <a href="{% url 'user' username=user.username_slug, user=user.pk %}"><img src="{{ user.get_avatar('medium') }}" class="avatar" alt="{% trans %}Member's Avatar{% endtrans %}" title="{% trans %}Member's Avatar{% endtrans %}"> <strong>{{ user.username }}</strong>{% if user.title or (in_search and user.get_title()) %} <span class="muted">{% if in_search%}{{ _(user.get_title()) }}{% else %}{{ _(user.title) }}{% endif %}</span>{% endif %}</a>
-      </td>{% if not loop.last and loop.index is even %}
+      </td>{% if loop.last and loop.index is odd %}
+      <td class="span6">
+      	&nbsp;
+      </td>
+      {% endif %}{% if not loop.last and loop.index is even %}
     </tr>
     <tr>{% endif %}
     {% endfor %}</tr>

+ 20 - 15
templates/sora/profiles/profile.html

@@ -8,20 +8,25 @@
 {% block title %}{{ macros.page_title(profile.username) }}{% endblock %}
 
 {% block content %}
-<div class="page-header profile-header header-tabbed">
-  <div class="avatar-height">
-    <img src="{{ profile.get_avatar() }}" class="avatar pull-left" alt="{% trans %}Member Avatar{% endtrans %}" title="{% trans %}Member Avatar{% endtrans %}">
-    <div class="pull-left">
-      <h1>{{ profile.username }}</h1>
-      <p class="lead">{% if profile.title or profile.rank.title %}{% if profile.title %}{{ _(profile.title) }}{% elif profile.rank.title %}{{ _(profile.rank.title) }}{% endif %}; {% endif %}<span class="muted">{% trans last_visit=profile.last_date|reltimesince|low %}Last seen {{ last_visit }}{% endtrans %}</span></p>
-    </div>
-  </div>	
-  <ul class="nav nav-tabs">
-    <li{% if tab == 'posts' %} class="active"{% endif %}><a href="{% url 'user' user=profile.pk, username=profile.username_slug %}">{% trans %}Last Posts{% endtrans %}</a></li>
-    <li{% if tab == 'threads' %} class="active"{% endif %}><a href="{% url 'user_threads' user=profile.pk, username=profile.username_slug %}">{% trans %}Last Threads{% endtrans %}</a></li>
-    <li{% if tab == 'following' %} class="active"{% endif %}><a href="{% url 'user_following' user=profile.pk, username=profile.username_slug %}">{% trans %}Following{% endtrans %}</a></li>
-    <li{% if tab == 'followers' %} class="active"{% endif %}><a href="{% url 'user_followers' user=profile.pk, username=profile.username_slug %}">{% trans %}Followers{% endtrans %}</a></li>
-    <li{% if tab == 'details' %} class="active"{% endif %}><a href="{% url 'user_details' user=profile.pk, username=profile.username_slug %}">{% trans %}Profile Details{% endtrans %}</a></li>
-  </ul>
+<div class="profile-wrapper{% if profile.get_style() %} {{ profile.get_style() }}{% endif %}">
+  <div class="page-header profile-header header-tabbed{% if profile.get_style() %} {{ profile.get_style() }}{% endif %}">
+    <div class="avatar-height">
+      <img src="{{ profile.get_avatar() }}" class="avatar pull-left" alt="{% trans %}Member Avatar{% endtrans %}" title="{% trans %}Member Avatar{% endtrans %}">
+      <div class="pull-left">
+        <h1>{{ profile.username }}</h1>
+        <p class="lead">{% if profile.title or profile.rank.title %}{% if profile.title %}{{ _(profile.title) }}{% elif profile.rank.title %}{{ _(profile.rank.title) }}{% endif %}; {% endif %}<span class="muted">{% trans last_visit=profile.last_date|reltimesince|low %}Last seen {{ last_visit }}{% endtrans %}</span></p>
+      </div>
+    </div>	
+    <ul class="nav nav-tabs">
+      <li{% if tab == 'posts' %} class="active"{% endif %}><a href="{% url 'user' user=profile.pk, username=profile.username_slug %}">{% trans %}Last Posts{% endtrans %}</a></li>
+      <li{% if tab == 'threads' %} class="active"{% endif %}><a href="{% url 'user_threads' user=profile.pk, username=profile.username_slug %}">{% trans %}Last Threads{% endtrans %}</a></li>
+      <li{% if tab == 'following' %} class="active"{% endif %}><a href="{% url 'user_following' user=profile.pk, username=profile.username_slug %}">{% trans %}Following{% endtrans %}</a></li>
+      <li{% if tab == 'followers' %} class="active"{% endif %}><a href="{% url 'user_followers' user=profile.pk, username=profile.username_slug %}">{% trans %}Followers{% endtrans %}</a></li>
+      <li{% if tab == 'details' %} class="active"{% endif %}><a href="{% url 'user_details' user=profile.pk, username=profile.username_slug %}">{% trans %}Profile Details{% endtrans %}</a></li>
+    </ul>
+  </div>
+  <div class="profile-tab{% if profile.get_style() %} {{ profile.get_style() }}{% endif %}">
+  	{% block tab %}{% endblock %}
+  </div>
 </div>
 {% endblock %}