Deprecation: `{{view}}` helper
This commit is contained in:
parent
1714019cf7
commit
c15ade8a88
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="badge_type_id">{{i18n 'admin.badges.badge_type'}}</label>
|
<label for="badge_type_id">{{i18n 'admin.badges.badge_type'}}</label>
|
||||||
{{view "select" name="badge_type_id"
|
{{combo-box name="badge_type_id"
|
||||||
value=buffered.badge_type_id
|
value=buffered.badge_type_id
|
||||||
content=badgeTypes
|
content=badgeTypes
|
||||||
optionValuePath="content.id"
|
optionValuePath="content.id"
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="badge_grouping_id">{{i18n 'admin.badges.badge_grouping'}}</label>
|
<label for="badge_grouping_id">{{i18n 'admin.badges.badge_grouping'}}</label>
|
||||||
{{view "select" name="badge_grouping_id"
|
{{combo-box name="badge_grouping_id"
|
||||||
value=buffered.badge_grouping_id
|
value=buffered.badge_grouping_id
|
||||||
content=badgeGroupings
|
content=badgeGroupings
|
||||||
optionValuePath="content.id"
|
optionValuePath="content.id"
|
||||||
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label for="trigger">{{i18n 'admin.badges.trigger'}}</label>
|
<label for="trigger">{{i18n 'admin.badges.trigger'}}</label>
|
||||||
{{view "select" name="trigger"
|
{{combo-box name="trigger"
|
||||||
value=buffered.trigger
|
value=buffered.trigger
|
||||||
content=badgeTriggers
|
content=badgeTriggers
|
||||||
optionValuePath="content.id"
|
optionValuePath="content.id"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{view 'screened-emails-list' content=controller}}
|
{{screened-emails-list content=controller}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{view 'screened-ip-addresses-list' content=controller}}
|
{{screened-ip-addresses-list content=controller}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{view 'screened-urls-list' content=controller}}
|
{{screened-urls-list content=controller}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{i18n 'search.no_results'}}
|
{{i18n 'search.no_results'}}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
{{#conditional-loading-spinner condition=loading}}
|
{{#conditional-loading-spinner condition=loading}}
|
||||||
{{#if model.length}}
|
{{#if model.length}}
|
||||||
{{view "staff-action-logs-list" content=controller}}
|
{{staff-action-logs-list content=controller}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{i18n 'search.no_results'}}
|
{{i18n 'search.no_results'}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<div class="col heading actions"></div>
|
<div class="col heading actions"></div>
|
||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
{{view 'permalinks-list' content=controller}}
|
{{permalinks-list content=controller}}
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{i18n 'search.no_results'}}
|
{{i18n 'search.no_results'}}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import debounce from 'discourse/lib/debounce';
|
import debounce from 'discourse/lib/debounce';
|
||||||
import { searchForTerm } from 'discourse/lib/search';
|
import { searchForTerm } from 'discourse/lib/search';
|
||||||
|
|
||||||
export default Ember.View.extend({
|
export default Ember.Component.extend({
|
||||||
templateName: 'choose_topic',
|
|
||||||
|
|
||||||
topicTitleChanged: function() {
|
topicTitleChanged: function() {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
loading: true,
|
loading: true,
|
|
@ -17,7 +17,7 @@ export default buildCategoryPanel('security', {
|
||||||
if (!this.get('category.is_special')) {
|
if (!this.get('category.is_special')) {
|
||||||
this.get('category').addPermission({
|
this.get('category').addPermission({
|
||||||
group_name: group + "",
|
group_name: group + "",
|
||||||
permission: PermissionType.create({id})
|
permission: PermissionType.create({ id: parseInt(id) })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import StringBuffer from 'discourse/mixins/string-buffer';
|
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||||
|
|
||||||
export default Ember.View.extend(StringBuffer, {
|
export default Ember.Component.extend(StringBuffer, {
|
||||||
elementId: 'topic-closing-info',
|
elementId: 'topic-closing-info',
|
||||||
delayedRerender: null,
|
delayedRerender: null,
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ export default Ember.View.extend(StringBuffer, {
|
||||||
'topic.details.auto_close_based_on_last_post',
|
'topic.details.auto_close_based_on_last_post',
|
||||||
'topic.details.auto_close_hours'],
|
'topic.details.auto_close_hours'],
|
||||||
|
|
||||||
renderString: function(buffer) {
|
renderString(buffer) {
|
||||||
if (!!Ember.isEmpty(this.get('topic.details.auto_close_at'))) return;
|
if (!!Ember.isEmpty(this.get('topic.details.auto_close_at'))) return;
|
||||||
if (this.get("topic.closed")) return;
|
if (this.get("topic.closed")) return;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ export default Ember.View.extend(StringBuffer, {
|
||||||
this.set('delayedRerender', Em.run.later(this, this.rerender, rerenderDelay));
|
this.set('delayedRerender', Em.run.later(this, this.rerender, rerenderDelay));
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement: function() {
|
willDestroyElement() {
|
||||||
if( this.delayedRerender ) {
|
if( this.delayedRerender ) {
|
||||||
Em.run.cancel(this.get('delayedRerender'));
|
Em.run.cancel(this.get('delayedRerender'));
|
||||||
}
|
}
|
|
@ -1,22 +1,33 @@
|
||||||
import Sharing from 'discourse/lib/sharing';
|
import Sharing from 'discourse/lib/sharing';
|
||||||
import { longDateNoYear } from 'discourse/lib/formatter';
|
import { longDateNoYear } from 'discourse/lib/formatter';
|
||||||
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
needs: ['topic'],
|
needs: ['topic'],
|
||||||
title: Ember.computed.alias('controllers.topic.model.title'),
|
|
||||||
|
|
||||||
displayDate: function() {
|
@computed('type', 'postNumber')
|
||||||
return longDateNoYear(new Date(this.get('date')));
|
title(type, postNumber) {
|
||||||
}.property('date'),
|
if (type === 'topic') { return I18n.t('share.topic'); }
|
||||||
|
if (postNumber) {
|
||||||
|
return I18n.t('share.post', { postNumber });
|
||||||
|
} else {
|
||||||
|
return I18n.t('share.topic');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
@computed('date')
|
||||||
|
displayDate(date) {
|
||||||
|
return longDateNoYear(new Date(date));
|
||||||
|
},
|
||||||
|
|
||||||
// Close the share controller
|
// Close the share controller
|
||||||
actions: {
|
actions: {
|
||||||
close: function() {
|
close() {
|
||||||
this.setProperties({ link: '', postNumber: '' });
|
this.setProperties({ link: '', postNumber: '' });
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
share: function(source) {
|
share(source) {
|
||||||
var url = source.generateUrl(this.get('link'), this.get('title'));
|
var url = source.generateUrl(this.get('link'), this.get('title'));
|
||||||
if (source.shouldOpenInPopup) {
|
if (source.shouldOpenInPopup) {
|
||||||
window.open(url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=600,height=' + (source.popupHeight || 315));
|
window.open(url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=600,height=' + (source.popupHeight || 315));
|
||||||
|
@ -26,7 +37,8 @@ export default Ember.Controller.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
sources: function() {
|
@computed
|
||||||
|
sources() {
|
||||||
return Sharing.activeSources(this.siteSettings.share_links);
|
return Sharing.activeSources(this.siteSettings.share_links);
|
||||||
}.property()
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,6 +7,7 @@ import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||||
import computed from 'ember-addons/ember-computed-decorators';
|
import computed from 'ember-addons/ember-computed-decorators';
|
||||||
import Composer from 'discourse/models/composer';
|
import Composer from 'discourse/models/composer';
|
||||||
import DiscourseURL from 'discourse/lib/url';
|
import DiscourseURL from 'discourse/lib/url';
|
||||||
|
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
||||||
|
|
||||||
export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||||
needs: ['modal', 'composer', 'quote-button', 'topic-progress', 'application'],
|
needs: ['modal', 'composer', 'quote-button', 'topic-progress', 'application'],
|
||||||
|
@ -76,6 +77,58 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@computed('model', 'topicTrackingState.messageCount')
|
||||||
|
browseMoreMessage(model) {
|
||||||
|
|
||||||
|
// TODO decide what to show for pms
|
||||||
|
if (model.get('isPrivateMessage')) { return; }
|
||||||
|
|
||||||
|
const opts = { latestLink: `<a href="${Discourse.getURL("/latest")}">${I18n.t("topic.view_latest_topics")}</a>` };
|
||||||
|
let category = model.get('category');
|
||||||
|
|
||||||
|
if (category && Em.get(category, 'id') === Discourse.Site.currentProp("uncategorized_category_id")) {
|
||||||
|
category = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (category) {
|
||||||
|
opts.catLink = categoryBadgeHTML(category);
|
||||||
|
} else {
|
||||||
|
opts.catLink = "<a href=\"" + Discourse.getURL("/categories") + "\">" + I18n.t("topic.browse_all_categories") + "</a>";
|
||||||
|
}
|
||||||
|
|
||||||
|
const unreadTopics = this.topicTrackingState.countUnread();
|
||||||
|
const newTopics = this.topicTrackingState.countNew();
|
||||||
|
|
||||||
|
if (newTopics + unreadTopics > 0) {
|
||||||
|
const hasBoth = unreadTopics > 0 && newTopics > 0;
|
||||||
|
|
||||||
|
return I18n.messageFormat("topic.read_more_MF", {
|
||||||
|
"BOTH": hasBoth,
|
||||||
|
"UNREAD": unreadTopics,
|
||||||
|
"NEW": newTopics,
|
||||||
|
"CATEGORY": category ? true : false,
|
||||||
|
latestLink: opts.latestLink,
|
||||||
|
catLink: opts.catLink
|
||||||
|
});
|
||||||
|
} else if (category) {
|
||||||
|
return I18n.t("topic.read_more_in_category", opts);
|
||||||
|
} else {
|
||||||
|
return I18n.t("topic.read_more", opts);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
@computed('model')
|
||||||
|
pmPath(model) {
|
||||||
|
return this.currentUser && this.currentUser.pmPath(model);
|
||||||
|
},
|
||||||
|
|
||||||
|
@computed('model')
|
||||||
|
suggestedTitle(model) {
|
||||||
|
return model.get('isPrivateMessage') ?
|
||||||
|
`<i class='private-message-glyph fa fa-envelope'></i> ${I18n.t("suggested_topics.pm_title")}` :
|
||||||
|
I18n.t("suggested_topics.title");
|
||||||
|
},
|
||||||
|
|
||||||
@computed('model.postStream.streamFilters.username_filters')
|
@computed('model.postStream.streamFilters.username_filters')
|
||||||
username_filters: {
|
username_filters: {
|
||||||
set(value) {
|
set(value) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import DiscourseLocation from 'discourse/lib/discourse-location';
|
||||||
import SearchService from 'discourse/services/search';
|
import SearchService from 'discourse/services/search';
|
||||||
import { startTracking, default as TopicTrackingState } from 'discourse/models/topic-tracking-state';
|
import { startTracking, default as TopicTrackingState } from 'discourse/models/topic-tracking-state';
|
||||||
import ScreenTrack from 'discourse/lib/screen-track';
|
import ScreenTrack from 'discourse/lib/screen-track';
|
||||||
|
import TopicFooterButtons from 'discourse/components/topic-footer-buttons';
|
||||||
|
|
||||||
function inject() {
|
function inject() {
|
||||||
const app = arguments[0],
|
const app = arguments[0],
|
||||||
|
@ -70,6 +71,13 @@ export default {
|
||||||
app.register('key-value-store:main', keyValueStore, { instantiate: false });
|
app.register('key-value-store:main', keyValueStore, { instantiate: false });
|
||||||
injectAll(app, 'keyValueStore');
|
injectAll(app, 'keyValueStore');
|
||||||
|
|
||||||
|
Discourse.TopicFooterButtonsView = {
|
||||||
|
reopen(obj) {
|
||||||
|
Ember.warn('`Discourse.TopicFooterButtonsView` is deprecated. Use the `topic-footer-buttons` component instead');
|
||||||
|
TopicFooterButtons.reopen(obj);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
startTracking(topicTrackingState);
|
startTracking(topicTrackingState);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<input {{bind-attr disabled="uploading"}} type="file" accept="image/*" style="visibility: hidden; position: absolute;" />
|
<input {{bind-attr disabled="uploading"}} type="file" accept="image/*" style="visibility: hidden; position: absolute;" />
|
||||||
</label>
|
</label>
|
||||||
{{#if uploading}}
|
{{#if uploading}}
|
||||||
<span>{{i18n 'upload_selector.uploading'}} {{view.uploadProgress}}%</span>
|
<span>{{i18n 'upload_selector.uploading'}} {{uploadProgress}}%</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if imageIsNotASquare}}
|
{{#if imageIsNotASquare}}
|
||||||
<div class="warning">{{i18n 'user.change_avatar.image_is_not_a_square'}}</div>
|
<div class="warning">{{i18n 'user.change_avatar.image_is_not_a_square'}}</div>
|
||||||
|
|
|
@ -15,8 +15,11 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
{{#if editingPermissions}}
|
{{#if editingPermissions}}
|
||||||
{{view 'select' content=category.availableGroups value=selectedGroup}}
|
{{combo-box content=category.availableGroups value=selectedGroup}}
|
||||||
{{view 'select' class="permission-selector" optionValuePath="content.id" optionLabelPath="content.description" content=category.availablePermissions value=selectedPermission}}
|
{{combo-box class="permission-selector"
|
||||||
|
nameProperty="description"
|
||||||
|
content=category.availablePermissions
|
||||||
|
value=selectedPermission}}
|
||||||
<button {{action "addPermission" selectedGroup selectedPermission}} class="btn btn-small">{{i18n 'category.add_permission'}}</button>
|
<button {{action "addPermission" selectedGroup selectedPermission}} class="btn btn-small">{{i18n 'category.add_permission'}}</button>
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#unless category.is_special}}
|
{{#unless category.is_special}}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<p>{{{i18n 'topic.merge_topic.instructions' count=selectedPostsCount}}}</p>
|
<p>{{{i18n 'topic.merge_topic.instructions' count=selectedPostsCount}}}</p>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
{{view "choose-topic" currentTopicId=model.id selectedTopicId=selectedTopicId}}
|
{{choose-topic currentTopicId=model.id selectedTopicId=selectedTopicId}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{{#if controller.link}}
|
{{#if link}}
|
||||||
<h3>{{view.title}}</h3>
|
<h3>{{title}}</h3>
|
||||||
|
|
||||||
{{#if date}}
|
{{#if controller.date}}
|
||||||
<span class="date">{{displayDate}}</span>
|
<span class="date">{{displayDate}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<h1>
|
<h1>
|
||||||
{{#unless model.is_warning}}
|
{{#unless model.is_warning}}
|
||||||
<a href="{{view.pmPath}}">
|
<a href={{pmPath}}>
|
||||||
<span class="private-message-glyph">{{fa-icon "envelope"}}</span>
|
<span class="private-message-glyph">{{fa-icon "envelope"}}</span>
|
||||||
</a>
|
</a>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
@ -62,7 +62,9 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="container posts">
|
<div class="container posts">
|
||||||
{{view "selected-posts"}}
|
<div class='selected-posts {{unless multiSelect 'hidden'}}'>
|
||||||
|
{{partial "selected-posts"}}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<section class="topic-area" id="topic" data-topic-id="{{unbound model.id}}">
|
<section class="topic-area" id="topic" data-topic-id="{{unbound model.id}}">
|
||||||
|
@ -115,12 +117,12 @@
|
||||||
{{#conditional-loading-spinner condition=model.postStream.loadingFilter}}
|
{{#conditional-loading-spinner condition=model.postStream.loadingFilter}}
|
||||||
{{#if loadedAllPosts}}
|
{{#if loadedAllPosts}}
|
||||||
|
|
||||||
{{view "topic-closing" topic=model}}
|
{{topic-closing topic=model}}
|
||||||
{{#if session.showSignupCta}}
|
{{#if session.showSignupCta}}
|
||||||
{{! replace "Log In to Reply" with the infobox }}
|
{{! replace "Log In to Reply" with the infobox }}
|
||||||
{{signup-cta}}
|
{{signup-cta}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{view "topic-footer-buttons" topic=model}}
|
{{topic-footer-buttons topic=model}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if model.pending_posts_count}}
|
{{#if model.pending_posts_count}}
|
||||||
|
@ -137,14 +139,16 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if showSelectedPostsAtBottom}}
|
{{#if showSelectedPostsAtBottom}}
|
||||||
{{view "selected-posts"}}
|
<div class='selected-posts {{unless multiSelect 'hidden'}}'>
|
||||||
|
{{partial "selected-posts"}}
|
||||||
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{plugin-outlet "topic-above-suggested"}}
|
{{plugin-outlet "topic-above-suggested"}}
|
||||||
|
|
||||||
{{#if model.details.suggested_topics.length}}
|
{{#if model.details.suggested_topics.length}}
|
||||||
<div id="suggested-topics">
|
<div id="suggested-topics">
|
||||||
<h3>{{{view.suggestedTitle}}}</h3>
|
<h3>{{{suggestedTitle}}}</h3>
|
||||||
<div class="topics">
|
<div class="topics">
|
||||||
{{#if model.isPrivateMessage}}
|
{{#if model.isPrivateMessage}}
|
||||||
{{basic-topic-list hideCategory="true"
|
{{basic-topic-list hideCategory="true"
|
||||||
|
@ -155,7 +159,7 @@
|
||||||
{{basic-topic-list topics=model.details.suggested_topics postsAction="showTopicEntrance"}}
|
{{basic-topic-list topics=model.details.suggested_topics postsAction="showTopicEntrance"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
<h3>{{{view.browseMoreMessage}}}</h3>
|
<h3>{{{browseMoreMessage}}}</h3>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
export default Ember.View.extend({
|
|
||||||
classNameBindings: ['controller.multiSelect::hidden', ':selected-posts'],
|
|
||||||
templateName: "selected-posts",
|
|
||||||
});
|
|
|
@ -5,16 +5,6 @@ export default Ember.View.extend({
|
||||||
elementId: 'share-link',
|
elementId: 'share-link',
|
||||||
classNameBindings: ['hasLink'],
|
classNameBindings: ['hasLink'],
|
||||||
|
|
||||||
title: function() {
|
|
||||||
if (this.get('controller.type') === 'topic') return I18n.t('share.topic');
|
|
||||||
var postNumber = this.get('controller.postNumber');
|
|
||||||
if (postNumber) {
|
|
||||||
return I18n.t('share.post', {postNumber: this.get('controller.postNumber')});
|
|
||||||
} else {
|
|
||||||
return I18n.t('share.topic');
|
|
||||||
}
|
|
||||||
}.property('controller.type', 'controller.postNumber'),
|
|
||||||
|
|
||||||
hasLink: function() {
|
hasLink: function() {
|
||||||
if (!Ember.isEmpty(this.get('controller.link'))) return 'visible';
|
if (!Ember.isEmpty(this.get('controller.link'))) return 'visible';
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import AddCategoryClass from 'discourse/mixins/add-category-class';
|
import AddCategoryClass from 'discourse/mixins/add-category-class';
|
||||||
import AddArchetypeClass from 'discourse/mixins/add-archetype-class';
|
import AddArchetypeClass from 'discourse/mixins/add-archetype-class';
|
||||||
import ClickTrack from 'discourse/lib/click-track';
|
import ClickTrack from 'discourse/lib/click-track';
|
||||||
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
|
||||||
import Scrolling from 'discourse/mixins/scrolling';
|
import Scrolling from 'discourse/mixins/scrolling';
|
||||||
|
|
||||||
const TopicView = Ember.View.extend(AddCategoryClass, AddArchetypeClass, Scrolling, {
|
const TopicView = Ember.View.extend(AddCategoryClass, AddArchetypeClass, Scrolling, {
|
||||||
|
@ -134,60 +133,7 @@ const TopicView = Ember.View.extend(AddCategoryClass, AddArchetypeClass, Scrolli
|
||||||
|
|
||||||
// Trigger a scrolled event
|
// Trigger a scrolled event
|
||||||
this.appEvents.trigger('topic:scrolled', offset);
|
this.appEvents.trigger('topic:scrolled', offset);
|
||||||
},
|
|
||||||
|
|
||||||
pmPath: function() {
|
|
||||||
var currentUser = this.get('controller.currentUser');
|
|
||||||
return currentUser && currentUser.pmPath(this.get('topic'));
|
|
||||||
}.property(),
|
|
||||||
|
|
||||||
browseMoreMessage: function() {
|
|
||||||
|
|
||||||
// TODO decide what to show for pms
|
|
||||||
if (this.get('topic.isPrivateMessage')) {
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var opts = { latestLink: "<a href=\"" + Discourse.getURL("/latest") + "\">" + I18n.t("topic.view_latest_topics") + "</a>" },
|
|
||||||
category = this.get('topic.category');
|
|
||||||
|
|
||||||
if(category && Em.get(category, 'id') === Discourse.Site.currentProp("uncategorized_category_id")) {
|
|
||||||
category = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (category) {
|
|
||||||
opts.catLink = categoryBadgeHTML(category);
|
|
||||||
} else {
|
|
||||||
opts.catLink = "<a href=\"" + Discourse.getURL("/categories") + "\">" + I18n.t("topic.browse_all_categories") + "</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
const tracking = this.get('topicTrackingState'),
|
|
||||||
unreadTopics = tracking.countUnread(),
|
|
||||||
newTopics = tracking.countNew();
|
|
||||||
|
|
||||||
if (newTopics + unreadTopics > 0) {
|
|
||||||
const hasBoth = unreadTopics > 0 && newTopics > 0;
|
|
||||||
|
|
||||||
return I18n.messageFormat("topic.read_more_MF", {
|
|
||||||
"BOTH": hasBoth,
|
|
||||||
"UNREAD": unreadTopics,
|
|
||||||
"NEW": newTopics,
|
|
||||||
"CATEGORY": category ? true : false,
|
|
||||||
latestLink: opts.latestLink,
|
|
||||||
catLink: opts.catLink
|
|
||||||
});
|
|
||||||
} else if (category) {
|
|
||||||
return I18n.t("topic.read_more_in_category", opts);
|
|
||||||
} else {
|
|
||||||
return I18n.t("topic.read_more", opts);
|
|
||||||
}
|
|
||||||
}.property('topicTrackingState.messageCount', 'topic'),
|
|
||||||
|
|
||||||
suggestedTitle: function(){
|
|
||||||
return this.get('controller.model.isPrivateMessage') ?
|
|
||||||
"<i class='private-message-glyph fa fa-envelope'></i> " + I18n.t("suggested_topics.pm_title") :
|
|
||||||
I18n.t("suggested_topics.title");
|
|
||||||
}.property('topic')
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function highlight(postNumber) {
|
function highlight(postNumber) {
|
||||||
|
|
Loading…
Reference in New Issue