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 @extends Ember.Component
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
@ -9,12 +9,19 @@
var LINKS_SHOWN = 5; var LINKS_SHOWN = 5;
Discourse.DiscourseTopicInformationComponent = Ember.Component.extend({ Discourse.DiscourseTopicMapComponent = Ember.Component.extend({
mapCollapsed: true, mapCollapsed: true,
templateName: 'components/discourse-topic-information', templateName: 'components/discourse-topic-map',
details: Em.computed.alias('topic.details'), details: Em.computed.alias('topic.details'),
allLinksShown: false, 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() { toggleMapClass: function() {
return this.get('mapCollapsed') ? 'icon-chevron-down' : 'icon-chevron-up'; return this.get('mapCollapsed') ? 'icon-chevron-down' : 'icon-chevron-up';
}.property('mapCollapsed'), }.property('mapCollapsed'),

View File

@ -70,7 +70,7 @@
</div> </div>
{{view Discourse.RepliesView content=replies postView=view}} {{view Discourse.RepliesView content=replies postView=view}}
{{discourse-action-history post=this}} {{discourse-action-history post=this}}
{{view Discourse.TopicMapView post=this topic=controller.model}} {{view Discourse.TopicMapContainerView post=this topic=controller.model}}
</div> </div>
<div class='span5 gutter'> <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 @extends Discourse.View
@namespace Discourse @namespace Discourse
@module Discourse @module Discourse
**/ **/
Discourse.TopicMapView = Discourse.ContainerView.extend({ Discourse.TopicMapContainerView = Discourse.ContainerView.extend({
classNameBindings: ['hidden', ':topic-map'], classNameBindings: ['hidden', ':topic-map'],
shouldRerender: Discourse.View.renderIfChanged('topic.posts_count'), shouldRerender: Discourse.View.renderIfChanged('topic.posts_count'),
@ -23,7 +24,7 @@ Discourse.TopicMapView = Discourse.ContainerView.extend({
this._super(); this._super();
if (this.get('hidden')) return; 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); this.trigger('appendMapInformation', this);
}, },

View File

@ -383,8 +383,8 @@ en:
summary: summary:
enabled_description: "You're viewing a summary of this topic. To see all posts again, click below." 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?" 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' enable: 'Summarize This Topic'
disable: 'Cancel Summary view' disable: 'Cancel Summary'
private_message_info: private_message_info:
title: "Private Message" title: "Private Message"