From e82d9752790d0b3f092a9996d8e5f0134db01ee5 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Fri, 18 Oct 2013 11:09:29 +1100
Subject: [PATCH] work in progress new category list page

---
 .../list/wide_categories.js.handlebars        | 31 ++++++++++++-------
 .../stylesheets/desktop/topic-list.scss       | 15 ++++++++-
 app/serializers/listable_topic_serializer.rb  |  5 ++-
 config/locales/client.en.yml                  |  3 +-
 4 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars b/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars
index 6bb88dfb7..48f6e8b3f 100644
--- a/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars
+++ b/app/assets/javascripts/discourse/templates/list/wide_categories.js.handlebars
@@ -4,7 +4,6 @@
     <thead>
     <tr>
       <th class='category'>{{i18n categories.category}}</th>
-      <th class='posters'>{{i18n categories.participants}}</th>
       <th class='num topics'>{{i18n categories.topics}}</th>
       <th class='num posts'>{{i18n categories.posts}}</th>
       <th class='latest'>{{i18n categories.latest}}</th>
@@ -20,25 +19,35 @@
           {{#if newTopics}}
             <a href={{unbound url}} class='badge new-posts badge-notification' title='{{i18n topic.new_topics count="newTopics"}}'>{{unbound newTopics}} <i class='icon icon-asterisk'></i></a>
           {{/if}}
+          <div class='featured-users'>
+            {{#each featured_users}}
+              <a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
+            {{/each}}
+          </div>
           {{#if description_excerpt}}
             <div class="category-description">
               {{{description_excerpt}}}
             </div>
           {{/if}}
         </td>
-        <td>{{#each featured_users}}
-            <a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
-          {{/each}}
-        </td>
-        <td>{{number topic_count}}</td>
-        <td>{{number post_count}}</td>
+        <td class='num'>{{number topic_count}}</td>
+        <td class='num'>{{number post_count}}</td>
         {{#with latestTopic}}
           <td {{bindAttr class="archived"}}>
             {{topicStatus topic=this}}
-            {{{topicLink this}}}
-            <div class='lastUserInfo'>
-              {{i18n categories.by}} <a href="{{{unbound lastPosterUrl}}}">{{unbound last_poster.username}}</a>
-              {{unboundAge last_posted_at}}
+            <a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
+            {{#if unread}}
+              <a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unbound unread}}</a>
+            {{/if}}
+            {{#if new_posts}}
+              <a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts count="new_posts"}}'>{{unbound new_posts}}</a>
+            {{/if}}
+            {{#if unseen}}
+              <a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new}}'><i class='icon icon-asterisk'></i></a>
+            {{/if}}
+            <div class='last-user-info'>
+              {{i18n categories.latest_by}} <a href="{{{unbound lastPosterUrl}}}">{{unbound last_poster.username}}</a>
+              <a href="{{unbound lastPostUrl}}">{{unboundAge last_posted_at}}</a>
             </div>
           </td>
         {{/with}}
diff --git a/app/assets/stylesheets/desktop/topic-list.scss b/app/assets/stylesheets/desktop/topic-list.scss
index 139841bcd..c9dd515c2 100644
--- a/app/assets/stylesheets/desktop/topic-list.scss
+++ b/app/assets/stylesheets/desktop/topic-list.scss
@@ -193,8 +193,21 @@
 
 
 #topic-list.categories {
+  .last-user-info {
+    font-size: 12px;
+    margin-top: 3px;
+  }
+  tbody td {
+    padding-bottom: 20px;
+  }
   .category{
-    width: 50%;
+    position: relative;
+    width: 55%;
+    .featured-users {
+      position: absolute;
+      right: 5px;
+      top: 3px;
+    }
     .category-description {
       margin-top: 10px;
     }
diff --git a/app/serializers/listable_topic_serializer.rb b/app/serializers/listable_topic_serializer.rb
index 9a304e016..87356b7e0 100644
--- a/app/serializers/listable_topic_serializer.rb
+++ b/app/serializers/listable_topic_serializer.rb
@@ -20,9 +20,8 @@ class ListableTopicSerializer < BasicTopicSerializer
              :archived
 
   has_one :last_poster, serializer: BasicUserSerializer, embed: :objects
-
-  def include_associations!
-    include! :last_poster if object.include_last_poster
+  def include_last_poster?
+    object.include_last_poster
   end
 
   def bumped
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index 99bde17a7..02f1a0deb 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -185,11 +185,10 @@ en:
 
     categories:
       category: "Category"
-      participants: "Participants"
       posts: "Posts"
       topics: "Topics"
       latest: "Latest"
-      by: "by"
+      latest_by: "latest by"
 
     user:
       said: "{{username}} said:"