If the topic can be summarized, expand the topic map by default

This commit is contained in:
Robin Ward 2013-11-18 13:43:35 -05:00
parent 4ce81e1b01
commit 629fe8b426
5 changed files with 19 additions and 11 deletions

View File

@ -1,7 +1,7 @@
/**
The information that sits in the topic map.
The topic map underneath the first post of a topic.
@class DiscourseTopicInformationComponent
@class DiscourseTopicMapComponent
@extends Ember.Component
@namespace Discourse
@module Discourse
@ -9,12 +9,19 @@
var LINKS_SHOWN = 5;
Discourse.DiscourseTopicInformationComponent = Ember.Component.extend({
Discourse.DiscourseTopicMapComponent = Ember.Component.extend({
mapCollapsed: true,
templateName: 'components/discourse-topic-information',
templateName: 'components/discourse-topic-map',
details: Em.computed.alias('topic.details'),
allLinksShown: false,
init: function() {
this._super();
// If the topic has a summary, expand the map by default
this.set('mapCollapsed', !this.get('topic.has_summary'));
},
toggleMapClass: function() {
return this.get('mapCollapsed') ? 'icon-chevron-down' : 'icon-chevron-up';
}.property('mapCollapsed'),

View File

@ -70,7 +70,7 @@
</div>
{{view Discourse.RepliesView content=replies postView=view}}
{{discourse-action-history post=this}}
{{view Discourse.TopicMapView post=this topic=controller.model}}
{{view Discourse.TopicMapContainerView post=this topic=controller.model}}
</div>
<div class='span5 gutter'>

View File

@ -1,12 +1,13 @@
/**
This view handles rendering of the map of the topic under the first post
This view contains the topic map as well as other relevant information underneath the
first post.
@class TopicMapView
@class TopicMapContainerView
@extends Discourse.View
@namespace Discourse
@module Discourse
**/
Discourse.TopicMapView = Discourse.ContainerView.extend({
Discourse.TopicMapContainerView = Discourse.ContainerView.extend({
classNameBindings: ['hidden', ':topic-map'],
shouldRerender: Discourse.View.renderIfChanged('topic.posts_count'),
@ -23,7 +24,7 @@ Discourse.TopicMapView = Discourse.ContainerView.extend({
this._super();
if (this.get('hidden')) return;
this.attachViewWithArgs({ topic: this.get('topic') }, Discourse.DiscourseTopicInformationComponent);
this.attachViewWithArgs({ topic: this.get('topic') }, Discourse.DiscourseTopicMapComponent);
this.trigger('appendMapInformation', this);
},

View File

@ -383,8 +383,8 @@ en:
summary:
enabled_description: "You're viewing a summary of this topic. To see all posts again, click below."
description: "There are <b>{{count}}</b> posts in this topic. That's a lot! Would you like to save time by showing only the most relevant posts?"
enable: 'Switch to Summary view'
disable: 'Cancel Summary view'
enable: 'Summarize This Topic'
disable: 'Cancel Summary'
private_message_info:
title: "Private Message"