From 01180e78cc2ddbee06d178de4bacba38d4aa6a3f Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 19 Sep 2013 13:25:25 -0700 Subject: [PATCH] Use two lines per topic list item on mobile --- .../mobile/list/topic_list_item.js.handlebars | 37 ++++++++++--- .../mobile/list/topics.js.handlebars | 54 ++++++++----------- .../stylesheets/mobile/topic-list.css.scss | 39 +++----------- app/serializers/topic_list_item_serializer.rb | 7 ++- 4 files changed, 67 insertions(+), 70 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars index 9cb0d48dc62..0fa69d69005 100644 --- a/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars +++ b/app/assets/javascripts/discourse/templates/mobile/list/topic_list_item.js.handlebars @@ -1,4 +1,5 @@ - + + - - {{categoryLink category}} - +
+
+ {{categoryLink category}} +
-{{number posts_count numberKey="posts_long"}} +
+ + + {{#if like_count}} + + {{/if}} + +
+ {{last_poster_username}} +
+ + {{#if bumped}} + + {{else}} + + {{/if}} +
+
+
+ \ No newline at end of file diff --git a/app/assets/javascripts/discourse/templates/mobile/list/topics.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/list/topics.js.handlebars index 51d1cfe4755..e6c731c9ef4 100644 --- a/app/assets/javascripts/discourse/templates/mobile/list/topics.js.handlebars +++ b/app/assets/javascripts/discourse/templates/mobile/list/topics.js.handlebars @@ -2,41 +2,31 @@ {{#if loaded}}
{{#if view.showTable}} - - {{#if canViewRankDetails}} - - {{/if}} - - - - - - - - - - - {{#if view.topicTrackingState.hasIncoming}} - - - - - + {{#if canViewRankDetails}} + {{/if}} - {{collection contentBinding="topics" tagName="tbody" itemViewClass="Discourse.TopicListItemView"}} +
- {{i18n topic.title}} - {{i18n category_title}}{{i18n posts}}
-
- {{countI18n new_topics_inserted countBinding="view.topicTrackingState.incomingCount"}} - {{i18n show_new_topics}} -
-
-
+ {{#if view.topicTrackingState.hasIncoming}} + + + +
+ {{countI18n new_topics_inserted countBinding="view.topicTrackingState.incomingCount"}} + {{i18n show_new_topics}} +
+ + + + {{/if}} + + {{collection contentBinding="topics" tagName="tbody" itemViewClass="Discourse.TopicListItemView"}} + + {{/if}}
diff --git a/app/assets/stylesheets/mobile/topic-list.css.scss b/app/assets/stylesheets/mobile/topic-list.css.scss index aab4dc56e51..88794b84f7c 100644 --- a/app/assets/stylesheets/mobile/topic-list.css.scss +++ b/app/assets/stylesheets/mobile/topic-list.css.scss @@ -92,12 +92,10 @@ } } td { - //border-top: 1px solid $topic-list-td-border-color; color: $topic-list-td-color; font-size: 14px; } .main-link { - // width: 495px; font-size: 16px; i.score { @@ -138,45 +136,24 @@ position: relative; top: -1px; } - .category { - // width: 100px; + + .topic-item-stats { + margin-top: 8px; } - .has-excerpt { - td.category, td.posts { - vertical-align: top; - padding-top: 8px; - } - } - .posters { - width: 150px; - > a { + + .topic-item-stats { + .category, .num, .last-poster { float: left; - margin-right: 4px; - &:last-of-type { - margin-right: 0; - } - } - } - .avatar { - &.latest { - @include box-shadow(0 0 6px 1px desaturate(lighten($link_color, 18%), 35%)); + margin-right: 8px; } } + .num { text-align: center; a:not(.badge-posts) { color: inherit; } } - .likes { - width: 50px; - } - .activity { - width: 50px; - } - .age { - width: 60px; - } } // Category list diff --git a/app/serializers/topic_list_item_serializer.rb b/app/serializers/topic_list_item_serializer.rb index 38c9bdd70c7..b8b4307e8d9 100644 --- a/app/serializers/topic_list_item_serializer.rb +++ b/app/serializers/topic_list_item_serializer.rb @@ -5,7 +5,8 @@ class TopicListItemSerializer < ListableTopicSerializer :starred, :has_best_of, :archetype, - :rank_details + :rank_details, + :last_poster_username has_one :category, serializer: BasicCategorySerializer has_many :posters, serializer: TopicPosterSerializer, embed: :objects @@ -44,4 +45,8 @@ class TopicListItemSerializer < ListableTopicSerializer object.posters || [] end + def last_poster_username + object.posters.find { |poster| poster.user.id == object.last_post_user_id }.try(:user).try(:username) + end + end