Remove more views and deprecations.

This commit is contained in:
Robin Ward 2016-04-28 16:13:34 -04:00
parent 04ec679d82
commit 187d7d6f96
No known key found for this signature in database
GPG Key ID: 0E091E2B4ED1B83D
19 changed files with 216 additions and 285 deletions

View File

@ -3,8 +3,6 @@ import LoadMore from "discourse/mixins/load-more";
import UrlRefresh from 'discourse/mixins/url-refresh';
const DiscoveryTopicsListComponent = Ember.Component.extend(UrlRefresh, LoadMore, {
_viaComponent: true,
classNames: ['contents'],
eyelineSelector: '.topic-list-item',

View File

@ -1,8 +1,6 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.Component.extend(LoadMore, {
_viaComponent: true,
init() {
this._super();
this.set('eyelineSelector', this.get('selector'));

View File

@ -0,0 +1,24 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.Component.extend(LoadMore, {
loading: false,
eyelineSelector: '.user-stream .item',
classNames: ['user-stream'],
_scrollTopOnModelChange: function() {
Em.run.schedule('afterRender', () => $(document).scrollTop(0));
}.observes('stream.user.id'),
actions: {
loadMore() {
if (this.get('loading')) { return; }
this.set('loading', true);
const stream = this.get('stream');
stream.findItems().then(() => {
this.set('loading', false);
this.get('eyeline').flushRest();
});
}
}
});

View File

@ -151,11 +151,13 @@ export default Ember.DefaultResolver.extend({
const withoutType = parsedName.fullNameWithoutType,
slashedType = withoutType.replace(/\./g, '/'),
decamelized = withoutType.decamelize(),
dashed = decamelized.replace(/\./g, '-').replace(/\_/g, '-'),
templates = Ember.TEMPLATES;
return this._super(parsedName) ||
templates[slashedType] ||
templates[withoutType] ||
templates[dashed] ||
templates[decamelized.replace(/\./, '/')] ||
templates[decamelized.replace(/\_/, '/')] ||
this.findAdminTemplate(parsedName) ||

View File

@ -49,7 +49,7 @@ class PluginApi {
if (!opts.onlyStream) {
decorate(ComposerEditor, 'previewRefreshed', callback);
decorate(this.container.lookupFactory('view:user-stream'), 'didInsertElement', callback);
decorate(this.container.lookupFactory('component:user-stream'), 'didInsertElement', callback);
}
}

View File

@ -5,14 +5,6 @@ import { on } from 'ember-addons/ember-computed-decorators';
// Provides the ability to load more items for a view which is scrolled to the bottom.
export default Ember.Mixin.create(Ember.ViewTargetActionSupport, Scrolling, {
init() {
this._super();
if (!this._viaComponent) {
console.warn('Using `LoadMore` as a view mixin is deprecated. Use `{{load-more}}` instead');
}
},
scrolled() {
const eyeline = this.get('eyeline');
return eyeline && eyeline.update();

View File

@ -1,100 +1,102 @@
{{#if canInviteToForum}}
<section class='user-content'>
<h2>{{i18n 'user.invited.title'}}</h2>
{{#load-more class="paginated-topics-list" selector=".paginated-topics-list .user-invite-list tr" action="loadMore"}}
<section class='user-content'>
<h2>{{i18n 'user.invited.title'}}</h2>
{{#if model.can_see_invite_details}}
<div class='user-invite-controls'>
<div class='span15'>
<ul class="nav nav-pills">
{{nav-item route='userInvited.show' routeParam='pending' i18nLabel=pendingLabel}}
{{nav-item route='userInvited.show' routeParam='redeemed' i18nLabel=redeemedLabel}}
</ul>
</div>
{{#if model.can_see_invite_details}}
<div class='user-invite-controls'>
<div class='span15'>
<ul class="nav nav-pills">
{{nav-item route='userInvited.show' routeParam='pending' i18nLabel=pendingLabel}}
{{nav-item route='userInvited.show' routeParam='redeemed' i18nLabel=redeemedLabel}}
</ul>
</div>
<div class="pull-right">
{{d-button icon="plus" action="showInvite" label="user.invited.create" class="btn"}}
{{#if canBulkInvite}}
{{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
{{/if}}
</div>
</div>
{{/if}}
{{#if showSearch}}
<div class="user-invite-search">
<form>{{text-field value=searchTerm placeholderKey="user.invited.search"}}</form>
</div>
{{/if}}
{{#if model.invites}}
<table class='table user-invite-list'>
<tr>
{{#if inviteRedeemed}}
<th>{{i18n 'user.invited.user'}}</th>
<th>{{i18n 'user.invited.redeemed_at'}}</th>
{{#if model.can_see_invite_details}}
<th>{{i18n 'user.last_seen'}}</th>
<th>{{i18n 'user.invited.topics_entered'}}</th>
<th>{{i18n 'user.invited.posts_read_count'}}</th>
<th>{{i18n 'user.invited.time_read'}}</th>
<th>{{i18n 'user.invited.days_visited'}}</th>
<div class="pull-right">
{{d-button icon="plus" action="showInvite" label="user.invited.create" class="btn"}}
{{#if canBulkInvite}}
{{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
{{/if}}
{{else}}
<th colspan="1">{{i18n 'user.invited.user'}}</th>
<th colspan="6">{{i18n 'user.invited.sent'}}</th>
{{/if}}
</tr>
{{#each invite in model.invites}}
</div>
</div>
{{/if}}
{{#if showSearch}}
<div class="user-invite-search">
<form>{{text-field value=searchTerm placeholderKey="user.invited.search"}}</form>
</div>
{{/if}}
{{#if model.invites}}
<table class='table user-invite-list'>
<tr>
{{#if invite.user}}
<td>
{{#link-to 'user' invite.user}}{{avatar invite.user imageSize="tiny"}}{{/link-to}}
{{#link-to 'user' invite.user}}{{invite.user.username}}{{/link-to}}
</td>
<td>{{format-date invite.redeemed_at}}</td>
{{#if inviteRedeemed}}
<th>{{i18n 'user.invited.user'}}</th>
<th>{{i18n 'user.invited.redeemed_at'}}</th>
{{#if model.can_see_invite_details}}
<td>{{format-date invite.user.last_seen_at}}</td>
<td>{{number invite.user.topics_entered}}</td>
<td>{{number invite.user.posts_read_count}}</td>
<td>{{{unbound invite.user.time_read}}}</td>
<td><span title="{{i18n 'user.invited.days_visited'}}">{{{unbound invite.user.days_visited}}}</span>
/
<span title="{{i18n 'user.invited.account_age_days'}}">{{{unbound invite.user.days_since_created}}}</span></td>
<th>{{i18n 'user.last_seen'}}</th>
<th>{{i18n 'user.invited.topics_entered'}}</th>
<th>{{i18n 'user.invited.posts_read_count'}}</th>
<th>{{i18n 'user.invited.time_read'}}</th>
<th>{{i18n 'user.invited.days_visited'}}</th>
{{/if}}
{{else}}
<td>{{unbound invite.email}}</td>
<td>{{format-date invite.created_at}}</td>
<td colspan='5'>
{{#if invite.expired}}
{{i18n 'user.invited.expired'}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{/if}}
{{#if invite.rescinded}}
{{i18n 'user.invited.rescinded'}}
{{else}}
{{d-button icon="times" action="rescind" actionParam=invite class="btn" label="user.invited.rescind"}}
{{/if}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{#if invite.reinvited}}
{{i18n 'user.invited.reinvited'}}
{{else}}
{{d-button icon="refresh" action="reinvite" actionParam=invite class="btn" label="user.invited.reinvite"}}
{{/if}}
</td>
<th colspan="1">{{i18n 'user.invited.user'}}</th>
<th colspan="6">{{i18n 'user.invited.sent'}}</th>
{{/if}}
</tr>
{{/each}}
</table>
{{conditional-loading-spinner condition=invitesLoading}}
{{#each invite in model.invites}}
<tr>
{{#if invite.user}}
<td>
{{#link-to 'user' invite.user}}{{avatar invite.user imageSize="tiny"}}{{/link-to}}
{{#link-to 'user' invite.user}}{{invite.user.username}}{{/link-to}}
</td>
<td>{{format-date invite.redeemed_at}}</td>
{{#if model.can_see_invite_details}}
<td>{{format-date invite.user.last_seen_at}}</td>
<td>{{number invite.user.topics_entered}}</td>
<td>{{number invite.user.posts_read_count}}</td>
<td>{{{unbound invite.user.time_read}}}</td>
<td><span title="{{i18n 'user.invited.days_visited'}}">{{{unbound invite.user.days_visited}}}</span>
/
<span title="{{i18n 'user.invited.account_age_days'}}">{{{unbound invite.user.days_since_created}}}</span></td>
{{/if}}
{{else}}
<td>{{unbound invite.email}}</td>
<td>{{format-date invite.created_at}}</td>
<td colspan='5'>
{{#if invite.expired}}
{{i18n 'user.invited.expired'}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{/if}}
{{#if invite.rescinded}}
{{i18n 'user.invited.rescinded'}}
{{else}}
{{d-button icon="times" action="rescind" actionParam=invite class="btn" label="user.invited.rescind"}}
{{/if}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{#if invite.reinvited}}
{{i18n 'user.invited.reinvited'}}
{{else}}
{{d-button icon="refresh" action="reinvite" actionParam=invite class="btn" label="user.invited.reinvite"}}
{{/if}}
</td>
{{/if}}
</tr>
{{/each}}
</table>
{{conditional-loading-spinner condition=invitesLoading}}
{{else}}
<div class="user-invite-none">
{{#if canBulkInvite}}
{{{i18n 'user.invited.bulk_invite.none'}}}
{{else}}
{{i18n 'user.invited.none'}}
{{/if}}
</div>
{{/if}}
</section>
{{else}}
<div class="user-invite-none">
{{#if canBulkInvite}}
{{{i18n 'user.invited.bulk_invite.none'}}}
{{else}}
{{i18n 'user.invited.none'}}
{{/if}}
</div>
{{/if}}
</section>
{{/load-more}}
{{/if}}

View File

@ -1,9 +1,10 @@
{{basic-topic-list topicList=model
hideCategory=hideCategory
showParticipants=showParticipants
showPosters=showPosters
canBulkSelect=canBulkSelect
bulkSelectEnabled=bulkSelectEnabled
selected=selected
postsAction="showTopicEntrance"}}
{{#load-more class="paginated-topics-list" selector=".paginated-topics-list .topic-list tr" action="loadMore"}}
{{basic-topic-list topicList=model
hideCategory=hideCategory
showParticipants=showParticipants
showPosters=showPosters
canBulkSelect=canBulkSelect
bulkSelectEnabled=bulkSelectEnabled
selected=selected
postsAction="showTopicEntrance"}}
{{/load-more}}

View File

@ -1,28 +1,30 @@
{{#each p in model.content}}
<div {{bind-attr class=":item p.hidden p.deleted p.moderator_action"}}>
<div class="clearfix info">
<a href="{{unbound p.usernameUrl}}" class="avatar-link">
<div class="avatar-wrapper">
{{avatar p imageSize="large" extraClasses="actor" ignoreTitle="true"}}
</div>
</a>
<span class="time">
{{format-date p.created_at leaveAgo="true"}}
</span>
<span class="title">
<a href="{{unbound p.url}}">{{unbound p.topic_title}}</a>
</span>
<span class="category">
{{category-link p.category}}
</span>
{{#if p.deleted}}
<span class="delete-info">
<i class="fa fa-trash-o"></i> {{avatar p.deleted_by imageSize="tiny" extraClasses="actor" ignoreTitle="true"}} {{format-date p.deleted_at leaveAgo="true"}}
{{#user-stream stream=model}}
{{#each p in model.content}}
<div {{bind-attr class=":item p.hidden p.deleted p.moderator_action"}}>
<div class="clearfix info">
<a href="{{unbound p.usernameUrl}}" class="avatar-link">
<div class="avatar-wrapper">
{{avatar p imageSize="large" extraClasses="actor" ignoreTitle="true"}}
</div>
</a>
<span class="time">
{{format-date p.created_at leaveAgo="true"}}
</span>
{{/if}}
<span class="title">
<a href="{{unbound p.url}}">{{unbound p.topic_title}}</a>
</span>
<span class="category">
{{category-link p.category}}
</span>
{{#if p.deleted}}
<span class="delete-info">
<i class="fa fa-trash-o"></i> {{avatar p.deleted_by imageSize="tiny" extraClasses="actor" ignoreTitle="true"}} {{format-date p.deleted_at leaveAgo="true"}}
</span>
{{/if}}
</div>
<p class="excerpt">
{{{p.excerpt}}}
</p>
</div>
<p class="excerpt">
{{{p.excerpt}}}
</p>
</div>
{{/each}}
{{/each}}
{{/user-stream}}

View File

@ -1,3 +1,5 @@
{{#each model.content as |item|}}
{{stream-item item=item removeBookmark="removeBookmark"}}
{{/each}}
{{#user-stream stream=model}}
{{#each model.content as |item|}}
{{stream-item item=item removeBookmark="removeBookmark"}}
{{/each}}
{{/user-stream}}

View File

@ -1,56 +1,58 @@
<div class="container">
<div class='directory'>
{{#load-more selector=".directory tbody tr" action="loadMore"}}
<div class="container">
<div class='directory'>
<div class='clearfix'>
{{period-chooser period=period}}
{{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name"}}
</div>
{{#conditional-loading-spinner condition=model.loading}}
{{#if model.length}}
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
<table>
<thead>
<th>&nbsp;</th>
{{directory-toggle field="likes_received" order=order asc=asc icon="heart"}}
{{directory-toggle field="likes_given" order=order asc=asc icon="heart"}}
{{directory-toggle field="topic_count" order=order asc=asc}}
{{directory-toggle field="post_count" order=order asc=asc}}
{{directory-toggle field="topics_entered" order=order asc=asc}}
{{directory-toggle field="posts_read" order=order asc=asc}}
{{directory-toggle field="days_visited" order=order asc=asc}}
{{#if showTimeRead}}
<th>{{i18n "directory.time_read"}}</th>
{{/if}}
</thead>
<tbody>
{{#each ic in model itemController="directory-item"}}
<tr class="{{if ic.me 'me'}}">
{{#with ic.model as |it|}}
<td>{{user-info user=it.user}}</td>
<td>{{number it.likes_received}}</td>
<td>{{number it.likes_given}}</td>
<td>{{number it.topic_count}}</td>
<td>{{number it.post_count}}</td>
<td>{{number it.topics_entered}}</td>
<td>{{number it.posts_read}}</td>
<td>{{number it.days_visited}}</td>
{{#if controller.parentController.showTimeRead}}
<td><span class='time-read'>{{unbound it.time_read}}</span></td>
{{/if}}
{{/with}}
</tr>
{{/each}}
</tbody>
</table>
{{conditional-loading-spinner condition=model.loadingMore}}
{{else}}
<div class='clearfix'></div>
<p>{{i18n "directory.no_results"}}</p>
{{/if}}
{{/conditional-loading-spinner}}
<div class='clearfix'>
{{period-chooser period=period}}
{{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name"}}
</div>
{{#conditional-loading-spinner condition=model.loading}}
{{#if model.length}}
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
<table>
<thead>
<th>&nbsp;</th>
{{directory-toggle field="likes_received" order=order asc=asc icon="heart"}}
{{directory-toggle field="likes_given" order=order asc=asc icon="heart"}}
{{directory-toggle field="topic_count" order=order asc=asc}}
{{directory-toggle field="post_count" order=order asc=asc}}
{{directory-toggle field="topics_entered" order=order asc=asc}}
{{directory-toggle field="posts_read" order=order asc=asc}}
{{directory-toggle field="days_visited" order=order asc=asc}}
{{#if showTimeRead}}
<th>{{i18n "directory.time_read"}}</th>
{{/if}}
</thead>
<tbody>
{{#each ic in model itemController="directory-item"}}
<tr class="{{if ic.me 'me'}}">
{{#with ic.model as |it|}}
<td>{{user-info user=it.user}}</td>
<td>{{number it.likes_received}}</td>
<td>{{number it.likes_given}}</td>
<td>{{number it.topic_count}}</td>
<td>{{number it.post_count}}</td>
<td>{{number it.topics_entered}}</td>
<td>{{number it.posts_read}}</td>
<td>{{number it.days_visited}}</td>
{{#if controller.parentController.showTimeRead}}
<td><span class='time-read'>{{unbound it.time_read}}</span></td>
{{/if}}
{{/with}}
</tr>
{{/each}}
</tbody>
</table>
{{conditional-loading-spinner condition=model.loadingMore}}
{{else}}
<div class='clearfix'></div>
<p>{{i18n "directory.no_results"}}</p>
{{/if}}
{{/conditional-loading-spinner}}
</div>
</div>
{{/load-more}}

View File

@ -1,27 +0,0 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.View.extend(LoadMore, {
loading: false,
eyelineSelector: '.user-stream .item',
classNames: ['user-stream'],
_scrollTopOnModelChange: function() {
Em.run.schedule('afterRender', function() {
$(document).scrollTop(0);
});
}.observes('controller.model.user.id'),
actions: {
loadMore() {
const self = this;
if (this.get('loading')) { return; }
this.set('loading', true);
const stream = this.get('controller.model');
stream.findItems().then(function() {
self.set('loading', false);
self.get('eyeline').flushRest();
});
}
}
});

View File

@ -1,7 +0,0 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.View.extend(LoadMore, {
classNames: ['paginated-topics-list'],
eyelineSelector: '.paginated-topics-list .user-invite-list tr',
templateName: 'user-invited-show'
});

View File

@ -1,20 +0,0 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.View.extend(LoadMore, {
loading: false,
eyelineSelector: ".user-stream .item",
classNames: ["user-stream"],
actions: {
loadMore: function() {
var self = this;
if (this.get("loading")) { return; }
var postsStream = this.get("controller.model");
postsStream.findItems().then(function () {
self.set("loading", false);
self.get("eyeline").flushRest();
}).catch(function () { });
}
}
});

View File

@ -1,27 +0,0 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.View.extend(LoadMore, {
loading: false,
eyelineSelector: '.user-stream .item',
classNames: ['user-stream'],
_scrollTopOnModelChange: function() {
Em.run.schedule('afterRender', function() {
$(document).scrollTop(0);
});
}.observes('controller.model.user.id'),
actions: {
loadMore() {
const self = this;
if (this.get('loading')) { return; }
this.set('loading', true);
const stream = this.get('controller.model');
stream.findItems().then(function() {
self.set('loading', false);
self.get('eyeline').flushRest();
});
}
}
});

View File

@ -1,6 +0,0 @@
import LoadMore from "discourse/mixins/load-more";
export default Ember.View.extend(LoadMore, {
classNames: ['paginated-topics-list'],
eyelineSelector: '.paginated-topics-list .topic-list tr',
});

View File

@ -1,5 +0,0 @@
import LoadMore from 'discourse/mixins/load-more';
export default Ember.View.extend(LoadMore, {
eyelineSelector: '.directory tbody tr'
});

View File

@ -167,7 +167,7 @@ testOpenInANewTab("it opens in a new tab when pressing ctrl", function(clickEven
});
testOpenInANewTab("it opens in a new tab on middle click", function(clickEvent) {
clickEvent.which = 2;
clickEvent.button = 2;
});
test("tracks via AJAX if we're on the same site", function() {