Просмотр исходного кода

Fancier "detail" column on redirect forums on forums list.

Ralfp 12 лет назад
Родитель
Сommit
7af65cf656

+ 8 - 0
misago/models/forummodel.py

@@ -1,3 +1,4 @@
+import urlparse
 from mptt.managers import TreeManager
 from mptt.models import MPTTModel, TreeForeignKey
 from django.conf import settings
@@ -203,6 +204,13 @@ class Forum(MPTTModel):
             return att in self.attrs.split()
         return False
 
+    def redirect_domain(self):
+        hostname = urlparse.urlparse(self.redirect).hostname
+        scheme = urlparse.urlparse(self.redirect).scheme
+        if scheme:
+            scheme = '%s://' % scheme
+        return '%s%s' % (scheme, hostname)
+
     def new_last_thread(self, thread):
         self.last_thread = thread
         self.last_thread_name = thread.name

+ 3 - 3
static/cranefly/css/cranefly.css

@@ -974,7 +974,7 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{opacity:0.9;filter:alpha(opa
 .index-category table .forum-main .dropdown .dropdown-menu .dropdown-shadow ul li:last-child a{border-bottom:none;}
 .index-category table .forum-main .forum-details{border-left:1px dotted #e0e0e0;float:right;margin:-10px 0px;margin-top:-8.1px;padding-left:14px;height:35px;width:220px;}.index-category table .forum-main .forum-details .thread-name a:link,.index-category table .forum-main .forum-details .thread-name a:active,.index-category table .forum-main .forum-details .thread-name a:visited,.index-category table .forum-main .forum-details .thread-name a:hover{margin-bottom:1px;color:#333333;font-size:11.9px;font-weight:bold;}
 .index-category table .forum-main .forum-details .muted{font-size:10.5px;line-height:10.5px;}.index-category table .forum-main .forum-details .muted .last-poster,.index-category table .forum-main .forum-details .muted a:link,.index-category table .forum-main .forum-details .muted a:active,.index-category table .forum-main .forum-details .muted a:visited,.index-category table .forum-main .forum-details .muted a:hover{color:#555555;}
-.index-category table .forum-main .forum-details em,.index-category table .forum-main .forum-details .forum-clicks{position:relative;top:7.5px;color:#999999;}.index-category table .forum-main .forum-details em strong,.index-category table .forum-main .forum-details .forum-clicks strong{color:#333333;font-weight:normal;}
+.index-category table .forum-main .forum-details em{position:relative;top:7.5px;color:#999999;}.index-category table .forum-main .forum-details em strong{color:#333333;font-weight:normal;}
 .index-category table .forum-main .forum-meta-tooltip .tooltip-inner{max-width:400px;text-align:left;}.index-category table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats{color:#999999;font-size:10.5px;}.index-category table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats strong{color:#ffffff;}
 .index-category table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats span{margin-right:14px;}
 .index-category table .forum-main .forum-meta-tooltip .tooltip-inner .forum-description{clear:both;margin:0px;margin-bottom:7px;padding:0px;color:#eeeeee;font-size:14px;}
@@ -1041,7 +1041,7 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{opacity:0.9;filter:alpha(opa
 .category-forums-list table .forum-main .dropdown .dropdown-menu .dropdown-shadow ul li:last-child a{border-bottom:none;}
 .category-forums-list table .forum-main .forum-details{border-left:1px dotted #e0e0e0;float:right;margin:-10px 0px;margin-top:-8.1px;padding-left:14px;height:35px;width:220px;}.category-forums-list table .forum-main .forum-details .thread-name a:link,.category-forums-list table .forum-main .forum-details .thread-name a:active,.category-forums-list table .forum-main .forum-details .thread-name a:visited,.category-forums-list table .forum-main .forum-details .thread-name a:hover{margin-bottom:1px;color:#333333;font-size:11.9px;font-weight:bold;}
 .category-forums-list table .forum-main .forum-details .muted{font-size:10.5px;line-height:10.5px;}.category-forums-list table .forum-main .forum-details .muted .last-poster,.category-forums-list table .forum-main .forum-details .muted a:link,.category-forums-list table .forum-main .forum-details .muted a:active,.category-forums-list table .forum-main .forum-details .muted a:visited,.category-forums-list table .forum-main .forum-details .muted a:hover{color:#555555;}
-.category-forums-list table .forum-main .forum-details em,.category-forums-list table .forum-main .forum-details .forum-clicks{position:relative;top:7.5px;color:#999999;}.category-forums-list table .forum-main .forum-details em strong,.category-forums-list table .forum-main .forum-details .forum-clicks strong{color:#333333;font-weight:normal;}
+.category-forums-list table .forum-main .forum-details em{position:relative;top:7.5px;color:#999999;}.category-forums-list table .forum-main .forum-details em strong{color:#333333;font-weight:normal;}
 .category-forums-list table .forum-main .forum-meta-tooltip .tooltip-inner{max-width:400px;text-align:left;}.category-forums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats{color:#999999;font-size:10.5px;}.category-forums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats strong{color:#ffffff;}
 .category-forums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats span{margin-right:14px;}
 .category-forums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-description{clear:both;margin:0px;margin-bottom:7px;padding:0px;color:#eeeeee;font-size:14px;}
@@ -1070,7 +1070,7 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{opacity:0.9;filter:alpha(opa
 .forum-subforums-list table .forum-main .dropdown .dropdown-menu .dropdown-shadow ul li:last-child a{border-bottom:none;}
 .forum-subforums-list table .forum-main .forum-details{border-left:1px dotted #e0e0e0;float:right;margin:-10px 0px;margin-top:-8.1px;padding-left:14px;height:35px;width:220px;}.forum-subforums-list table .forum-main .forum-details .thread-name a:link,.forum-subforums-list table .forum-main .forum-details .thread-name a:active,.forum-subforums-list table .forum-main .forum-details .thread-name a:visited,.forum-subforums-list table .forum-main .forum-details .thread-name a:hover{margin-bottom:1px;color:#333333;font-size:11.9px;font-weight:bold;}
 .forum-subforums-list table .forum-main .forum-details .muted{font-size:10.5px;line-height:10.5px;}.forum-subforums-list table .forum-main .forum-details .muted .last-poster,.forum-subforums-list table .forum-main .forum-details .muted a:link,.forum-subforums-list table .forum-main .forum-details .muted a:active,.forum-subforums-list table .forum-main .forum-details .muted a:visited,.forum-subforums-list table .forum-main .forum-details .muted a:hover{color:#555555;}
-.forum-subforums-list table .forum-main .forum-details em,.forum-subforums-list table .forum-main .forum-details .forum-clicks{position:relative;top:7.5px;color:#999999;}.forum-subforums-list table .forum-main .forum-details em strong,.forum-subforums-list table .forum-main .forum-details .forum-clicks strong{color:#333333;font-weight:normal;}
+.forum-subforums-list table .forum-main .forum-details em{position:relative;top:7.5px;color:#999999;}.forum-subforums-list table .forum-main .forum-details em strong{color:#333333;font-weight:normal;}
 .forum-subforums-list table .forum-main .forum-meta-tooltip .tooltip-inner{max-width:400px;text-align:left;}.forum-subforums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats{color:#999999;font-size:10.5px;}.forum-subforums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats strong{color:#ffffff;}
 .forum-subforums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-stats span{margin-right:14px;}
 .forum-subforums-list table .forum-main .forum-meta-tooltip .tooltip-inner .forum-description{clear:both;margin:0px;margin-bottom:7px;padding:0px;color:#eeeeee;font-size:14px;}

+ 1 - 1
static/cranefly/css/cranefly/category.less

@@ -161,7 +161,7 @@
           }
         }
 
-        em, .forum-clicks {
+        em {
           position: relative;
           top: (35px - @baseLineHeight) / 2;
 

+ 1 - 1
static/cranefly/css/cranefly/forum.less

@@ -176,7 +176,7 @@
           }
         }
 
-        em, .forum-clicks {
+        em {
           position: relative;
           top: (35px - @baseLineHeight) / 2;
 

+ 1 - 1
static/cranefly/css/cranefly/index.less

@@ -183,7 +183,7 @@
           }
         }
 
-        em, .forum-clicks {
+        em {
           position: relative;
           top: (35px - @baseLineHeight) / 2;
 

+ 4 - 1
templates/cranefly/category.html

@@ -52,7 +52,10 @@
               <em>{% trans %}This forum is protected{% endtrans %}</em>
               {%- endif %}
               {%- else -%}
-              <div class="forum-clicks">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'strong') %}{{ clicks }} clicks{% endtrans %}</div>
+              <div class="thread-name">
+                <a href="{% url 'redirect' slug=forum.slug, forum=forum.id %}">{{ forum.redirect_domain() }}</a>
+              </div>
+              <div class="muted">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'span', 'class="last-poster"') %}{{ clicks }} clicks{% endtrans %}</div>
               {%- endif %}
             </div>
             {% endif %}

+ 4 - 1
templates/cranefly/index.html

@@ -38,7 +38,10 @@
                   <em>{% trans %}This forum is protected{% endtrans %}</em>
                   {%- endif %}
                   {%- else -%}
-                  <div class="forum-clicks">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'strong') %}{{ clicks }} clicks{% endtrans %}</div>
+                  <div class="thread-name">
+                    <a href="{% url 'redirect' slug=forum.slug, forum=forum.id %}">{{ forum.redirect_domain() }}</a>
+                  </div>
+                  <div class="muted">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'span', 'class="last-poster"') %}{{ clicks }} clicks{% endtrans %}</div>
                   {%- endif %}
                 </div>
                 {% endif %}

+ 2 - 2
templates/cranefly/macros.html

@@ -45,6 +45,6 @@
 itemprop="breadcrumb"
 {%- endmacro %}
 
-{% macro wrap(item, wrap) -%}
-<{{ wrap }}>{{ item }}</{{ wrap }}>
+{% macro wrap(item, wrap, extra='') -%}
+<{{ wrap }}{% if extra %} {{ extra|safe }}{% endif %}>{{ item }}</{{ wrap }}>
 {%- endmacro %}

+ 4 - 1
templates/cranefly/threads/list.html

@@ -56,7 +56,10 @@
               <em>{% trans %}This forum is protected{% endtrans %}</em>
               {%- endif %}
               {%- else -%}
-              <div class="forum-clicks">{% trans clicks=macros.wrap(subforum.redirects|intcomma, 'strong') %}{{ clicks }} clicks{% endtrans %}</div>
+              <div class="thread-name">
+                <a href="{% url 'redirect' slug=forum.slug, forum=forum.id %}">{{ forum.redirect_domain() }}</a>
+              </div>
+              <div class="muted">{% trans clicks=macros.wrap(forum.redirects|intcomma, 'span', 'class="last-poster"') %}{{ clicks }} clicks{% endtrans %}</div>
               {%- endif %}
             </div>
             {% endif %}