Browse Source

Prefix styles, display prefixes by thread names. #208

Rafał Pitoń 11 years ago
parent
commit
69b154e0f8

+ 5 - 1
misago/apps/threads/thread.py

@@ -1,11 +1,15 @@
 from django.utils.translation import ugettext as _
 from misago.apps.threadtype.thread import ThreadBaseView, ThreadModeration, PostsModeration
-from misago.models import Forum, Thread
+from misago.models import Forum, Thread, ThreadPrefix
 from misago.apps.threads.forms import PollVoteForm
 from misago.apps.threads.mixins import TypeMixin
 
 class ThreadView(ThreadBaseView, ThreadModeration, PostsModeration, TypeMixin):
     def template_vars(self, context):
+        prefixes = ThreadPrefix.objects.forum_prefixes(self.forum)
+        if self.thread.prefix_id in prefixes:
+            context['prefix'] = prefixes[self.thread.prefix_id]
+
         self.add_poll(context)
         return super(ThreadView, self).template_vars(context)
 

+ 8 - 5
static/cranefly/css/cranefly.css

@@ -713,7 +713,8 @@ a.label:hover,a.label:focus,a.badge:hover,a.badge:focus{color:#fff;text-decorati
 .header-primary .breadcrumb li a:hover,.header-primary .breadcrumb li a:active{color:#333}
 .header-primary .breadcrumb li .divider{color:#999}
 .header-primary h1{color:#555;font-size:35px;font-weight:normal}
-.header-primary .header-stats{overflow:visible;margin-bottom:0;color:#999}.header-primary .header-stats li{float:left;margin-right:14px}.header-primary .header-stats li>a{color:#999}.header-primary .header-stats li>a:hover,.header-primary .header-stats li>a:active{color:#333}
+.header-primary .header-stats{overflow:visible;margin-bottom:0;color:#999}.header-primary .header-stats li{float:left;margin-right:14px}.header-primary .header-stats li .thread-prefix{margin-left:2px;position:relative;bottom:1px}
+.header-primary .header-stats li>a{color:#999}.header-primary .header-stats li>a:hover,.header-primary .header-stats li>a:active{color:#333}
 .header-primary .header-stats li>i{opacity:.5;filter:alpha(opacity=50)}
 .header-primary .header-stats li.stats-form{float:right}.header-primary .header-stats li.stats-form form{margin:0;margin-bottom:-12px;padding:0}.header-primary .header-stats li.stats-form form button{position:relative;bottom:12px}.header-primary .header-stats li.stats-form form button>i{position:relative;top:0}
 .header-primary .header-tabs{border-bottom:0;margin:0;margin-top:-10px;position:relative;top:9px}.header-primary .header-tabs li a:link,.header-primary .header-tabs li a:visited{background:none;border:none;border-radius:0;margin-bottom:4px;padding:6.666666666666667px 10px;color:#888;font-weight:bold}
@@ -792,6 +793,7 @@ footer .breadcrumb li.active{color:#555}
 .form-container .form-header{border-bottom:1px solid #e7e7e7;margin-top:-20px;margin-bottom:20px;padding:10px 0}.form-container .form-header h1{margin:0;padding:0;font-size:21px}.form-container .form-header h1 small{font-size:13.125px;font-weight:bold}
 .form-container .form-header .btn{margin-left:14px;position:relative;bottom:30px}
 .form-container .form-preview{background-color:#fbfbfb;border:1px solid #e7e7e7;border-radius:3px;margin-bottom:20px;overflow:auto;padding:20px}
+.form-container .row{margin-bottom:-15px}
 .form-container form{margin:0}.form-container form fieldset{padding-top:0}.form-container form fieldset legend{border:none;padding:0;color:#999;font-size:19.599999999999998px;font-weight:bold}
 .form-container form fieldset.first{border-top:none;padding-top:0}
 .form-container form .control-label{font-weight:bold}
@@ -981,8 +983,9 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{color:#333;text-decoration:n
 .forum-subforums-list.forum-subforums-inverse .header{background-color:#333;border:1px solid #1a1a1a}.forum-subforums-list.forum-subforums-inverse .header h2{color:#eee;text-shadow:0 1px 0 #000}.forum-subforums-list.forum-subforums-inverse .header h2 small{color:#b3b3b3;text-shadow:none}
 .forum-subforums-list.forum-subforums-info .header{background-color:#3c85a3;border:1px solid #2e677e}.forum-subforums-list.forum-subforums-info .header h2{color:#fff;text-shadow:0 1px 0 #1a3946}.forum-subforums-list.forum-subforums-info .header h2 small{color:#1a3946;text-shadow:none}
 .forum-threads-list{background-color:#fff;border:1px solid #d5d5d5;border-radius:2px;-webkit-box-shadow:0 0 0 3px #eee;-moz-box-shadow:0 0 0 3px #eee;box-shadow:0 0 0 3px #eee;margin-bottom:20px}.forum-threads-list .threads-list-empty{padding:28px 0;color:#999;font-size:26.25px;text-align:center}.forum-threads-list .threads-list-empty .thread-prefix{position:relative;bottom:5px}
-.forum-threads-list>ul{list-style:none;margin:0}.forum-threads-list>ul>li{border-bottom:1px solid #d5d5d5;padding:9.9px 0;overflow:auto}.forum-threads-list>ul>li .thread-icon{float:left;margin-bottom:-1px;height:22px;width:39.5px;font-size:22px;text-align:center}.forum-threads-list>ul>li .thread-icon a:link,.forum-threads-list>ul>li .thread-icon a:active,.forum-threads-list>ul>li .thread-icon a:visited,.forum-threads-list>ul>li .thread-icon a:hover{color:#d5d5d5;text-decoration:none}
-.forum-threads-list>ul>li .thread-body{margin:-9.9px 0;margin-left:39.5px;padding:9.9px 0}.forum-threads-list>ul>li .thread-body .thread-title{display:block}.forum-threads-list>ul>li .thread-body .thread-title a:link,.forum-threads-list>ul>li .thread-body .thread-title a:active,.forum-threads-list>ul>li .thread-body .thread-title a:visited,.forum-threads-list>ul>li .thread-body .thread-title a:hover{color:#555;font-size:17.5px}
+.forum-threads-list>ul{list-style:none;margin:0}.forum-threads-list>ul>li{border-bottom:1px solid #d5d5d5;padding:9.9px 0;overflow:auto}.forum-threads-list>ul>li .thread-icon{float:left;margin-bottom:-2px;position:relative;bottom:1px;height:22px;width:39.5px;font-size:22px;text-align:center}.forum-threads-list>ul>li .thread-icon a:link,.forum-threads-list>ul>li .thread-icon a:active,.forum-threads-list>ul>li .thread-icon a:visited,.forum-threads-list>ul>li .thread-icon a:hover{color:#d5d5d5;text-decoration:none}
+.forum-threads-list>ul>li .thread-body{margin:-9.9px 0;margin-left:39.5px;padding:9.9px 0}.forum-threads-list>ul>li .thread-body .thread-prefix{position:relative;bottom:2px}
+.forum-threads-list>ul>li .thread-body .thread-title{display:block}.forum-threads-list>ul>li .thread-body .thread-title a:link,.forum-threads-list>ul>li .thread-body .thread-title a:active,.forum-threads-list>ul>li .thread-body .thread-title a:visited,.forum-threads-list>ul>li .thread-body .thread-title a:hover{color:#555;font-size:17.5px}
 .forum-threads-list>ul>li .thread-body .thread-activity{float:right;list-style:none;margin:0;margin-top:-9.9px;margin-bottom:-6px;padding:6px 0;padding-right:8px;overflow:auto;position:relative;top:1px;z-index:2}.forum-threads-list>ul>li .thread-body .thread-activity li{float:left;margin:0;margin-left:10px;padding:0}.forum-threads-list>ul>li .thread-body .thread-activity li.thread-replies,.forum-threads-list>ul>li .thread-body .thread-activity li.thread-replies-reported,.forum-threads-list>ul>li .thread-body .thread-activity li.thread-replies-moderated{position:relative;top:2px;color:#555;font-size:17.5px;font-weight:bold}
 .forum-threads-list>ul>li .thread-body .thread-activity li.thread-replies-reported{color:#cf402e}
 .forum-threads-list>ul>li .thread-body .thread-activity li.thread-replies-moderated{color:#7a43b6}
@@ -1017,8 +1020,8 @@ a.btn-link:hover,a.btn-link:active,a.btn-link:focus{color:#333;text-decoration:n
 .form-prefix .btn.btn-info.btn-active{background-color:#049cdb;border-color:#025577;color:#fff;text-shadow:0 1px 1px #025577}
 .form-prefix .btn.btn-warning,.form-prefix .btn.btn-warning:hover,.form-prefix .btn.btn-warning:active{background-color:#fee9cc;border-color:#fbbf69;color:#f89406}
 .form-prefix .btn.btn-warning.btn-active{background-color:#f89406;border-color:#945904;color:#fff;text-shadow:0 1px 1px #945904}
-.form-prefix .btn.btn-danger,.form-prefix .btn.btn-danger:hover,.form-prefix .btn.btn-danger:active{background-color:#f5d7d4;border-color:#e38b80;color:#cf402e}
-.form-prefix .btn.btn-danger.btn-active{background-color:#cf402e;border-color:#7c261b;color:#fff;text-shadow:0 1px 1px #7c261b}
+.form-prefix .btn.btn-important,.form-prefix .btn.btn-important:hover,.form-prefix .btn.btn-important:active{background-color:#f5d7d4;border-color:#e38b80;color:#cf402e}
+.form-prefix .btn.btn-important.btn-active{background-color:#cf402e;border-color:#7c261b;color:#fff;text-shadow:0 1px 1px #7c261b}
 .form-prefix .btn.btn-active,.form-prefix .btn:hover,.form-prefix .btn:active{-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none;opacity:1;filter:alpha(opacity=100)}
 .thread-buttons{overflow:auto}.thread-buttons .pull-right{margin-left:14px}
 .thread-buttons .thread-signin-message{float:right}.thread-buttons .thread-signin-message a:link,.thread-buttons .thread-signin-message a:visited{color:#333}

+ 43 - 39
static/cranefly/css/cranefly/forms.less

@@ -18,22 +18,22 @@
   }
 
   .form-header {
-  	border-bottom: 1px solid darken(@bodyBackground, 8%);
-  	margin-top: @baseLineHeight * -1;
-  	margin-bottom: @baseLineHeight;
-  	padding: (@baseLineHeight / 2) 0px;
+    border-bottom: 1px solid darken(@bodyBackground, 8%);
+    margin-top: @baseLineHeight * -1;
+    margin-bottom: @baseLineHeight;
+    padding: (@baseLineHeight / 2) 0px;
 
-  	h1 {
-  	  margin: 0px;
-  	  padding: 0px;
+    h1 {
+      margin: 0px;
+      padding: 0px;
 
-  	  font-size: @fontSizeLarge * 1.2;
+      font-size: @fontSizeLarge * 1.2;
 
       small {
         font-size: @fontSizeLarge * 0.75;
         font-weight: bold;
       }
-  	}
+    }
 
     .btn {
       margin-left: @baseFontSize;
@@ -51,11 +51,15 @@
     padding: @baseLineHeight;
   }
 
+  .row {
+    margin-bottom: -15px;
+  }
+
   form {
-  	margin: 0px;
+    margin: 0px;
 
-  	fieldset {
-  	  padding-top: 0px;
+    fieldset {
+      padding-top: 0px;
 
       legend {
         border: none;
@@ -66,36 +70,36 @@
         font-weight: bold;
       }
 
-  	  &.first {
-  	  	border-top: none;
-  	  	padding-top: 0px;
-  	  }
-  	}
-
-  	.control-label {
-  	  font-weight: bold;
-  	}
-
-  	&.form-horizontal {
-  		fieldset {
-  			&.last {
-  		    .control-group:last-child {
-  		  		margin-bottom: 0px;
-  		  		padding-bottom: 0px;
-  		    }
-  		  }
-  		}
-
-		  .form-actions {
-	      padding-left: @horizontalComponentOffset + @baseLineHeight;
-		  }
-	  }
+      &.first {
+        border-top: none;
+        padding-top: 0px;
+      }
+    }
+
+    .control-label {
+      font-weight: bold;
+    }
+
+    &.form-horizontal {
+      fieldset {
+        &.last {
+          .control-group:last-child {
+            margin-bottom: 0px;
+            padding-bottom: 0px;
+          }
+        }
+      }
+
+      .form-actions {
+        padding-left: @horizontalComponentOffset + @baseLineHeight;
+      }
+    }
   }
 
   .form-actions {
-		border-radius: 0px 0px @baseBorderRadius @baseBorderRadius;
-		margin: (@baseLineHeight * -1);
-		margin-top: @baseLineHeight * 0.5;
+    border-radius: 0px 0px @baseBorderRadius @baseBorderRadius;
+    margin: (@baseLineHeight * -1);
+    margin-top: @baseLineHeight * 0.5;
 
     .form-actions-protip {
       margin-left: @baseFontSize;

+ 9 - 2
static/cranefly/css/cranefly/forum.less

@@ -329,7 +329,9 @@
 
       .thread-icon {
         float: left;
-        margin-bottom: -1px;
+        margin-bottom: -2px;
+        position: relative;
+        bottom: 1px;
         height: @threadIconSize;
         width: @threadIconSize + @fontSizeLarge;
 
@@ -347,6 +349,11 @@
         margin-left: @threadIconSize + @fontSizeLarge;
         padding: (@fontSizeSmall - 2px) 0px;
 
+        .thread-prefix {
+          position: relative;
+          bottom: 2px;
+        }
+
         .thread-title {
           display: block;
 
@@ -681,7 +688,7 @@
       }
     }
 
-    &.btn-danger {
+    &.btn-important {
       &, &:hover, &:active {
         background-color: lighten(@red, 40%);
         border-color: lighten(@red, 20%);

+ 10 - 4
static/cranefly/css/cranefly/header.less

@@ -28,7 +28,7 @@
       }
 
       .divider {
-      	color: @grayLight
+        color: @grayLight
       }
     }
   }
@@ -49,6 +49,12 @@
       float: left;
       margin-right: @baseFontSize;
 
+      .thread-prefix {
+        margin-left: 2px;
+        position: relative;
+        bottom: 1px;
+      }
+
       &>a {
         color: @grayLight;
 
@@ -152,10 +158,10 @@
           }
 
           &:visited, &:hover {
-				    background-color: @white;
-				    border-color: lighten(@grayLight, 5%);
+            background-color: @white;
+            border-color: lighten(@grayLight, 5%);
 
-				    color: @grayDark;
+            color: @grayDark;
           }
         }
       }

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

@@ -40,7 +40,7 @@
     margin-bottom: @baseLineHeight;
 
     label {
-    	padding: 2px 0px;
+      padding: 2px 0px;
 
       font-size: @fontSizeLarge;
     }

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

@@ -208,7 +208,7 @@
             {% endif %}
           </ul>
           <div class="thread-title">
-            <a href="{{ url('thread', thread=thread.pk, slug=thread.slug) }}">{{ thread.name }}</a>
+            {% if thread.prefix_id %}{{ draw_prefix(prefixes[thread.prefix_id]) }} {% endif %}<a href="{{ url('thread', thread=thread.pk, slug=thread.slug) }}">{{ thread.name }}</a>
           </div>
         </div>
       </li>

+ 1 - 0
templates/cranefly/threads/thread.html

@@ -19,6 +19,7 @@
     </ul>
     <h1>{{ thread.name }}</h1>
     <ul class="unstyled header-stats">
+      {% if prefix %}<li><i class="icon-tag"></i> <span class="label{% if prefix.style %} label-{{ prefix.style }}{% endif %} thread-prefix">{{ _(prefix.name) }}</span></li>{% endif %}
       {% if thread.moderated %}<li><i class="icon-eye-close"></i> {% trans %}Not Reviewed{% endtrans %}</li>{% endif %}
       <li><i class="icon-time"></i> {{ thread.last|reltimesince }}</li>
       <li><i class="icon-user"></i> {% if thread.start_poster_id %}<a href="{{ url('user', user=thread.start_poster_id, username=thread.start_poster_slug) }}">{{ thread.start_poster_name }}</a>{% else %}{{ thread.start_poster_name }}{% endif %}</li>