Deprecation: `{{view}}` helper
This commit is contained in:
parent
1714019cf7
commit
c15ade8a88
|
@ -23,7 +23,7 @@
|
|||
|
||||
<div>
|
||||
<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
|
||||
content=badgeTypes
|
||||
optionValuePath="content.id"
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
<div>
|
||||
<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
|
||||
content=badgeGroupings
|
||||
optionValuePath="content.id"
|
||||
|
@ -89,7 +89,7 @@
|
|||
|
||||
<div>
|
||||
<label for="trigger">{{i18n 'admin.badges.trigger'}}</label>
|
||||
{{view "select" name="trigger"
|
||||
{{combo-box name="trigger"
|
||||
value=buffered.trigger
|
||||
content=badgeTriggers
|
||||
optionValuePath="content.id"
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
{{view 'screened-emails-list' content=controller}}
|
||||
{{screened-emails-list content=controller}}
|
||||
</div>
|
||||
|
||||
{{else}}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
{{view 'screened-ip-addresses-list' content=controller}}
|
||||
{{screened-ip-addresses-list content=controller}}
|
||||
</div>
|
||||
|
||||
{{else}}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
{{view 'screened-urls-list' content=controller}}
|
||||
{{screened-urls-list content=controller}}
|
||||
</div>
|
||||
{{else}}
|
||||
{{i18n 'search.no_results'}}
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
{{#conditional-loading-spinner condition=loading}}
|
||||
{{#if model.length}}
|
||||
{{view "staff-action-logs-list" content=controller}}
|
||||
{{staff-action-logs-list content=controller}}
|
||||
{{else}}
|
||||
{{i18n 'search.no_results'}}
|
||||
{{/if}}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<div class="col heading actions"></div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
{{view 'permalinks-list' content=controller}}
|
||||
{{permalinks-list content=controller}}
|
||||
</div>
|
||||
{{else}}
|
||||
{{i18n 'search.no_results'}}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
import debounce from 'discourse/lib/debounce';
|
||||
import { searchForTerm } from 'discourse/lib/search';
|
||||
|
||||
export default Ember.View.extend({
|
||||
templateName: 'choose_topic',
|
||||
|
||||
export default Ember.Component.extend({
|
||||
topicTitleChanged: function() {
|
||||
this.setProperties({
|
||||
loading: true,
|
|
@ -17,7 +17,7 @@ export default buildCategoryPanel('security', {
|
|||
if (!this.get('category.is_special')) {
|
||||
this.get('category').addPermission({
|
||||
group_name: group + "",
|
||||
permission: PermissionType.create({id})
|
||||
permission: PermissionType.create({ id: parseInt(id) })
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import StringBuffer from 'discourse/mixins/string-buffer';
|
||||
|
||||
export default Ember.View.extend(StringBuffer, {
|
||||
export default Ember.Component.extend(StringBuffer, {
|
||||
elementId: 'topic-closing-info',
|
||||
delayedRerender: null,
|
||||
|
||||
|
@ -9,7 +9,7 @@ export default Ember.View.extend(StringBuffer, {
|
|||
'topic.details.auto_close_based_on_last_post',
|
||||
'topic.details.auto_close_hours'],
|
||||
|
||||
renderString: function(buffer) {
|
||||
renderString(buffer) {
|
||||
if (!!Ember.isEmpty(this.get('topic.details.auto_close_at'))) 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));
|
||||
},
|
||||
|
||||
willDestroyElement: function() {
|
||||
willDestroyElement() {
|
||||
if( this.delayedRerender ) {
|
||||
Em.run.cancel(this.get('delayedRerender'));
|
||||
}
|
|
@ -1,22 +1,33 @@
|
|||
import Sharing from 'discourse/lib/sharing';
|
||||
import { longDateNoYear } from 'discourse/lib/formatter';
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic'],
|
||||
title: Ember.computed.alias('controllers.topic.model.title'),
|
||||
|
||||
displayDate: function() {
|
||||
return longDateNoYear(new Date(this.get('date')));
|
||||
}.property('date'),
|
||||
@computed('type', 'postNumber')
|
||||
title(type, postNumber) {
|
||||
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
|
||||
actions: {
|
||||
close: function() {
|
||||
close() {
|
||||
this.setProperties({ link: '', postNumber: '' });
|
||||
return false;
|
||||
},
|
||||
|
||||
share: function(source) {
|
||||
share(source) {
|
||||
var url = source.generateUrl(this.get('link'), this.get('title'));
|
||||
if (source.shouldOpenInPopup) {
|
||||
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);
|
||||
}.property()
|
||||
}
|
||||
});
|
||||
|
|
|
@ -7,6 +7,7 @@ import { popupAjaxError } from 'discourse/lib/ajax-error';
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import Composer from 'discourse/models/composer';
|
||||
import DiscourseURL from 'discourse/lib/url';
|
||||
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
||||
|
||||
export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
|
||||
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')
|
||||
username_filters: {
|
||||
set(value) {
|
||||
|
|
|
@ -7,6 +7,7 @@ import DiscourseLocation from 'discourse/lib/discourse-location';
|
|||
import SearchService from 'discourse/services/search';
|
||||
import { startTracking, default as TopicTrackingState } from 'discourse/models/topic-tracking-state';
|
||||
import ScreenTrack from 'discourse/lib/screen-track';
|
||||
import TopicFooterButtons from 'discourse/components/topic-footer-buttons';
|
||||
|
||||
function inject() {
|
||||
const app = arguments[0],
|
||||
|
@ -70,6 +71,13 @@ export default {
|
|||
app.register('key-value-store:main', keyValueStore, { instantiate: false });
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<input {{bind-attr disabled="uploading"}} type="file" accept="image/*" style="visibility: hidden; position: absolute;" />
|
||||
</label>
|
||||
{{#if uploading}}
|
||||
<span>{{i18n 'upload_selector.uploading'}} {{view.uploadProgress}}%</span>
|
||||
<span>{{i18n 'upload_selector.uploading'}} {{uploadProgress}}%</span>
|
||||
{{/if}}
|
||||
{{#if imageIsNotASquare}}
|
||||
<div class="warning">{{i18n 'user.change_avatar.image_is_not_a_square'}}</div>
|
||||
|
|
|
@ -15,8 +15,11 @@
|
|||
{{/each}}
|
||||
</ul>
|
||||
{{#if editingPermissions}}
|
||||
{{view 'select' content=category.availableGroups value=selectedGroup}}
|
||||
{{view 'select' class="permission-selector" optionValuePath="content.id" optionLabelPath="content.description" content=category.availablePermissions value=selectedPermission}}
|
||||
{{combo-box content=category.availableGroups value=selectedGroup}}
|
||||
{{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>
|
||||
{{else}}
|
||||
{{#unless category.is_special}}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<p>{{{i18n 'topic.merge_topic.instructions' count=selectedPostsCount}}}</p>
|
||||
|
||||
<form>
|
||||
{{view "choose-topic" currentTopicId=model.id selectedTopicId=selectedTopicId}}
|
||||
{{choose-topic currentTopicId=model.id selectedTopicId=selectedTopicId}}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{#if controller.link}}
|
||||
<h3>{{view.title}}</h3>
|
||||
{{#if link}}
|
||||
<h3>{{title}}</h3>
|
||||
|
||||
{{#if date}}
|
||||
{{#if controller.date}}
|
||||
<span class="date">{{displayDate}}</span>
|
||||
{{/if}}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
{{else}}
|
||||
<h1>
|
||||
{{#unless model.is_warning}}
|
||||
<a href="{{view.pmPath}}">
|
||||
<a href={{pmPath}}>
|
||||
<span class="private-message-glyph">{{fa-icon "envelope"}}</span>
|
||||
</a>
|
||||
{{/unless}}
|
||||
|
@ -62,7 +62,9 @@
|
|||
{{/if}}
|
||||
|
||||
<div class="container posts">
|
||||
{{view "selected-posts"}}
|
||||
<div class='selected-posts {{unless multiSelect 'hidden'}}'>
|
||||
{{partial "selected-posts"}}
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<section class="topic-area" id="topic" data-topic-id="{{unbound model.id}}">
|
||||
|
@ -115,12 +117,12 @@
|
|||
{{#conditional-loading-spinner condition=model.postStream.loadingFilter}}
|
||||
{{#if loadedAllPosts}}
|
||||
|
||||
{{view "topic-closing" topic=model}}
|
||||
{{topic-closing topic=model}}
|
||||
{{#if session.showSignupCta}}
|
||||
{{! replace "Log In to Reply" with the infobox }}
|
||||
{{signup-cta}}
|
||||
{{else}}
|
||||
{{view "topic-footer-buttons" topic=model}}
|
||||
{{topic-footer-buttons topic=model}}
|
||||
{{/if}}
|
||||
|
||||
{{#if model.pending_posts_count}}
|
||||
|
@ -137,14 +139,16 @@
|
|||
{{/if}}
|
||||
|
||||
{{#if showSelectedPostsAtBottom}}
|
||||
{{view "selected-posts"}}
|
||||
<div class='selected-posts {{unless multiSelect 'hidden'}}'>
|
||||
{{partial "selected-posts"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet "topic-above-suggested"}}
|
||||
|
||||
{{#if model.details.suggested_topics.length}}
|
||||
<div id="suggested-topics">
|
||||
<h3>{{{view.suggestedTitle}}}</h3>
|
||||
<h3>{{{suggestedTitle}}}</h3>
|
||||
<div class="topics">
|
||||
{{#if model.isPrivateMessage}}
|
||||
{{basic-topic-list hideCategory="true"
|
||||
|
@ -155,7 +159,7 @@
|
|||
{{basic-topic-list topics=model.details.suggested_topics postsAction="showTopicEntrance"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
<h3>{{{view.browseMoreMessage}}}</h3>
|
||||
<h3>{{{browseMoreMessage}}}</h3>
|
||||
</div>
|
||||
{{/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',
|
||||
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() {
|
||||
if (!Ember.isEmpty(this.get('controller.link'))) return 'visible';
|
||||
return null;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import AddCategoryClass from 'discourse/mixins/add-category-class';
|
||||
import AddArchetypeClass from 'discourse/mixins/add-archetype-class';
|
||||
import ClickTrack from 'discourse/lib/click-track';
|
||||
import { categoryBadgeHTML } from 'discourse/helpers/category-link';
|
||||
import Scrolling from 'discourse/mixins/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
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue