UX: improved our footer handling
- new "show-footer" mixins - converted most of the routes to ES6 - FIX: handling of "indexStream" in user pages There will now be a footer on all the following pages - /exception - /about - /latest - /new - /unread - /starred - /top - /categories - /c/:category - /c/:category/l/latest - /c/:category/l/new - /c/:category/l/unread - /c/:category/l/top - /t/:topic/:id - /groups/:name/members - /user/activity - /user/activity/topics - /user/activity/posts - /user/activity/replies - /user/activity/likes-given - /user/activity/likes-received - /user/activity/bookmarks - /user/activity/starred - /user/badges - /user/notifications - /user/flagged-posts - /user/deleted-posts - /user/private-messages - /user/private-messages/mine - /user/private-messages/unread - /user/invited - /user/:username/preferences - /faq (static pages) - /badges - /badges/:id/:badge
This commit is contained in:
parent
87cd5dbcb7
commit
0947191060
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.View.extend(Discourse.LoadMore, {
|
import LoadMore from "discourse/mixins/load-more";
|
||||||
|
|
||||||
|
export default Discourse.View.extend(LoadMore, {
|
||||||
loading: false,
|
loading: false,
|
||||||
eyelineSelector: '.admin-flags tbody tr',
|
eyelineSelector: '.admin-flags tbody tr',
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
|
showFooter: false,
|
||||||
styleCategory: null,
|
styleCategory: null,
|
||||||
|
|
||||||
canSignUp: function() {
|
canSignUp: function() {
|
||||||
|
|
|
@ -1,34 +1,20 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
||||||
selectedUploadId: function(){
|
selectedUploadId: function(){
|
||||||
switch (this.get("selected")) {
|
switch (this.get("selected")) {
|
||||||
case "system":
|
case "system": return this.get("system_avatar_upload_id");
|
||||||
return this.get("system_avatar_upload_id");
|
case "gravatar": return this.get("gravatar_avatar_upload_id");
|
||||||
case "gravatar":
|
default: return this.get("custom_avatar_upload_id");
|
||||||
return this.get("gravatar_avatar_upload_id");
|
|
||||||
default:
|
|
||||||
return this.get("custom_avatar_upload_id");
|
|
||||||
}
|
}
|
||||||
}.property(
|
}.property('selected', 'system_avatar_upload_id', 'gravatar_avatar_upload_id', 'custom_avatar_upload_id'),
|
||||||
'selected',
|
|
||||||
'system_avatar_upload_id',
|
|
||||||
'gravatar_avatar_upload_id',
|
|
||||||
'custom_avatar_upload_id'),
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
useUploadedAvatar: function() {
|
useUploadedAvatar: function() { this.set("selected", "uploaded"); },
|
||||||
this.set("selected", "uploaded");
|
useGravatar: function() { this.set("selected", "gravatar"); },
|
||||||
},
|
useSystem: function() { this.set("selected", "system"); },
|
||||||
useGravatar: function() {
|
|
||||||
this.set("selected", "gravatar");
|
|
||||||
},
|
|
||||||
useSystem: function() {
|
|
||||||
this.set("selected", "system");
|
|
||||||
},
|
|
||||||
refreshGravatar: function() {
|
refreshGravatar: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.set("gravatarRefreshDisabled", true);
|
self.set("gravatarRefreshDisabled", true);
|
||||||
|
@ -40,4 +26,5 @@ export default DiscourseController.extend(ModalFunctionality, {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,7 @@ import ObjectController from 'discourse/controllers/object';
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
|
needs: ["application"],
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore: function() {
|
loadMore: function() {
|
||||||
|
@ -36,14 +37,17 @@ export default ObjectController.extend({
|
||||||
}.property("userBadges"),
|
}.property("userBadges"),
|
||||||
|
|
||||||
canLoadMore: function() {
|
canLoadMore: function() {
|
||||||
if(this.get('noMoreBadges')) {
|
if (this.get('noMoreBadges')) { return false; }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.get('userBadges')) {
|
if (this.get('userBadges')) {
|
||||||
return this.get('model.grant_count') > this.get('userBadges.length');
|
return this.get('model.grant_count') > this.get('userBadges.length');
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}.property('noMoreBadges', 'model.grant_count', 'userBadges.length')
|
}.property('noMoreBadges', 'model.grant_count', 'userBadges.length'),
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", !this.get("canLoadMore"));
|
||||||
|
}.observes("canLoadMore")
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
/**
|
// Support for changing the notification level of various topics
|
||||||
Support for changing the notification level of various topics
|
|
||||||
|
|
||||||
@class BulkNotificationLevelControler
|
|
||||||
@extends Ember.Controller
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Em.Controller.extend({
|
export default Em.Controller.extend({
|
||||||
needs: ['topic-bulk-actions'],
|
needs: ['topic-bulk-actions'],
|
||||||
|
|
||||||
notificationLevelId: null,
|
notificationLevelId: null,
|
||||||
|
|
||||||
notificationLevels: function() {
|
notificationLevels: function() {
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Modal related to changing the ownership of posts
|
||||||
Modal related to changing the ownership of posts
|
|
||||||
|
|
||||||
@class ChangeOwnerController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, {
|
export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, {
|
||||||
needs: ['topic'],
|
needs: ['topic'],
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
/**
|
// A controller for displaying messages as the user composes a message.
|
||||||
A controller for displaying messages as the user composes a message.
|
|
||||||
|
|
||||||
@class ComposerMessagesController
|
|
||||||
@extends Ember.ArrayController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Ember.ArrayController.extend({
|
export default Ember.ArrayController.extend({
|
||||||
needs: ['composer'],
|
needs: ['composer'],
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import ObjectController from 'discourse/controllers/object';
|
||||||
import TopPeriod from 'discourse/models/top-period';
|
import TopPeriod from 'discourse/models/top-period';
|
||||||
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
needs: ['navigation/category', 'discovery/topics'],
|
needs: ['navigation/category', 'discovery/topics', 'application'],
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
category: Em.computed.alias('controllers.navigation/category.category'),
|
category: Em.computed.alias('controllers.navigation/category.category'),
|
||||||
|
@ -10,6 +10,10 @@ export default ObjectController.extend({
|
||||||
|
|
||||||
loadedAllItems: Em.computed.not("controllers.discovery/topics.canLoadMore"),
|
loadedAllItems: Em.computed.not("controllers.discovery/topics.canLoadMore"),
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", this.get("loadedAllItems"));
|
||||||
|
}.observes("loadedAllItems"),
|
||||||
|
|
||||||
showMoreUrl: function(period) {
|
showMoreUrl: function(period) {
|
||||||
var url = '', category = this.get('category');
|
var url = '', category = this.get('category');
|
||||||
if (category) {
|
if (category) {
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Modal for editing / creating a category
|
||||||
Modal for editing / creating a category
|
|
||||||
|
|
||||||
@class EditCategoryController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(ModalFunctionality, {
|
export default ObjectController.extend(ModalFunctionality, {
|
||||||
foregroundColors: ['FFFFFF', '000000'],
|
foregroundColors: ['FFFFFF', '000000'],
|
||||||
categoryUploadUrl: '/category/uploads',
|
categoryUploadUrl: '/category/uploads',
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Modal related to auto closing of topics
|
||||||
Modal related to auto closing of topics
|
|
||||||
|
|
||||||
@class EditTopicAutoCloseController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(ModalFunctionality, {
|
export default ObjectController.extend(ModalFunctionality, {
|
||||||
auto_close_valid: true,
|
auto_close_valid: true,
|
||||||
auto_close_invalid: Em.computed.not('auto_close_valid'),
|
auto_close_invalid: Em.computed.not('auto_close_valid'),
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
|
|
||||||
var ButtonBackBright = {
|
var ButtonBackBright = {
|
||||||
classes: "btn-primary",
|
classes: "btn-primary",
|
||||||
action: "back",
|
action: "back",
|
||||||
|
@ -22,14 +21,7 @@ var ButtonBackBright = {
|
||||||
key: "errors.buttons.fixed"
|
key: "errors.buttons.fixed"
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
// The controller for the nice error page
|
||||||
The controller for the nice error page
|
|
||||||
|
|
||||||
@class ExceptionController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
thrown: null,
|
thrown: null,
|
||||||
lastTransition: null,
|
lastTransition: null,
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Supports logic for flags in the modal
|
||||||
Supports logic for flags in the modal
|
|
||||||
|
|
||||||
@class FlagActionTypeController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
needs: ['flag'],
|
needs: ['flag'],
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// The basic controller for a group
|
||||||
The basic controller for a group
|
|
||||||
|
|
||||||
@class GroupController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
counts: null,
|
counts: null,
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// This controller handles displaying of history
|
||||||
This controller handles displaying of history
|
|
||||||
|
|
||||||
@class HistoryController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(ModalFunctionality, {
|
export default ObjectController.extend(ModalFunctionality, {
|
||||||
loading: true,
|
loading: true,
|
||||||
viewMode: "side_by_side",
|
viewMode: "side_by_side",
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
export default ObjectController.extend(ModalFunctionality, {
|
export default ObjectController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
export default ObjectController.extend(ModalFunctionality, {
|
export default ObjectController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Modal related to merging of topics
|
||||||
Modal related to merging of topics
|
|
||||||
|
|
||||||
@class MergeTopicController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, {
|
export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, {
|
||||||
needs: ['topic'],
|
needs: ['topic'],
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// This controller handles displaying of raw email
|
||||||
This controller handles displaying of raw email
|
|
||||||
|
|
||||||
@class RawEmailController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(ModalFunctionality, {
|
export default ObjectController.extend(ModalFunctionality, {
|
||||||
rawEmail: "",
|
rawEmail: "",
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1,16 +1,7 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Modal related to auto closing of topics
|
||||||
Modal related to auto closing of topics
|
|
||||||
|
|
||||||
@class SplitTopicController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, {
|
export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, {
|
||||||
needs: ['topic'],
|
needs: ['topic'],
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// This controller supports the admin menu on topics
|
||||||
This controller supports the admin menu on topics
|
|
||||||
|
|
||||||
@class TopicAdminMenuController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
menuVisible: false,
|
menuVisible: false,
|
||||||
showRecover: Em.computed.and('deleted', 'details.can_recover'),
|
showRecover: Em.computed.and('deleted', 'details.can_recover'),
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
/**
|
// Modal for performing bulk actions on topics
|
||||||
Modal for performing bulk actions on topics
|
|
||||||
|
|
||||||
@class TopicBulkActionsController
|
|
||||||
@extends Ember.ArrayController
|
|
||||||
@namespace Discourse
|
|
||||||
@uses ModalFunctionality
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Ember.ArrayController.extend(ModalFunctionality, {
|
export default Ember.ArrayController.extend(ModalFunctionality, {
|
||||||
needs: ['discovery/topics'],
|
needs: ['discovery/topics'],
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Handles displaying of a topic as a list item
|
||||||
Handles displaying of a topic as a list item
|
|
||||||
|
|
||||||
@class TopicListItemController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Ember.ObjectController.extend({
|
export default Ember.ObjectController.extend({
|
||||||
needs: ['discovery/topics'],
|
needs: ['discovery/topics'],
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ import { spinnerHTML } from 'discourse/helpers/loading-spinner';
|
||||||
|
|
||||||
export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
||||||
multiSelect: false,
|
multiSelect: false,
|
||||||
needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress'],
|
needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress', 'application'],
|
||||||
allPostsSelected: false,
|
allPostsSelected: false,
|
||||||
editingTopic: false,
|
editingTopic: false,
|
||||||
selectedPosts: null,
|
selectedPosts: null,
|
||||||
|
@ -697,6 +697,10 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, {
|
||||||
if (lastLoadedPost && lastLoadedPost === post) {
|
if (lastLoadedPost && lastLoadedPost === post) {
|
||||||
postStream.appendMore();
|
postStream.appendMore();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", this.get("postStream.loadedAllPosts"));
|
||||||
|
}.observes("postStream.loadedAllPosts")
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||||
|
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from 'discourse/controllers/controller';
|
||||||
|
|
||||||
export default DiscourseController.extend(ModalFunctionality, {
|
export default DiscourseController.extend(ModalFunctionality, {
|
||||||
|
|
|
@ -1 +1,15 @@
|
||||||
export default Ember.ObjectController.extend();
|
export default Ember.ObjectController.extend({
|
||||||
|
needs: ["application"],
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
var showFooter;
|
||||||
|
if (this.get("userActionType")) {
|
||||||
|
var stat = _.find(this.get("stats"), { action_type: this.get("userActionType") });
|
||||||
|
showFooter = stat && stat.count <= this.get("stream.itemsLoaded");
|
||||||
|
} else {
|
||||||
|
showFooter = this.get("statsCountNonPM") <= this.get("stream.itemsLoaded");
|
||||||
|
}
|
||||||
|
this.set("controllers.application.showFooter", showFooter);
|
||||||
|
}.observes("userActionType", "stream.itemsLoaded")
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
/**
|
// This controller handles actions related to a user's invitations
|
||||||
This controller handles actions related to a user's invitations
|
|
||||||
|
|
||||||
@class UserInvitedController
|
|
||||||
@extends Ember.ArrayController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default Ember.ObjectController.extend({
|
export default Ember.ObjectController.extend({
|
||||||
user: null,
|
user: null,
|
||||||
model: null,
|
model: null,
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
|
|
||||||
export default Ember.ArrayController.extend({
|
export default Ember.ArrayController.extend({
|
||||||
needs: ['user-notifications'],
|
needs: ['user-notifications', 'application'],
|
||||||
canLoadMore: true,
|
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", !this.get("canLoadMore"));
|
||||||
|
}.observes("canLoadMore"),
|
||||||
|
|
||||||
showDismissButton: function() {
|
showDismissButton: function() {
|
||||||
return this.get('user').total_unread_notifications > 0;
|
return this.get('user').total_unread_notifications > 0;
|
||||||
}.property('user'),
|
}.property('user'),
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
export default Ember.ObjectController.extend({
|
||||||
|
needs: ["application"],
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", !this.get("canLoadMore"))
|
||||||
|
}.observes("canLoadMore")
|
||||||
|
});
|
|
@ -1,17 +1,15 @@
|
||||||
import ObjectController from 'discourse/controllers/object';
|
import ObjectController from 'discourse/controllers/object';
|
||||||
|
|
||||||
/**
|
// Lists of topics on a user's page.
|
||||||
Lists of topics on a user's page.
|
|
||||||
|
|
||||||
@class UserTopicsListController
|
|
||||||
@extends ObjectController
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
export default ObjectController.extend({
|
export default ObjectController.extend({
|
||||||
|
needs: ["application"],
|
||||||
hideCategory: false,
|
hideCategory: false,
|
||||||
showParticipants: false,
|
showParticipants: false,
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", !this.get("canLoadMore"));
|
||||||
|
}.observes("canLoadMore"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore: function() {
|
loadMore: function() {
|
||||||
this.get('model').loadMore();
|
this.get('model').loadMore();
|
||||||
|
|
|
@ -2,7 +2,7 @@ import ObjectController from 'discourse/controllers/object';
|
||||||
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
import CanCheckEmails from 'discourse/mixins/can-check-emails';
|
||||||
|
|
||||||
export default ObjectController.extend(CanCheckEmails, {
|
export default ObjectController.extend(CanCheckEmails, {
|
||||||
indexStream: true,
|
indexStream: false,
|
||||||
needs: ['user-notifications', 'user_topics_list'],
|
needs: ['user-notifications', 'user_topics_list'],
|
||||||
|
|
||||||
viewingSelf: function() {
|
viewingSelf: function() {
|
||||||
|
@ -42,27 +42,6 @@ export default ObjectController.extend(CanCheckEmails, {
|
||||||
return this.get('can_be_deleted') && this.get('can_delete_all_posts');
|
return this.get('can_be_deleted') && this.get('can_delete_all_posts');
|
||||||
}.property('can_be_deleted', 'can_delete_all_posts'),
|
}.property('can_be_deleted', 'can_delete_all_posts'),
|
||||||
|
|
||||||
loadedAllItems: function() {
|
|
||||||
switch (this.get("datasource")) {
|
|
||||||
case "badges": { return true; }
|
|
||||||
case "notifications": { return !this.get("controllers.user-notifications.canLoadMore"); }
|
|
||||||
case "topic_list": { return !this.get("controllers.user_topics_list.canLoadMore"); }
|
|
||||||
case "stream": {
|
|
||||||
if (this.get("userActionType")) {
|
|
||||||
var stat = _.find(this.get("stats"), { action_type: this.get("userActionType") });
|
|
||||||
return stat && stat.count <= this.get("stream.itemsLoaded");
|
|
||||||
} else {
|
|
||||||
return this.get("statsCountNonPM") <= this.get("stream.itemsLoaded");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}.property("datasource",
|
|
||||||
"userActionType", "stats", "stream.itemsLoaded",
|
|
||||||
"controllers.user_topics_list.canLoadMore",
|
|
||||||
"controllers.user-notifications.canLoadMore"),
|
|
||||||
|
|
||||||
privateMessagesActive: Em.computed.equal('pmView', 'index'),
|
privateMessagesActive: Em.computed.equal('pmView', 'index'),
|
||||||
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
|
privateMessagesMineActive: Em.computed.equal('pmView', 'mine'),
|
||||||
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread'),
|
privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread'),
|
||||||
|
|
|
@ -22,8 +22,10 @@ export default {
|
||||||
Discourse.DiscoveryTopRoute = buildTopicRoute('top', {
|
Discourse.DiscoveryTopRoute = buildTopicRoute('top', {
|
||||||
actions: {
|
actions: {
|
||||||
willTransition: function() {
|
willTransition: function() {
|
||||||
|
this._super();
|
||||||
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
Discourse.User.currentProp("should_be_redirected_to_top", false);
|
||||||
Discourse.User.currentProp("redirected_to_top_reason", null);
|
Discourse.User.currentProp("redirected_to_top_reason", null);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
var configs = {
|
var configs = {
|
||||||
'faq': 'faq_url',
|
'faq': 'faq_url',
|
||||||
'tos': 'tos_url',
|
'tos': 'tos_url',
|
||||||
|
@ -5,7 +7,7 @@ var configs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function(page) {
|
export default function(page) {
|
||||||
return Discourse.Route.extend({
|
return Discourse.Route.extend(ShowFooter, {
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
this.render('static');
|
this.render('static');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
/**
|
/**
|
||||||
This mixin provides the ability to load more items for a view which is
|
Provides the ability to load more items for a view which is scrolled to the bottom.
|
||||||
scrolled to the bottom.
|
|
||||||
|
|
||||||
@class Discourse.LoadMore
|
|
||||||
@extends Ember.Mixin
|
|
||||||
@uses Discourse.Scrolling
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
**/
|
||||||
Discourse.LoadMore = Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Scrolling, {
|
|
||||||
|
export default Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Scrolling, {
|
||||||
|
|
||||||
scrolled: function() {
|
scrolled: function() {
|
||||||
var eyeline = this.get('eyeline');
|
var eyeline = this.get('eyeline');
|
|
@ -0,0 +1,16 @@
|
||||||
|
export default Em.Mixin.create({
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
var self = this;
|
||||||
|
Em.run.schedule("afterRender", function() {
|
||||||
|
self.controllerFor("application").set("showFooter", true);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
|
willTransition: function() {
|
||||||
|
this.controllerFor("application").set("showFooter", false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
|
@ -12,6 +12,7 @@ Discourse.UserPostsStream = Discourse.Model.extend({
|
||||||
_initialize: function () {
|
_initialize: function () {
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
itemsLoaded: 0,
|
itemsLoaded: 0,
|
||||||
|
canLoadMore: true,
|
||||||
content: []
|
content: []
|
||||||
});
|
});
|
||||||
}.on("init"),
|
}.on("init"),
|
||||||
|
@ -24,6 +25,7 @@ Discourse.UserPostsStream = Discourse.Model.extend({
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
filter: filter,
|
filter: filter,
|
||||||
itemsLoaded: 0,
|
itemsLoaded: 0,
|
||||||
|
canLoadMore: true,
|
||||||
content: []
|
content: []
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,7 +34,7 @@ Discourse.UserPostsStream = Discourse.Model.extend({
|
||||||
|
|
||||||
findItems: function () {
|
findItems: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
if (this.get("loading")) { return Ember.RSVP.reject(); }
|
if (this.get("loading") || !this.get("canLoadMore")) { return Ember.RSVP.reject(); }
|
||||||
|
|
||||||
this.set("loading", true);
|
this.set("loading", true);
|
||||||
|
|
||||||
|
@ -42,7 +44,8 @@ Discourse.UserPostsStream = Discourse.Model.extend({
|
||||||
self.get("content").pushObjects(posts);
|
self.get("content").pushObjects(posts);
|
||||||
self.setProperties({
|
self.setProperties({
|
||||||
loaded: true,
|
loaded: true,
|
||||||
itemsLoaded: self.get("itemsLoaded") + posts.length
|
itemsLoaded: self.get("itemsLoaded") + posts.length,
|
||||||
|
canLoadMore: posts.length === 0 || posts.length < 60
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}).finally(function () {
|
}).finally(function () {
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
model: function() {
|
model: function() {
|
||||||
return Discourse.ajax("/about.json").then(function(result) {
|
return Discourse.ajax("/about.json").then(function(result) {
|
||||||
return result.about;
|
return result.about;
|
||||||
|
|
|
@ -51,7 +51,6 @@ Discourse.Route.buildRoutes(function() {
|
||||||
this.route('categoryNone', { path: '/c/:slug/none' });
|
this.route('categoryNone', { path: '/c/:slug/none' });
|
||||||
this.route('category', { path: '/c/:parentSlug/:slug' });
|
this.route('category', { path: '/c/:parentSlug/:slug' });
|
||||||
|
|
||||||
|
|
||||||
// homepage
|
// homepage
|
||||||
this.route(Discourse.Utilities.defaultHomepage(), { path: '/' });
|
this.route(Discourse.Utilities.defaultHomepage(), { path: '/' });
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
model: function() {
|
model: function() {
|
||||||
if (PreloadStore.get('badges')) {
|
if (PreloadStore.get('badges')) {
|
||||||
return PreloadStore.getAndRemove('badges').then(function(json) {
|
return PreloadStore.getAndRemove('badges').then(function(json) {
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
this.controllerFor("badges/show")._showFooter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
serialize: function(model) {
|
serialize: function(model) {
|
||||||
return {id: model.get('id'), slug: model.get('name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase()};
|
return {id: model.get('id'), slug: model.get('name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase()};
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default function (filter) {
|
||||||
|
return Discourse.Route.extend(ShowFooter, {
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
this.controllerFor('user').set('indexStream', true);
|
||||||
|
this.controllerFor("user-posts")._showFooter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
model: function () {
|
||||||
|
return this.modelFor("user").get("postsStream");
|
||||||
|
},
|
||||||
|
|
||||||
|
afterModel: function () {
|
||||||
|
return this.modelFor("user").get("postsStream").filterBy(filter);
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController: function(controller, model) {
|
||||||
|
// initialize "canLoadMore"
|
||||||
|
model.set("canLoadMore", model.get("itemsLoaded") === 60);
|
||||||
|
|
||||||
|
this.controllerFor("user-posts").set("model", model);
|
||||||
|
},
|
||||||
|
|
||||||
|
renderTemplate: function() {
|
||||||
|
this.render("user/posts", { into: "user" });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
// A helper function to create a category route with parameters
|
|
||||||
import { queryParams, filterQueryParams } from 'discourse/routes/build-topic-route';
|
import { queryParams, filterQueryParams } from 'discourse/routes/build-topic-route';
|
||||||
|
|
||||||
|
// A helper function to create a category route with parameters
|
||||||
export default function(filter, params) {
|
export default function(filter, params) {
|
||||||
return Discourse.Route.extend({
|
return Discourse.Route.extend({
|
||||||
queryParams: queryParams,
|
queryParams: queryParams,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// A helper to build a topic route for a filter
|
|
||||||
|
|
||||||
import { queryParams } from 'discourse/controllers/discovery-sortable';
|
import { queryParams } from 'discourse/controllers/discovery-sortable';
|
||||||
|
|
||||||
|
// A helper to build a topic route for a filter
|
||||||
export function filterQueryParams(params, defaultParams) {
|
export function filterQueryParams(params, defaultParams) {
|
||||||
var findOpts = defaultParams || {};
|
var findOpts = defaultParams || {};
|
||||||
if (params) {
|
if (params) {
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
// A helper to build a user topic list route
|
||||||
|
export default function (viewName, path) {
|
||||||
|
return UserTopicListRoute.extend(ShowFooter, {
|
||||||
|
userActionType: Discourse.UserAction.TYPES.messages_received,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
this.controllerFor("user-topics-list")._showFooter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
model: function() {
|
||||||
|
return Discourse.TopicList.find('topics/' + path + '/' + this.modelFor('user').get('username_lower'));
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController: function() {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
this.controllerFor('user_topics_list').setProperties({
|
||||||
|
hideCategory: true,
|
||||||
|
showParticipants: true
|
||||||
|
});
|
||||||
|
|
||||||
|
this.controllerFor('user').set("pmView", viewName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
/**
|
|
||||||
A base route that allows us to redirect when access is restricted
|
|
||||||
|
|
||||||
@class RestrictedUserRoute
|
|
||||||
@extends Discourse.Route
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
Discourse.RestrictedUserRoute = Discourse.Route.extend({
|
|
||||||
|
|
||||||
afterModel: function() {
|
|
||||||
var user = this.modelFor('user');
|
|
||||||
if (!user.get('can_edit')) {
|
|
||||||
this.replaceWith('userActivity');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenComposer, {
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenComposer, ShowFooter, {
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
this.render('navigation/categories', { outlet: 'navigation-bar' });
|
this.render('navigation/categories', { outlet: 'navigation-bar' });
|
||||||
this.render('discovery/categories', { outlet: 'list-container' });
|
this.render('discovery/categories', { outlet: 'list-container' });
|
||||||
|
@ -58,3 +60,5 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default Discourse.DiscoveryCategoriesRoute;
|
|
@ -1,13 +1,11 @@
|
||||||
/**
|
/**
|
||||||
The parent route for all discovery routes. Handles the logic for showing
|
The parent route for all discovery routes.
|
||||||
the loading spinners.
|
Handles the logic for showing the loading spinners.
|
||||||
|
|
||||||
@class DiscoveryRoute
|
|
||||||
@extends Discourse.Route
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
**/
|
||||||
Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse.OpenComposer, {
|
|
||||||
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse.OpenComposer, ShowFooter, {
|
||||||
redirect: function() { return this.redirectIfLoginRequired(); },
|
redirect: function() { return this.redirectIfLoginRequired(); },
|
||||||
|
|
||||||
beforeModel: function(transition) {
|
beforeModel: function(transition) {
|
||||||
|
@ -20,24 +18,21 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loading: function() {
|
loading: function() {
|
||||||
var controller = this.controllerFor('discovery');
|
this.controllerFor('discovery').set("loading", true);
|
||||||
|
|
||||||
// If we're already loading don't do anything
|
|
||||||
if (controller.get('loading')) { return; }
|
|
||||||
controller.set('loading', true);
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
loadingComplete: function() {
|
loadingComplete: function() {
|
||||||
var controller = this.controllerFor('discovery');
|
this.controllerFor('discovery').set('loading', false);
|
||||||
controller.set('loading', false);
|
|
||||||
if (!Discourse.Session.currentProp('topicListScrollPosition')) {
|
if (!Discourse.Session.currentProp('topicListScrollPosition')) {
|
||||||
this._scrollTop();
|
this._scrollTop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
didTransition: function() {
|
didTransition: function() {
|
||||||
|
this.controllerFor("discovery")._showFooter();
|
||||||
this.send('loadingComplete');
|
this.send('loadingComplete');
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// clear a pinned topic
|
// clear a pinned topic
|
||||||
|
@ -65,3 +60,4 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default Discourse.DiscoveryRoute;
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
serialize: function() {
|
serialize: function() {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,12 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('group').findPosts();
|
return this.modelFor('group').findPosts();
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('group');
|
return this.modelFor('group');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('user');
|
return this.modelFor('user');
|
||||||
},
|
},
|
||||||
|
@ -35,4 +37,3 @@ export default Discourse.RestrictedUserRoute.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username'));
|
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username'));
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username'));
|
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username'));
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('user');
|
return this.modelFor('user');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend({
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
this.render('preferences', { into: 'user', controller: 'preferences' });
|
this.render('preferences', { into: 'user', controller: 'preferences' });
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend({
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('user');
|
return this.modelFor('user');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
export default Discourse.RestrictedUserRoute.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
|
|
||||||
|
export default RestrictedUserRoute.extend(ShowFooter, {
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('user');
|
return this.modelFor('user');
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, user) {
|
setupController: function(controller, user) {
|
||||||
controller.setProperties({ model: user, newNameInput: user.get('name') });
|
controller.setProperties({ model: user, newNameInput: user.get('name') });
|
||||||
this.controllerFor('user').set('indexStream', false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
showAvatarSelector: function() {
|
showAvatarSelector: function() {
|
||||||
Discourse.Route.showModal(this, 'avatar-selector');
|
Discourse.Route.showModal(this, 'avatar-selector');
|
||||||
|
|
||||||
// all the properties needed for displaying the avatar selector modal
|
// all the properties needed for displaying the avatar selector modal
|
||||||
var controller = this.controllerFor('avatar-selector');
|
var controller = this.controllerFor('avatar-selector');
|
||||||
var user = this.modelFor('user');
|
var user = this.modelFor('user');
|
||||||
|
@ -40,7 +43,6 @@ export default Discourse.RestrictedUserRoute.extend({
|
||||||
var user = this.modelFor('user');
|
var user = this.modelFor('user');
|
||||||
var avatarSelector = this.controllerFor('avatar-selector');
|
var avatarSelector = this.controllerFor('avatar-selector');
|
||||||
|
|
||||||
|
|
||||||
// sends the information to the server if it has changed
|
// sends the information to the server if it has changed
|
||||||
if (avatarSelector.get('selectedUploadId') !== user.get('uploaded_avatar_id')) {
|
if (avatarSelector.get('selectedUploadId') !== user.get('uploaded_avatar_id')) {
|
||||||
user.pickAvatar(avatarSelector.get('selectedUploadId'));
|
user.pickAvatar(avatarSelector.get('selectedUploadId'));
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
// A base route that allows us to redirect when access is restricted
|
||||||
|
|
||||||
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
|
afterModel: function() {
|
||||||
|
var user = this.modelFor('user');
|
||||||
|
if (!user.get('can_edit')) {
|
||||||
|
this.replaceWith('userActivity');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,3 @@
|
||||||
|
import TopicFromParamsRoute from "discourse/routes/topic-from-params";
|
||||||
|
|
||||||
|
export default TopicFromParamsRoute;
|
|
@ -1,12 +1,6 @@
|
||||||
/**
|
// This route is used for retrieving a topic based on params
|
||||||
This route is used for retrieving a topic based on params
|
|
||||||
|
|
||||||
@class TopicFromParamsRoute
|
export default Discourse.Route.extend({
|
||||||
@extends Discourse.Route
|
|
||||||
@namespace Discourse
|
|
||||||
@module Discourse
|
|
||||||
**/
|
|
||||||
Discourse.TopicFromParamsRoute = Discourse.Route.extend({
|
|
||||||
|
|
||||||
setupController: function(controller, params) {
|
setupController: function(controller, params) {
|
||||||
params = params || {};
|
params = params || {};
|
||||||
|
@ -56,6 +50,3 @@ Discourse.TopicFromParamsRoute = Discourse.Route.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Discourse.TopicFromParamsNearRoute = Discourse.TopicFromParamsRoute;
|
|
||||||
|
|
|
@ -3,7 +3,9 @@ var isTransitioning = false,
|
||||||
lastScrollPos = null,
|
lastScrollPos = null,
|
||||||
SCROLL_DELAY = 500;
|
SCROLL_DELAY = 500;
|
||||||
|
|
||||||
Discourse.TopicRoute = Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
Discourse.TopicRoute = Discourse.Route.extend(ShowFooter, {
|
||||||
redirect: function() { return this.redirectIfLoginRequired(); },
|
redirect: function() { return this.redirectIfLoginRequired(); },
|
||||||
|
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
@ -108,7 +110,13 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
didTransition: function() {
|
||||||
|
this.controllerFor("topic")._showFooter();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
willTransition: function() {
|
willTransition: function() {
|
||||||
|
this._super();
|
||||||
this.controllerFor("quote-button").deselectText();
|
this.controllerFor("quote-button").deselectText();
|
||||||
Em.run.cancel(scheduledReplace);
|
Em.run.cancel(scheduledReplace);
|
||||||
isTransitioning = true;
|
isTransitioning = true;
|
||||||
|
@ -228,3 +236,4 @@ Discourse.TopicRoute = Discourse.Route.extend({
|
||||||
});
|
});
|
||||||
|
|
||||||
RSVP.EventTarget.mixin(Discourse.TopicRoute);
|
RSVP.EventTarget.mixin(Discourse.TopicRoute);
|
||||||
|
export default Discourse.TopicRoute;
|
|
@ -0,0 +1,5 @@
|
||||||
|
export default Discourse.Route.extend({
|
||||||
|
model: function() {
|
||||||
|
return Discourse.ajax("/404-body", { dataType: 'html' });
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,5 +0,0 @@
|
||||||
Discourse.UnknownRoute = Discourse.Route.extend({
|
|
||||||
model: function() {
|
|
||||||
return Discourse.ajax("/404-body", {dataType: 'html'});
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES["bookmarks"]
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES["edits"]
|
||||||
|
});
|
|
@ -0,0 +1,14 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: undefined,
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
this._super();
|
||||||
|
this.controllerFor('user').set('indexStream', true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES["likes_given"]
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES["likes_received"]
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES["posts"]
|
||||||
|
});
|
|
@ -0,0 +1,5 @@
|
||||||
|
import UserActivityStreamRoute from "discourse/routes/user-activity-stream";
|
||||||
|
|
||||||
|
export default UserActivityStreamRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES["replies"]
|
||||||
|
});
|
|
@ -0,0 +1,9 @@
|
||||||
|
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
|
|
||||||
|
export default UserTopicListRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES.starred,
|
||||||
|
|
||||||
|
model: function() {
|
||||||
|
return Discourse.TopicList.find('starred', { user_id: this.modelFor('user').get('id') });
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,4 +1,6 @@
|
||||||
var UserActivityStreamRoute = Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
model: function() {
|
model: function() {
|
||||||
return this.modelFor('user').get('stream');
|
return this.modelFor('user').get('stream');
|
||||||
},
|
},
|
||||||
|
@ -13,16 +15,16 @@ var UserActivityStreamRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
controller.set('model', model);
|
controller.set('model', model);
|
||||||
this.controllerFor('user_activity').set('userActionType', this.get('userActionType'));
|
this.controllerFor('user-activity').set('userActionType', this.get('userActionType'));
|
||||||
|
|
||||||
this.controllerFor('user').setProperties({
|
|
||||||
indexStream: !this.get('userActionType'),
|
|
||||||
datasource: "stream"
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
|
didTransition: function() {
|
||||||
|
this.controllerFor("user-activity")._showFooter();
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
|
||||||
removeBookmark: function(userAction) {
|
removeBookmark: function(userAction) {
|
||||||
var self = this;
|
var self = this;
|
||||||
Discourse.Post.bookmark(userAction.get('post_id'), false)
|
Discourse.Post.bookmark(userAction.get('post_id'), false)
|
||||||
|
@ -40,10 +42,3 @@ var UserActivityStreamRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build all activity stream routes
|
|
||||||
['bookmarks', 'edits', 'likes_given', 'likes_received', 'replies', 'posts', 'index'].forEach(function (userAction) {
|
|
||||||
Discourse["UserActivity" + userAction.classify() + "Route"] = UserActivityStreamRoute.extend({
|
|
||||||
userActionType: Discourse.UserAction.TYPES[userAction]
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
|
|
||||||
|
export default UserTopicListRoute.extend({
|
||||||
|
userActionType: Discourse.UserAction.TYPES.topics,
|
||||||
|
|
||||||
|
model: function() {
|
||||||
|
return Discourse.TopicList.find('topics/created-by/' + this.modelFor('user').get('username_lower'));
|
||||||
|
}
|
||||||
|
});
|
|
@ -5,7 +5,6 @@ export default Discourse.Route.extend({
|
||||||
|
|
||||||
setupController: function(controller, user) {
|
setupController: function(controller, user) {
|
||||||
this.controllerFor('user-activity').set('model', user);
|
this.controllerFor('user-activity').set('model', user);
|
||||||
this.controllerFor('user').set('pmView', null);
|
|
||||||
|
|
||||||
// Bring up a draft
|
// Bring up a draft
|
||||||
var composerController = this.controllerFor('composer');
|
var composerController = this.controllerFor('composer');
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
model: function() {
|
model: function() {
|
||||||
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true});
|
return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
this.controllerFor('user').setProperties({
|
|
||||||
indexStream: false,
|
|
||||||
datasource: "badges",
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.controllerFor('user_activity').get('content')) {
|
if (this.controllerFor('user_activity').get('content')) {
|
||||||
this.controllerFor('user_activity').set('userActionType', -1);
|
this.controllerFor('user_activity').set('userActionType', -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import createAdminUserPostsRoute from "discourse/routes/build-admin-user-posts-route";
|
||||||
|
|
||||||
|
export default createAdminUserPostsRoute("deleted");
|
|
@ -0,0 +1,3 @@
|
||||||
|
import createAdminUserPostsRoute from "discourse/routes/build-admin-user-posts-route";
|
||||||
|
|
||||||
|
export default createAdminUserPostsRoute("flagged");
|
|
@ -1,8 +1,7 @@
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
beforeModel: function() {
|
beforeModel: function() {
|
||||||
this.controllerFor('user').set('indexStream', true);
|
this.replaceWith('userActivity');
|
||||||
return this.replaceWith('userActivity');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
this.render({ into: 'user' });
|
this.render({ into: 'user' });
|
||||||
},
|
},
|
||||||
|
@ -14,7 +16,6 @@ export default Discourse.Route.extend({
|
||||||
searchTerm: '',
|
searchTerm: '',
|
||||||
totalInvites: model.invites.length
|
totalInvites: model.invites.length
|
||||||
});
|
});
|
||||||
this.controllerFor('user').set('indexStream', false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
|
@ -1,21 +1,28 @@
|
||||||
export default Discourse.Route.extend({
|
import ShowFooter from "discourse/mixins/show-footer";
|
||||||
|
|
||||||
|
export default Discourse.Route.extend(ShowFooter, {
|
||||||
|
actions: {
|
||||||
|
didTransition: function() {
|
||||||
|
this.controllerFor("user_notifications")._showFooter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
model: function() {
|
model: function() {
|
||||||
var user = this.modelFor('user');
|
var user = this.modelFor('user');
|
||||||
return Discourse.NotificationContainer.loadHistory(undefined, user.get('username'));
|
return Discourse.NotificationContainer.loadHistory(undefined, user.get('username'));
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
this.controllerFor('user').setProperties({
|
controller.set('model', model);
|
||||||
indexStream: false,
|
controller.set('user', this.modelFor('user'));
|
||||||
datasource: "notifications"
|
|
||||||
});
|
|
||||||
|
|
||||||
if (this.controllerFor('user_activity').get('content')) {
|
if (this.controllerFor('user_activity').get('content')) {
|
||||||
this.controllerFor('user_activity').set('userActionType', -1);
|
this.controllerFor('user_activity').set('userActionType', -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
controller.set('model', model);
|
// properly initialize "canLoadMore"
|
||||||
controller.set('user', this.modelFor('user'));
|
controller.set("canLoadMore", model.get("length") === 60);
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
import createPMRoute from "discourse/routes/build-user-topic-list-route";
|
||||||
|
|
||||||
|
export default createPMRoute('index', 'private-messages');
|
|
@ -0,0 +1,3 @@
|
||||||
|
import createPMRoute from "discourse/routes/build-user-topic-list-route";
|
||||||
|
|
||||||
|
export default createPMRoute('mine', 'private-messages-sent');
|
|
@ -0,0 +1,3 @@
|
||||||
|
import createPMRoute from "discourse/routes/build-user-topic-list-route";
|
||||||
|
|
||||||
|
export default createPMRoute('unread', 'private-messages-unread');
|
|
@ -1,3 +1,11 @@
|
||||||
import UserActivityRoute from 'discourse/routes/user-activity';
|
import UserActivityRoute from 'discourse/routes/user-activity';
|
||||||
|
|
||||||
export default UserActivityRoute.extend();
|
export default UserActivityRoute.extend({
|
||||||
|
actions: {
|
||||||
|
willTransition: function() {
|
||||||
|
this._super();
|
||||||
|
this.controllerFor('user').set('pmView', null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
export default Discourse.Route.extend({
|
||||||
|
renderTemplate: function() {
|
||||||
|
this.render('user_topics_list');
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController: function(controller, model) {
|
||||||
|
this.controllerFor('user-activity').set('userActionType', this.get('userActionType'));
|
||||||
|
this.controllerFor('user-topics-list').setProperties({
|
||||||
|
model: model,
|
||||||
|
hideCategory: false,
|
||||||
|
showParticipants: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,3 +1,5 @@
|
||||||
|
var INDEX_STREAM_ROUTES = ["user.deletedPosts", "user.flaggedPosts", "userActivity.index"];
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
titleToken: function() {
|
titleToken: function() {
|
||||||
|
@ -21,12 +23,19 @@ export default Discourse.Route.extend({
|
||||||
archetypeId: 'private_message',
|
archetypeId: 'private_message',
|
||||||
draftKey: 'new_private_message'
|
draftKey: 'new_private_message'
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
willTransition: function(transition) {
|
||||||
|
// will reset the indexStream when transitioning to routes that aren't "indexStream"
|
||||||
|
// otherwise the "header" will jump
|
||||||
|
var isIndexStream = ~INDEX_STREAM_ROUTES.indexOf(transition.targetName);
|
||||||
|
this.controllerFor('user').set('indexStream', isIndexStream);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
model: function(params) {
|
model: function(params) {
|
||||||
// If we're viewing the currently logged in user, return that object
|
// If we're viewing the currently logged in user, return that object instead
|
||||||
// instead.
|
|
||||||
var currentUser = Discourse.User.current();
|
var currentUser = Discourse.User.current();
|
||||||
if (currentUser && (params.username.toLowerCase() === currentUser.get('username_lower'))) {
|
if (currentUser && (params.username.toLowerCase() === currentUser.get('username_lower'))) {
|
||||||
return currentUser;
|
return currentUser;
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
function createAdminPostRoute (filter) {
|
|
||||||
return Discourse.Route.extend({
|
|
||||||
model: function () {
|
|
||||||
return this.modelFor("user").get("postsStream");
|
|
||||||
},
|
|
||||||
|
|
||||||
afterModel: function () {
|
|
||||||
return this.modelFor("user").get("postsStream").filterBy(filter);
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController: function (controller, model) {
|
|
||||||
controller.set("model", model);
|
|
||||||
this.controllerFor("user").set("indexStream", true);
|
|
||||||
},
|
|
||||||
|
|
||||||
renderTemplate: function() {
|
|
||||||
this.render("user/posts", { into: "user" });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Discourse.UserDeletedPostsRoute = createAdminPostRoute("deleted");
|
|
||||||
Discourse.UserFlaggedPostsRoute = createAdminPostRoute("flagged");
|
|
|
@ -1,61 +0,0 @@
|
||||||
Discourse.UserTopicListRoute = Discourse.Route.extend({
|
|
||||||
renderTemplate: function() {
|
|
||||||
this.render('user_topics_list');
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
|
||||||
this.controllerFor('user').setProperties({
|
|
||||||
indexStream: false,
|
|
||||||
datasource: "topic_list"
|
|
||||||
});
|
|
||||||
this.controllerFor('user-activity').set('userActionType', this.get('userActionType'));
|
|
||||||
this.controllerFor('user_topics_list').setProperties({
|
|
||||||
model: model,
|
|
||||||
hideCategory: false,
|
|
||||||
showParticipants: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function createPMRoute(viewName, path) {
|
|
||||||
return Discourse.UserTopicListRoute.extend({
|
|
||||||
userActionType: Discourse.UserAction.TYPES.messages_received,
|
|
||||||
|
|
||||||
model: function() {
|
|
||||||
return Discourse.TopicList.find('topics/' + path + '/' + this.modelFor('user').get('username_lower'));
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController: function() {
|
|
||||||
this._super.apply(this, arguments);
|
|
||||||
this.controllerFor('user_topics_list').setProperties({
|
|
||||||
hideCategory: true,
|
|
||||||
showParticipants: true
|
|
||||||
});
|
|
||||||
this.controllerFor('user').setProperties({
|
|
||||||
pmView: viewName,
|
|
||||||
indexStream: false,
|
|
||||||
datasource: "topic_list"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Discourse.UserPrivateMessagesIndexRoute = createPMRoute('index', 'private-messages');
|
|
||||||
Discourse.UserPrivateMessagesMineRoute = createPMRoute('mine', 'private-messages-sent');
|
|
||||||
Discourse.UserPrivateMessagesUnreadRoute = createPMRoute('unread', 'private-messages-unread');
|
|
||||||
|
|
||||||
Discourse.UserActivityTopicsRoute = Discourse.UserTopicListRoute.extend({
|
|
||||||
userActionType: Discourse.UserAction.TYPES.topics,
|
|
||||||
|
|
||||||
model: function() {
|
|
||||||
return Discourse.TopicList.find('topics/created-by/' + this.modelFor('user').get('username_lower'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Discourse.UserActivityStarredRoute = Discourse.UserTopicListRoute.extend({
|
|
||||||
userActionType: Discourse.UserAction.TYPES.starred,
|
|
||||||
|
|
||||||
model: function() {
|
|
||||||
return Discourse.TopicList.find('starred', { user_id: this.modelFor('user').get('id') });
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -62,5 +62,3 @@
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
|
|
|
@ -5,6 +5,10 @@
|
||||||
{{render "user-card"}}
|
{{render "user-card"}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#if showFooter}}
|
||||||
|
{{custom-html "footer"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{render "modal"}}
|
{{render "modal"}}
|
||||||
{{render "topic-entrance"}}
|
{{render "topic-entrance"}}
|
||||||
{{render "composer"}}
|
{{render "composer"}}
|
||||||
|
|
|
@ -19,5 +19,3 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
|
|
|
@ -37,8 +37,5 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{loading-spinner condition=canLoadMore}}
|
{{loading-spinner condition=canLoadMore}}
|
||||||
{{#unless canLoadMore}}
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
{{/unless}}
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -28,6 +28,3 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{#if loadedAllItems}}
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
|
@ -7,5 +7,3 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
|
|
|
@ -134,10 +134,6 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if postStream.loadedAllPosts}}
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{render "share"}}
|
{{render "share"}}
|
||||||
|
|
||||||
{{#if currentUser.enable_quoting}}
|
{{#if currentUser.enable_quoting}}
|
||||||
|
|
|
@ -194,7 +194,3 @@
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#if loadedAllItems}}
|
|
||||||
{{custom-html "footer"}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue