mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 17:47:01 +08:00
Fixes some deprecations
This commit is contained in:
parent
8294205f7c
commit
690b579a96
|
@ -2,10 +2,7 @@ var get = Ember.get;
|
|||
|
||||
export default Ember.Component.extend({
|
||||
classNameBindings: ['category::no-category', 'categories:has-drop','categoryStyle'],
|
||||
|
||||
categoryStyle: function(){
|
||||
return Discourse.SiteSettings.category_style;
|
||||
}.property(),
|
||||
categoryStyle: Discourse.computed.setting('category_style'),
|
||||
|
||||
tagName: 'li',
|
||||
|
||||
|
@ -50,11 +47,11 @@ export default Ember.Component.extend({
|
|||
if (color) {
|
||||
var style = "";
|
||||
if (color) { style += "background-color: #" + color + ";" }
|
||||
return style;
|
||||
return style.htmlSafe();
|
||||
}
|
||||
}
|
||||
|
||||
return "background-color: #eee;";
|
||||
return "background-color: #eee;".htmlSafe();
|
||||
}.property('category'),
|
||||
|
||||
badgeStyle: function() {
|
||||
|
@ -68,11 +65,11 @@ export default Ember.Component.extend({
|
|||
var style = "";
|
||||
if (color) { style += "background-color: #" + color + "; border-color: #" + color + ";"; }
|
||||
if (textColor) { style += "color: #" + textColor + "; "; }
|
||||
return style;
|
||||
return style.htmlSafe();
|
||||
}
|
||||
}
|
||||
|
||||
return "background-color: #eee; color: #333";
|
||||
return "background-color: #eee; color: #333".htmlSafe();
|
||||
}.property('category'),
|
||||
|
||||
clickEventName: function() {
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
faqOverriden: Ember.computed.gt('siteSettings.faq_url.length', 0),
|
||||
|
||||
contactInfo: function() {
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
/**
|
||||
Controller for showing a particular badge.
|
||||
|
||||
@class BadgesShowController
|
||||
@extends ObjectController
|
||||
@namespace Discourse
|
||||
@module Discourse
|
||||
**/
|
||||
export default ObjectController.extend({
|
||||
noMoreBadges: false,
|
||||
userBadges: null,
|
||||
needs: ["application"],
|
||||
|
||||
actions: {
|
||||
loadMore: function() {
|
||||
var self = this;
|
||||
var userBadges = this.get('userBadges');
|
||||
loadMore() {
|
||||
const self = this;
|
||||
const userBadges = this.get('userBadges');
|
||||
|
||||
Discourse.UserBadge.findByBadgeId(this.get('model.id'), {
|
||||
offset: userBadges.length
|
||||
}).then(function(userBadges) {
|
||||
self.get('userBadges').pushObjects(userBadges);
|
||||
}).then(function(result) {
|
||||
userBadges.pushObjects(result);
|
||||
if(userBadges.length === 0){
|
||||
self.set('noMoreBadges', true);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['navigation/category', 'discovery/topics', 'application'],
|
||||
loading: false,
|
||||
|
||||
category: Em.computed.alias('controllers.navigation/category.category'),
|
||||
noSubcategories: Em.computed.alias('controllers.navigation/category.noSubcategories'),
|
||||
|
||||
loadedAllItems: Em.computed.not("controllers.discovery/topics.canLoadMore"),
|
||||
loadedAllItems: Em.computed.not("controllers.discovery/topics.model.canLoadMore"),
|
||||
|
||||
_showFooter: function() {
|
||||
this.set("controllers.application.showFooter", this.get("loadedAllItems"));
|
||||
|
|
|
@ -13,6 +13,7 @@ var controllerOpts = {
|
|||
|
||||
order: 'default',
|
||||
ascending: false,
|
||||
expandGloballyPinned: false,
|
||||
|
||||
actions: {
|
||||
|
||||
|
@ -80,6 +81,7 @@ var controllerOpts = {
|
|||
}.property(),
|
||||
|
||||
isFilterPage: function(filter, filterType) {
|
||||
if (!filter) { return false; }
|
||||
return filter.match(new RegExp(filterType + '$', 'gi')) ? true : false;
|
||||
},
|
||||
|
||||
|
@ -92,15 +94,15 @@ var controllerOpts = {
|
|||
}.property('filter', 'topics.length'),
|
||||
|
||||
showDismissAtTop: function() {
|
||||
return (this.isFilterPage(this.get('filter'), 'new') ||
|
||||
this.isFilterPage(this.get('filter'), 'unread')) &&
|
||||
this.get('topics.length') >= 30;
|
||||
}.property('filter', 'topics.length'),
|
||||
return (this.isFilterPage(this.get('model.filter'), 'new') ||
|
||||
this.isFilterPage(this.get('model.filter'), 'unread')) &&
|
||||
this.get('model.topics.length') >= 30;
|
||||
}.property('model.filter', 'model.topics.length'),
|
||||
|
||||
hasTopics: Em.computed.gt('topics.length', 0),
|
||||
allLoaded: Em.computed.empty('more_topics_url'),
|
||||
latest: Discourse.computed.endWith('filter', 'latest'),
|
||||
new: Discourse.computed.endWith('filter', 'new'),
|
||||
hasTopics: Em.computed.gt('model.topics.length', 0),
|
||||
allLoaded: Em.computed.empty('model.more_topics_url'),
|
||||
latest: Discourse.computed.endWith('model.filter', 'latest'),
|
||||
new: Discourse.computed.endWith('model.filter', 'new'),
|
||||
top: Em.computed.notEmpty('period'),
|
||||
yearly: Em.computed.equal('period', 'yearly'),
|
||||
monthly: Em.computed.equal('period', 'monthly'),
|
||||
|
@ -114,7 +116,7 @@ var controllerOpts = {
|
|||
if( category ) {
|
||||
return I18n.t('topics.bottom.category', {category: category.get('name')});
|
||||
} else {
|
||||
var split = this.get('filter').split('/');
|
||||
var split = (this.get('filter') || '').split('/');
|
||||
if (this.get('topics.length') === 0) {
|
||||
return I18n.t("topics.none." + split[0], {
|
||||
category: split[1]
|
||||
|
@ -130,7 +132,7 @@ var controllerOpts = {
|
|||
footerEducation: function() {
|
||||
if (!this.get('allLoaded') || this.get('topics.length') > 0 || !Discourse.User.current()) { return; }
|
||||
|
||||
var split = this.get('filter').split('/');
|
||||
var split = (this.get('filter') || '').split('/');
|
||||
|
||||
if (split[0] !== 'new' && split[0] !== 'unread') { return; }
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
export default Em.ObjectController.extend({
|
||||
showLoginButton: Em.computed.equal('path', 'login'),
|
||||
export default Ember.Controller.extend({
|
||||
showLoginButton: Em.computed.equal('model.path', 'login'),
|
||||
|
||||
actions: {
|
||||
markFaqRead: function() {
|
||||
if (Discourse.User.current()) {
|
||||
if (this.currentUser) {
|
||||
Discourse.ajax("/users/read-faq", { method: "POST" });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ function entranceDate(dt, showTime) {
|
|||
);
|
||||
}
|
||||
|
||||
export default Ember.ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
position: null,
|
||||
|
||||
createdDate: function() {
|
||||
|
@ -51,11 +51,11 @@ export default Ember.ObjectController.extend({
|
|||
},
|
||||
|
||||
enterTop: function() {
|
||||
Discourse.URL.routeTo(this.get('url'));
|
||||
Discourse.URL.routeTo(this.get('model.url'));
|
||||
},
|
||||
|
||||
enterBottom: function() {
|
||||
Discourse.URL.routeTo(this.get('lastPostUrl'));
|
||||
Discourse.URL.routeTo(this.get('model.lastPostUrl'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import ObjectController from 'discourse/controllers/object';
|
||||
|
||||
export default ObjectController.extend({
|
||||
export default Ember.Controller.extend({
|
||||
needs: ['topic', 'application'],
|
||||
visible: false,
|
||||
user: null,
|
||||
|
|
|
@ -19,9 +19,12 @@ export default Ember.Mixin.create({
|
|||
},
|
||||
|
||||
_rerenderString() {
|
||||
const $sel = this.$();
|
||||
if ($sel) { return; }
|
||||
|
||||
const buffer = [];
|
||||
this.renderString(buffer);
|
||||
this.$().html(buffer.join(''));
|
||||
$sel.html(buffer.join(''));
|
||||
},
|
||||
|
||||
rerenderString() {
|
||||
|
|
|
@ -2,7 +2,7 @@ const rootURL = Discourse.BaseUri && Discourse.BaseUri !== "/" ? Discourse.BaseU
|
|||
|
||||
const Router = Ember.Router.extend({
|
||||
rootURL,
|
||||
location: Ember.Test ? 'none': 'discourse-location'
|
||||
location: Ember.testing ? 'none': 'discourse-location'
|
||||
});
|
||||
|
||||
export function mapRoutes() {
|
||||
|
|
|
@ -14,15 +14,15 @@
|
|||
</ul>
|
||||
|
||||
<section class='about'>
|
||||
<h2>{{i18n 'about.title' title=title}}</h2>
|
||||
<p>{{description}}</p>
|
||||
<h2>{{i18n 'about.title' title=model.title}}</h2>
|
||||
<p>{{model.description}}</p>
|
||||
</section>
|
||||
|
||||
{{#if admins}}
|
||||
{{#if model.admins}}
|
||||
<section class='about admins'>
|
||||
<h3>{{i18n 'about.our_admins'}}</h3>
|
||||
|
||||
{{#each a in admins}}
|
||||
{{#each a in model.admins}}
|
||||
{{user-small user=a}}
|
||||
{{/each}}
|
||||
<div class='clearfix'></div>
|
||||
|
@ -30,12 +30,12 @@
|
|||
</section>
|
||||
{{/if}}
|
||||
|
||||
{{#if moderators}}
|
||||
{{#if model.moderators}}
|
||||
<section class='about moderators'>
|
||||
<h3>{{i18n 'about.our_moderators'}}</h3>
|
||||
|
||||
<div class='users'>
|
||||
{{#each m in moderators}}
|
||||
{{#each m in model.moderators}}
|
||||
{{user-small user=m}}
|
||||
{{/each}}
|
||||
</div>
|
||||
|
@ -55,33 +55,33 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class='title'>{{i18n 'about.topic_count'}}</td>
|
||||
<td>{{number stats.topic_count}}</td>
|
||||
<td>{{number stats.topics_7_days}}</td>
|
||||
<td>{{number stats.topics_30_days}}</td>
|
||||
<td>{{number model.stats.topic_count}}</td>
|
||||
<td>{{number model.stats.topics_7_days}}</td>
|
||||
<td>{{number model.stats.topics_30_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n 'about.post_count'}}</td>
|
||||
<td>{{number stats.post_count}}</td>
|
||||
<td>{{number stats.posts_7_days}}</td>
|
||||
<td>{{number stats.posts_30_days}}</td>
|
||||
<td>{{number model.stats.post_count}}</td>
|
||||
<td>{{number model.stats.posts_7_days}}</td>
|
||||
<td>{{number model.stats.posts_30_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n 'about.user_count'}}</td>
|
||||
<td>{{number stats.user_count}}</td>
|
||||
<td>{{number stats.users_7_days}}</td>
|
||||
<td>{{number stats.users_30_days}}</td>
|
||||
<td>{{number model.stats.user_count}}</td>
|
||||
<td>{{number model.stats.users_7_days}}</td>
|
||||
<td>{{number model.stats.users_30_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n 'about.active_user_count'}}</td>
|
||||
<td>—</td>
|
||||
<td>{{number stats.active_users_7_days}}</td>
|
||||
<td>{{number stats.active_users_30_days}}</td>
|
||||
<td>{{number model.stats.active_users_7_days}}</td>
|
||||
<td>{{number model.stats.active_users_30_days}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{i18n 'about.like_count'}}</td>
|
||||
<td>{{number stats.like_count}}</td>
|
||||
<td>{{number stats.likes_7_days}}</td>
|
||||
<td>{{number stats.likes_30_days}}</td>
|
||||
<td>{{number model.stats.like_count}}</td>
|
||||
<td>{{number model.stats.likes_7_days}}</td>
|
||||
<td>{{number model.stats.likes_30_days}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<div class='container show-badge'>
|
||||
<h1>
|
||||
{{#link-to 'badges.index'}}{{i18n 'badges.title'}}{{/link-to}}
|
||||
<i class='fa fa-angle-right'></i>
|
||||
{{displayName}}
|
||||
{{fa-icon "angle-right"}}
|
||||
{{model.displayName}}
|
||||
</h1>
|
||||
|
||||
<table class='badges-listing'>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class='badge'>{{user-badge badge=this}}</td>
|
||||
<td class='description'>{{{displayDescriptionHtml}}}</td>
|
||||
<td class='grant-count'>{{i18n 'badges.granted' count=grant_count}}</td>
|
||||
<td class='badge'>{{user-badge badge=model}}</td>
|
||||
<td class='description'>{{{model.displayDescriptionHtml}}}</td>
|
||||
<td class='grant-count'>{{i18n 'badges.granted' count=model.grant_count}}</td>
|
||||
<td class='info'>{{i18n 'badges.allow_title'}} {{{view.allowTitle}}}<br>{{i18n 'badges.multiple_grant'}} {{{view.multipleGrant}}}
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{{#if category}}
|
||||
<a href {{action "expand"}} class="badge-category" {{bind-attr style="badgeStyle"}}>
|
||||
<span class="badge-category-bg" {{bind-attr style="categoryColor"}}></span>
|
||||
<a href {{action "expand"}} class="badge-category" style={{badgeStyle}}>
|
||||
<span class="badge-category-bg" style={{categoryColor}}></span>
|
||||
{{#if category.read_restricted}}
|
||||
{{fa-icon "lock"}}
|
||||
{{/if}}
|
||||
|
@ -8,14 +8,14 @@
|
|||
</a>
|
||||
{{else}}
|
||||
{{#if noSubcategories}}
|
||||
<a href {{action "expand"}} class='badge-category home' {{bind-attr style="badgeStyle"}}>{{i18n 'categories.no_subcategory'}}</a>
|
||||
<a href {{action "expand"}} class='badge-category home' style={{badgeStyle}}>{{i18n 'categories.no_subcategory'}}</a>
|
||||
{{else}}
|
||||
<a href {{action "expand"}} class='badge-category home' {{bind-attr style="badgeStyle"}}>{{allCategoriesLabel}}</a>
|
||||
<a href {{action "expand"}} class='badge-category home' style={{badgeStyle}}>{{allCategoriesLabel}}</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
{{#if categories}}
|
||||
<a href {{action "expand"}} {{bind-attr class="dropdownButtonClass" style="badgeStyle"}}><i {{bind-attr class="iconClass"}}></i></a>
|
||||
<a href {{action "expand"}} class={{dropdownButtonClass}} style={{badgeStyle}}><i class={{iconClass}}></i></a>
|
||||
<section {{bind-attr class="expanded::hidden :category-dropdown-menu :chooser"}}>
|
||||
<div class='cat'><a {{bind-attr href=allCategoriesUrl}} data-drop-close="true" class='badge-category home'>{{allCategoriesLabel}}</a></div>
|
||||
{{#if subCategory}}
|
||||
|
|
|
@ -39,19 +39,19 @@
|
|||
canBulkSelect=canBulkSelect
|
||||
changeSort="changeSort"
|
||||
toggleBulkSelect="toggleBulkSelect"
|
||||
hideCategory=hideCategory
|
||||
hideCategory=model.hideCategory
|
||||
order=order
|
||||
ascending=ascending
|
||||
bulkSelectEnabled=bulkSelectEnabled
|
||||
selected=selected
|
||||
expandGloballyPinned=expandGloballyPinned
|
||||
expandAllPinned=expandAllPinned
|
||||
topics=topics}}
|
||||
expandAllPinned=model.expandAllPinned
|
||||
topics=model.topics}}
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
<footer class='topic-list-bottom'>
|
||||
{{conditional-loading-spinner condition=loadingMore}}
|
||||
{{conditional-loading-spinner condition=model.loadingMore}}
|
||||
{{#if allLoaded}}
|
||||
{{#if showDismissRead}}
|
||||
<button title="{{i18n 'topics.bulk.dismiss_topics_tooltip'}}" id='dismiss-topics' class='btn dismiss-read' {{action "dismissRead" "topics"}}>{{i18n 'topics.bulk.dismiss_topics'}}</button>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<div class='container'>
|
||||
<div class='contents clearfix body-page'>
|
||||
{{{html}}}
|
||||
{{{model.html}}}
|
||||
|
||||
{{#if showLoginButton}}
|
||||
<button class="btn btn-primary" {{action "showLogin"}}><i class="fa fa-user"></i>{{i18n 'log_in'}}</button>
|
||||
<button class="btn btn-primary" {{action "showLogin"}}>{{fa-icon "user"}}{{i18n 'log_in'}}</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user