Moved more into components, including summary stuff.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
/**
|
||||
The controls at the top of a private message in the map area.
|
||||
|
||||
@class DiscoursePrivateMessageMapComponent
|
||||
@extends Ember.Component
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.DiscoursePrivateMessageMapComponent = Ember.Component.extend({
|
||||
templateName: 'components/discourse-private-message-map',
|
||||
tagName: 'section',
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
/**
|
||||
The controls for toggling the summarized view on/off
|
||||
|
||||
@class DiscourseToggleBestOfComponent
|
||||
@extends Ember.Component
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
Discourse.DiscourseToggleBestOfComponent = Ember.Component.extend({
|
||||
templateName: 'components/discourse-toggle-best-of',
|
||||
tagName: 'section',
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
The information that sits in the topic map.
|
||||
|
||||
@class DiscourseTopicInformationComponent
|
||||
@extends Ember.Component
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
|
||||
var LINKS_SHOWN = 5;
|
||||
|
||||
Discourse.DiscourseTopicInformationComponent = Ember.Component.extend({
|
||||
mapCollapsed: true,
|
||||
templateName: 'components/discourse-topic-information',
|
||||
details: Em.computed.alias('topic.details'),
|
||||
allLinksShown: false,
|
||||
|
||||
toggleMapClass: function() {
|
||||
return this.get('mapCollapsed') ? 'icon-chevron-down' : 'icon-chevron-up';
|
||||
}.property('mapCollapsed'),
|
||||
|
||||
showAllLinksControls: function() {
|
||||
if (this.get('allLinksShown')) return false;
|
||||
if ((this.get('details.links.length') || 0) <= LINKS_SHOWN) return false;
|
||||
return true;
|
||||
}.property('allLinksShown', 'topic.details.links'),
|
||||
|
||||
infoLinks: function() {
|
||||
if (Em.isNone('details.links')) return [];
|
||||
|
||||
var allLinks = this.get('details.links');
|
||||
if (this.get('allLinksShown')) return allLinks;
|
||||
return allLinks.slice(0, LINKS_SHOWN);
|
||||
}.property('details.links', 'allLinksShown'),
|
||||
|
||||
actions: {
|
||||
toggleMap: function() {
|
||||
this.toggleProperty('mapCollapsed');
|
||||
},
|
||||
|
||||
showAllLinks: function() {
|
||||
this.set('allLinksShown', true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
Discourse.DiscourseTopicParticipantComponent = Ember.Component.extend({
|
||||
|
||||
postStream: Em.computed.alias('participant.topic.postStream'),
|
||||
|
||||
toggled: function() {
|
||||
return this.get('postStream.userFilters').contains(this.get('participant.username'));
|
||||
}.property('postStream.userFilters.[]'),
|
||||
|
||||
actions: {
|
||||
toggle: function() {
|
||||
var postStream = this.get('postStream');
|
||||
if (postStream) {
|
||||
postStream.toggleParticipant(this.get('participant.username'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user