diff --git a/app/assets/javascripts/admin/views/admin-flags-list.js.es6 b/app/assets/javascripts/admin/views/admin-flags-list.js.es6 index b3035fe7421..0f720b1e56b 100644 --- a/app/assets/javascripts/admin/views/admin-flags-list.js.es6 +++ b/app/assets/javascripts/admin/views/admin-flags-list.js.es6 @@ -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, eyelineSelector: '.admin-flags tbody tr', diff --git a/app/assets/javascripts/discourse/controllers/application.js.es6 b/app/assets/javascripts/discourse/controllers/application.js.es6 index 176e0afff6e..6017af32142 100644 --- a/app/assets/javascripts/discourse/controllers/application.js.es6 +++ b/app/assets/javascripts/discourse/controllers/application.js.es6 @@ -1,4 +1,5 @@ export default Ember.Controller.extend({ + showFooter: false, styleCategory: null, canSignUp: function() { diff --git a/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 b/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 index fe6d9c24d7c..e856b5a09f8 100644 --- a/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/avatar-selector.js.es6 @@ -1,35 +1,21 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { selectedUploadId: function(){ - switch(this.get("selected")){ - case "system": - return this.get("system_avatar_upload_id"); - case "gravatar": - return this.get("gravatar_avatar_upload_id"); - default: - return this.get("custom_avatar_upload_id"); + switch (this.get("selected")) { + case "system": return this.get("system_avatar_upload_id"); + case "gravatar": return this.get("gravatar_avatar_upload_id"); + default: return this.get("custom_avatar_upload_id"); } - }.property( - 'selected', - 'system_avatar_upload_id', - 'gravatar_avatar_upload_id', - 'custom_avatar_upload_id'), + }.property('selected', 'system_avatar_upload_id', 'gravatar_avatar_upload_id', 'custom_avatar_upload_id'), actions: { - useUploadedAvatar: function() { - this.set("selected", "uploaded"); - }, - useGravatar: function() { - this.set("selected", "gravatar"); - }, - useSystem: function() { - this.set("selected", "system"); - }, - refreshGravatar: function(){ + useUploadedAvatar: function() { this.set("selected", "uploaded"); }, + useGravatar: function() { this.set("selected", "gravatar"); }, + useSystem: function() { this.set("selected", "system"); }, + refreshGravatar: function() { var self = this; self.set("gravatarRefreshDisabled", true); Discourse @@ -40,4 +26,5 @@ export default DiscourseController.extend(ModalFunctionality, { }); } } + }); diff --git a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 index 6da73596fa1..fc1934a80f2 100644 --- a/app/assets/javascripts/discourse/controllers/badges/show.js.es6 +++ b/app/assets/javascripts/discourse/controllers/badges/show.js.es6 @@ -9,6 +9,7 @@ import ObjectController from 'discourse/controllers/object'; @module Discourse **/ export default ObjectController.extend({ + needs: ["application"], actions: { loadMore: function() { @@ -36,14 +37,17 @@ export default ObjectController.extend({ }.property("userBadges"), canLoadMore: function() { - if(this.get('noMoreBadges')) { - return false; - } + if (this.get('noMoreBadges')) { return false; } if (this.get('userBadges')) { return this.get('model.grant_count') > this.get('userBadges.length'); } else { 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") + }); diff --git a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 index bde60c8eb57..094960251a2 100644 --- a/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 +++ b/app/assets/javascripts/discourse/controllers/bulk-notification-level.js.es6 @@ -1,14 +1,6 @@ -/** - Support for changing the notification level of various topics - - @class BulkNotificationLevelControler - @extends Ember.Controller - @namespace Discourse - @module Discourse -**/ +// Support for changing the notification level of various topics export default Em.Controller.extend({ needs: ['topic-bulk-actions'], - notificationLevelId: null, notificationLevels: function() { diff --git a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 index ab4cc4639d8..63f86045e97 100644 --- a/app/assets/javascripts/discourse/controllers/change-owner.js.es6 +++ b/app/assets/javascripts/discourse/controllers/change-owner.js.es6 @@ -1,16 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; -/** - Modal related to changing the ownership of posts - - @class ChangeOwnerController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse - **/ +// Modal related to changing the ownership of posts export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, { needs: ['topic'], diff --git a/app/assets/javascripts/discourse/controllers/composer-messages.js.es6 b/app/assets/javascripts/discourse/controllers/composer-messages.js.es6 index 3b8865416e7..f47829e50a0 100644 --- a/app/assets/javascripts/discourse/controllers/composer-messages.js.es6 +++ b/app/assets/javascripts/discourse/controllers/composer-messages.js.es6 @@ -1,11 +1,4 @@ -/** - A controller for displaying messages as the user composes a message. - - @class ComposerMessagesController - @extends Ember.ArrayController - @namespace Discourse - @module Discourse -**/ +// A controller for displaying messages as the user composes a message. export default Ember.ArrayController.extend({ needs: ['composer'], diff --git a/app/assets/javascripts/discourse/controllers/create-account.js.es6 b/app/assets/javascripts/discourse/controllers/create-account.js.es6 index e990bcfb640..5e9094aebca 100644 --- a/app/assets/javascripts/discourse/controllers/create-account.js.es6 +++ b/app/assets/javascripts/discourse/controllers/create-account.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/discovery.js.es6 b/app/assets/javascripts/discourse/controllers/discovery.js.es6 index 68ac68f45fb..0817323504e 100644 --- a/app/assets/javascripts/discourse/controllers/discovery.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery.js.es6 @@ -2,7 +2,7 @@ import ObjectController from 'discourse/controllers/object'; import TopPeriod from 'discourse/models/top-period'; export default ObjectController.extend({ - needs: ['navigation/category', 'discovery/topics'], + needs: ['navigation/category', 'discovery/topics', 'application'], loading: false, category: Em.computed.alias('controllers.navigation/category.category'), @@ -10,6 +10,10 @@ export default ObjectController.extend({ loadedAllItems: Em.computed.not("controllers.discovery/topics.canLoadMore"), + _showFooter: function() { + this.set("controllers.application.showFooter", this.get("loadedAllItems")); + }.observes("loadedAllItems"), + showMoreUrl: function(period) { var url = '', category = this.get('category'); if (category) { diff --git a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 b/app/assets/javascripts/discourse/controllers/edit-category.js.es6 index a8161bbf6a3..7f0f6654959 100644 --- a/app/assets/javascripts/discourse/controllers/edit-category.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-category.js.es6 @@ -1,16 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; -/** - Modal for editing / creating a category - - @class EditCategoryController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// Modal for editing / creating a category export default ObjectController.extend(ModalFunctionality, { foregroundColors: ['FFFFFF', '000000'], categoryUploadUrl: '/category/uploads', diff --git a/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 b/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 index b9526f4138e..9955c2197fc 100644 --- a/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 +++ b/app/assets/javascripts/discourse/controllers/edit-topic-auto-close.js.es6 @@ -1,15 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; import ObjectController from 'discourse/controllers/object'; -/** - Modal related to auto closing of topics - - @class EditTopicAutoCloseController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// Modal related to auto closing of topics export default ObjectController.extend(ModalFunctionality, { auto_close_valid: true, auto_close_invalid: Em.computed.not('auto_close_valid'), diff --git a/app/assets/javascripts/discourse/controllers/exception.js.es6 b/app/assets/javascripts/discourse/controllers/exception.js.es6 index ab60fe0868b..ccaf907c146 100644 --- a/app/assets/javascripts/discourse/controllers/exception.js.es6 +++ b/app/assets/javascripts/discourse/controllers/exception.js.es6 @@ -1,6 +1,5 @@ import ObjectController from 'discourse/controllers/object'; - var ButtonBackBright = { classes: "btn-primary", action: "back", @@ -22,14 +21,7 @@ var ButtonBackBright = { key: "errors.buttons.fixed" }; -/** - The controller for the nice error page - - @class ExceptionController - @extends ObjectController - @namespace Discourse - @module Discourse -**/ +// The controller for the nice error page export default ObjectController.extend({ thrown: null, lastTransition: null, diff --git a/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 b/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 index 888f55c3eee..484fd12f66e 100644 --- a/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 +++ b/app/assets/javascripts/discourse/controllers/flag-action-type.js.es6 @@ -1,13 +1,6 @@ import ObjectController from 'discourse/controllers/object'; -/** - Supports logic for flags in the modal - - @class FlagActionTypeController - @extends ObjectController - @namespace Discourse - @module Discourse -**/ +// Supports logic for flags in the modal export default ObjectController.extend({ needs: ['flag'], diff --git a/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 b/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 index 08e40195734..9003d53dc47 100644 --- a/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 +++ b/app/assets/javascripts/discourse/controllers/forgot-password.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/group.js.es6 b/app/assets/javascripts/discourse/controllers/group.js.es6 index baf2dca201a..8355eff56d3 100644 --- a/app/assets/javascripts/discourse/controllers/group.js.es6 +++ b/app/assets/javascripts/discourse/controllers/group.js.es6 @@ -1,13 +1,6 @@ import ObjectController from 'discourse/controllers/object'; -/** - The basic controller for a group - - @class GroupController - @extends ObjectController - @namespace Discourse - @module Discourse -**/ +// The basic controller for a group export default ObjectController.extend({ counts: null, diff --git a/app/assets/javascripts/discourse/controllers/history.js.es6 b/app/assets/javascripts/discourse/controllers/history.js.es6 index 344a1fccf8c..2a00dc18d57 100644 --- a/app/assets/javascripts/discourse/controllers/history.js.es6 +++ b/app/assets/javascripts/discourse/controllers/history.js.es6 @@ -1,16 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; -/** - This controller handles displaying of history - - @class HistoryController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// This controller handles displaying of history export default ObjectController.extend(ModalFunctionality, { loading: true, viewMode: "side_by_side", diff --git a/app/assets/javascripts/discourse/controllers/invite-private.js.es6 b/app/assets/javascripts/discourse/controllers/invite-private.js.es6 index fe00c85bfa1..94e1d6632de 100644 --- a/app/assets/javascripts/discourse/controllers/invite-private.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite-private.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; export default ObjectController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/invite.js.es6 b/app/assets/javascripts/discourse/controllers/invite.js.es6 index 09a2fe4e431..965d4128dca 100644 --- a/app/assets/javascripts/discourse/controllers/invite.js.es6 +++ b/app/assets/javascripts/discourse/controllers/invite.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; export default ObjectController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 b/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 index 20a9823fdc1..30d4a006648 100644 --- a/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 +++ b/app/assets/javascripts/discourse/controllers/keyboard-shortcuts-help.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 b/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 index 7b1b684823f..658efcd5fc3 100644 --- a/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/merge-topic.js.es6 @@ -1,16 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; -/** - Modal related to merging of topics - - @class MergeTopicController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// Modal related to merging of topics export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, { needs: ['topic'], diff --git a/app/assets/javascripts/discourse/controllers/not-activated.js.es6 b/app/assets/javascripts/discourse/controllers/not-activated.js.es6 index 40fdf41b0d7..3ce160c8808 100644 --- a/app/assets/javascripts/discourse/controllers/not-activated.js.es6 +++ b/app/assets/javascripts/discourse/controllers/not-activated.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/raw-email.js.es6 b/app/assets/javascripts/discourse/controllers/raw-email.js.es6 index 2cff6cf2a27..8c74ce11103 100644 --- a/app/assets/javascripts/discourse/controllers/raw-email.js.es6 +++ b/app/assets/javascripts/discourse/controllers/raw-email.js.es6 @@ -1,16 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; -/** - This controller handles displaying of raw email - - @class RawEmailController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// This controller handles displaying of raw email export default ObjectController.extend(ModalFunctionality, { rawEmail: "", diff --git a/app/assets/javascripts/discourse/controllers/search-help.js.es6 b/app/assets/javascripts/discourse/controllers/search-help.js.es6 index c62a9db6c00..2630424ff40 100644 --- a/app/assets/javascripts/discourse/controllers/search-help.js.es6 +++ b/app/assets/javascripts/discourse/controllers/search-help.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/split-topic.js.es6 b/app/assets/javascripts/discourse/controllers/split-topic.js.es6 index 38c2ba38e2d..7ef77020000 100644 --- a/app/assets/javascripts/discourse/controllers/split-topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/split-topic.js.es6 @@ -1,16 +1,7 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import ObjectController from 'discourse/controllers/object'; -/** - Modal related to auto closing of topics - - @class SplitTopicController - @extends ObjectController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// Modal related to auto closing of topics export default ObjectController.extend(Discourse.SelectedPostsCount, ModalFunctionality, { needs: ['topic'], diff --git a/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 b/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 index 8f77b08a39c..e4ab7a8c300 100644 --- a/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-admin-menu.js.es6 @@ -1,13 +1,6 @@ import ObjectController from 'discourse/controllers/object'; -/** - This controller supports the admin menu on topics - - @class TopicAdminMenuController - @extends ObjectController - @namespace Discourse - @module Discourse -**/ +// This controller supports the admin menu on topics export default ObjectController.extend({ menuVisible: false, showRecover: Em.computed.and('deleted', 'details.can_recover'), diff --git a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 index 06e4276bace..4c0ddcfdebb 100644 --- a/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-bulk-actions.js.es6 @@ -1,14 +1,6 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; -/** - Modal for performing bulk actions on topics - - @class TopicBulkActionsController - @extends Ember.ArrayController - @namespace Discourse - @uses ModalFunctionality - @module Discourse -**/ +// Modal for performing bulk actions on topics export default Ember.ArrayController.extend(ModalFunctionality, { needs: ['discovery/topics'], diff --git a/app/assets/javascripts/discourse/controllers/topic-list-item.js.es6 b/app/assets/javascripts/discourse/controllers/topic-list-item.js.es6 index 47c9d999f28..e5128e2744f 100644 --- a/app/assets/javascripts/discourse/controllers/topic-list-item.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic-list-item.js.es6 @@ -1,13 +1,6 @@ import ObjectController from 'discourse/controllers/object'; -/** - Handles displaying of a topic as a list item - - @class TopicListItemController - @extends ObjectController - @namespace Discourse - @module Discourse -**/ +// Handles displaying of a topic as a list item export default Ember.ObjectController.extend({ needs: ['discovery/topics'], diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index c3f1342b32c..fac35fa4d96 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -3,7 +3,7 @@ import { spinnerHTML } from 'discourse/helpers/loading-spinner'; export default ObjectController.extend(Discourse.SelectedPostsCount, { multiSelect: false, - needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress'], + needs: ['header', 'modal', 'composer', 'quote-button', 'search', 'topic-progress', 'application'], allPostsSelected: false, editingTopic: false, selectedPosts: null, @@ -697,6 +697,10 @@ export default ObjectController.extend(Discourse.SelectedPostsCount, { if (lastLoadedPost && lastLoadedPost === post) { postStream.appendMore(); } - } + }, + + _showFooter: function() { + this.set("controllers.application.showFooter", this.get("postStream.loadedAllPosts")); + }.observes("postStream.loadedAllPosts") }); diff --git a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 index d762ebf7ca8..edd2d569434 100644 --- a/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 +++ b/app/assets/javascripts/discourse/controllers/upload-selector.js.es6 @@ -1,5 +1,4 @@ import ModalFunctionality from 'discourse/mixins/modal-functionality'; - import DiscourseController from 'discourse/controllers/controller'; export default DiscourseController.extend(ModalFunctionality, { diff --git a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 index 5ca4a2c2ca1..878fa3fde4b 100644 --- a/app/assets/javascripts/discourse/controllers/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-activity.js.es6 @@ -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") + +}); diff --git a/app/assets/javascripts/discourse/controllers/user-invited.js.es6 b/app/assets/javascripts/discourse/controllers/user-invited.js.es6 index 3274963eac1..4d5fea2f4e6 100644 --- a/app/assets/javascripts/discourse/controllers/user-invited.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-invited.js.es6 @@ -1,11 +1,4 @@ -/** - This controller handles actions related to a user's invitations - - @class UserInvitedController - @extends Ember.ArrayController - @namespace Discourse - @module Discourse -**/ +// This controller handles actions related to a user's invitations export default Ember.ObjectController.extend({ user: null, model: null, diff --git a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 index e2519e2e5c5..3943daa8688 100644 --- a/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-notifications.js.es6 @@ -1,9 +1,12 @@ export default Ember.ArrayController.extend({ - needs: ['user-notifications'], - canLoadMore: true, + needs: ['user-notifications', 'application'], loading: false, + _showFooter: function() { + this.set("controllers.application.showFooter", !this.get("canLoadMore")); + }.observes("canLoadMore"), + showDismissButton: function() { return this.get('user').total_unread_notifications > 0; }.property('user'), diff --git a/app/assets/javascripts/discourse/controllers/user-posts.js.es6 b/app/assets/javascripts/discourse/controllers/user-posts.js.es6 new file mode 100644 index 00000000000..eacec20213e --- /dev/null +++ b/app/assets/javascripts/discourse/controllers/user-posts.js.es6 @@ -0,0 +1,7 @@ +export default Ember.ObjectController.extend({ + needs: ["application"], + + _showFooter: function() { + this.set("controllers.application.showFooter", !this.get("canLoadMore")) + }.observes("canLoadMore") +}); diff --git a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 index 8e81c0f220d..c39d34df951 100644 --- a/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user-topics-list.js.es6 @@ -1,17 +1,15 @@ import ObjectController from 'discourse/controllers/object'; -/** - Lists of topics on a user's page. - - @class UserTopicsListController - @extends ObjectController - @namespace Discourse - @module Discourse -**/ +// Lists of topics on a user's page. export default ObjectController.extend({ + needs: ["application"], hideCategory: false, showParticipants: false, + _showFooter: function() { + this.set("controllers.application.showFooter", !this.get("canLoadMore")); + }.observes("canLoadMore"), + actions: { loadMore: function() { this.get('model').loadMore(); diff --git a/app/assets/javascripts/discourse/controllers/user.js.es6 b/app/assets/javascripts/discourse/controllers/user.js.es6 index c88a24264bf..5fb5b5bb845 100644 --- a/app/assets/javascripts/discourse/controllers/user.js.es6 +++ b/app/assets/javascripts/discourse/controllers/user.js.es6 @@ -2,7 +2,7 @@ import ObjectController from 'discourse/controllers/object'; import CanCheckEmails from 'discourse/mixins/can-check-emails'; export default ObjectController.extend(CanCheckEmails, { - indexStream: true, + indexStream: false, needs: ['user-notifications', 'user_topics_list'], viewingSelf: function() { @@ -42,27 +42,6 @@ export default ObjectController.extend(CanCheckEmails, { return this.get('can_be_deleted') && this.get('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'), privateMessagesMineActive: Em.computed.equal('pmView', 'mine'), privateMessagesUnreadActive: Em.computed.equal('pmView', 'unread'), diff --git a/app/assets/javascripts/discourse/initializers/dynamic-route-builders.js.es6 b/app/assets/javascripts/discourse/initializers/dynamic-route-builders.js.es6 index f5f22866bac..a2222aa3f99 100644 --- a/app/assets/javascripts/discourse/initializers/dynamic-route-builders.js.es6 +++ b/app/assets/javascripts/discourse/initializers/dynamic-route-builders.js.es6 @@ -22,8 +22,10 @@ export default { Discourse.DiscoveryTopRoute = buildTopicRoute('top', { actions: { willTransition: function() { + this._super(); Discourse.User.currentProp("should_be_redirected_to_top", false); Discourse.User.currentProp("redirected_to_top_reason", null); + return true; } } }); diff --git a/app/assets/javascripts/discourse/lib/static-route-builder.js.es6 b/app/assets/javascripts/discourse/lib/static-route-builder.js.es6 index a1140f89a33..79365f4655d 100644 --- a/app/assets/javascripts/discourse/lib/static-route-builder.js.es6 +++ b/app/assets/javascripts/discourse/lib/static-route-builder.js.es6 @@ -1,3 +1,5 @@ +import ShowFooter from "discourse/mixins/show-footer"; + var configs = { 'faq': 'faq_url', 'tos': 'tos_url', @@ -5,7 +7,7 @@ var configs = { }; export default function(page) { - return Discourse.Route.extend({ + return Discourse.Route.extend(ShowFooter, { renderTemplate: function() { this.render('static'); }, diff --git a/app/assets/javascripts/discourse/mixins/load_more.js b/app/assets/javascripts/discourse/mixins/load-more.js.es6 similarity index 62% rename from app/assets/javascripts/discourse/mixins/load_more.js rename to app/assets/javascripts/discourse/mixins/load-more.js.es6 index 1f6ebab29a8..136c5aeca41 100644 --- a/app/assets/javascripts/discourse/mixins/load_more.js +++ b/app/assets/javascripts/discourse/mixins/load-more.js.es6 @@ -1,14 +1,8 @@ /** - This mixin provides the ability to load more items for a view which is - scrolled to the bottom. - - @class Discourse.LoadMore - @extends Ember.Mixin - @uses Discourse.Scrolling - @namespace Discourse - @module Discourse + Provides the ability to load more items for a view which is scrolled to the bottom. **/ -Discourse.LoadMore = Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Scrolling, { + +export default Em.Mixin.create(Ember.ViewTargetActionSupport, Discourse.Scrolling, { scrolled: function() { var eyeline = this.get('eyeline'); diff --git a/app/assets/javascripts/discourse/mixins/show-footer.js.es6 b/app/assets/javascripts/discourse/mixins/show-footer.js.es6 new file mode 100644 index 00000000000..8ae74e967e9 --- /dev/null +++ b/app/assets/javascripts/discourse/mixins/show-footer.js.es6 @@ -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; + } + } +}) diff --git a/app/assets/javascripts/discourse/models/user_posts_stream.js b/app/assets/javascripts/discourse/models/user_posts_stream.js index 7447cbe63af..b155464566b 100644 --- a/app/assets/javascripts/discourse/models/user_posts_stream.js +++ b/app/assets/javascripts/discourse/models/user_posts_stream.js @@ -12,6 +12,7 @@ Discourse.UserPostsStream = Discourse.Model.extend({ _initialize: function () { this.setProperties({ itemsLoaded: 0, + canLoadMore: true, content: [] }); }.on("init"), @@ -24,6 +25,7 @@ Discourse.UserPostsStream = Discourse.Model.extend({ this.setProperties({ filter: filter, itemsLoaded: 0, + canLoadMore: true, content: [] }); @@ -32,7 +34,7 @@ Discourse.UserPostsStream = Discourse.Model.extend({ findItems: function () { 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); @@ -42,7 +44,8 @@ Discourse.UserPostsStream = Discourse.Model.extend({ self.get("content").pushObjects(posts); self.setProperties({ loaded: true, - itemsLoaded: self.get("itemsLoaded") + posts.length + itemsLoaded: self.get("itemsLoaded") + posts.length, + canLoadMore: posts.length === 0 || posts.length < 60 }); } }).finally(function () { diff --git a/app/assets/javascripts/discourse/routes/about.js.es6 b/app/assets/javascripts/discourse/routes/about.js.es6 index 3021dd0835f..5258ea7fbd2 100644 --- a/app/assets/javascripts/discourse/routes/about.js.es6 +++ b/app/assets/javascripts/discourse/routes/about.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { model: function() { return Discourse.ajax("/about.json").then(function(result) { return result.about; diff --git a/app/assets/javascripts/discourse/routes/application_routes.js b/app/assets/javascripts/discourse/routes/application_routes.js index 79edca418b8..a7d0200d630 100644 --- a/app/assets/javascripts/discourse/routes/application_routes.js +++ b/app/assets/javascripts/discourse/routes/application_routes.js @@ -51,7 +51,6 @@ Discourse.Route.buildRoutes(function() { this.route('categoryNone', { path: '/c/:slug/none' }); this.route('category', { path: '/c/:parentSlug/:slug' }); - // homepage this.route(Discourse.Utilities.defaultHomepage(), { path: '/' }); }); diff --git a/app/assets/javascripts/discourse/routes/badges-index.js.es6 b/app/assets/javascripts/discourse/routes/badges-index.js.es6 index fb7e9905654..67af4625f2b 100644 --- a/app/assets/javascripts/discourse/routes/badges-index.js.es6 +++ b/app/assets/javascripts/discourse/routes/badges-index.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { model: function() { if (PreloadStore.get('badges')) { return PreloadStore.getAndRemove('badges').then(function(json) { diff --git a/app/assets/javascripts/discourse/routes/badges-show.js.es6 b/app/assets/javascripts/discourse/routes/badges-show.js.es6 index 5ee4fa72d8b..7b897f03bf2 100644 --- a/app/assets/javascripts/discourse/routes/badges-show.js.es6 +++ b/app/assets/javascripts/discourse/routes/badges-show.js.es6 @@ -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) { return {id: model.get('id'), slug: model.get('name').replace(/[^A-Za-z0-9_]+/g, '-').toLowerCase()}; }, diff --git a/app/assets/javascripts/discourse/routes/build-admin-user-posts-route.js.es6 b/app/assets/javascripts/discourse/routes/build-admin-user-posts-route.js.es6 new file mode 100644 index 00000000000..6d79b3b4878 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/build-admin-user-posts-route.js.es6 @@ -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" }); + } + }); +} diff --git a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 index ec736d5e278..643a0063ebf 100644 --- a/app/assets/javascripts/discourse/routes/build-category-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-category-route.js.es6 @@ -1,6 +1,6 @@ -// A helper function to create a category route with parameters import { queryParams, filterQueryParams } from 'discourse/routes/build-topic-route'; +// A helper function to create a category route with parameters export default function(filter, params) { return Discourse.Route.extend({ queryParams: queryParams, diff --git a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 index f00bd5d1777..dcfd77143e5 100644 --- a/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 +++ b/app/assets/javascripts/discourse/routes/build-topic-route.js.es6 @@ -1,7 +1,6 @@ -// A helper to build a topic route for a filter - import { queryParams } from 'discourse/controllers/discovery-sortable'; +// A helper to build a topic route for a filter export function filterQueryParams(params, defaultParams) { var findOpts = defaultParams || {}; if (params) { diff --git a/app/assets/javascripts/discourse/routes/build-user-topic-list-route.js.es6 b/app/assets/javascripts/discourse/routes/build-user-topic-list-route.js.es6 new file mode 100644 index 00000000000..a65533f9e02 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/build-user-topic-list-route.js.es6 @@ -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); + } + }); +} diff --git a/app/assets/javascripts/discourse/routes/discourse_restricted_user_route.js b/app/assets/javascripts/discourse/routes/discourse_restricted_user_route.js deleted file mode 100644 index d489e6f5d07..00000000000 --- a/app/assets/javascripts/discourse/routes/discourse_restricted_user_route.js +++ /dev/null @@ -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'); - } - } - -}); - - diff --git a/app/assets/javascripts/discourse/routes/discovery_categories_route.js b/app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 similarity index 93% rename from app/assets/javascripts/discourse/routes/discovery_categories_route.js rename to app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 index 13f066865be..31278dfca53 100644 --- a/app/assets/javascripts/discourse/routes/discovery_categories_route.js +++ b/app/assets/javascripts/discourse/routes/discovery-categories-route.js.es6 @@ -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() { this.render('navigation/categories', { outlet: 'navigation-bar' }); this.render('discovery/categories', { outlet: 'list-container' }); @@ -58,3 +60,5 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos } } }); + +export default Discourse.DiscoveryCategoriesRoute; diff --git a/app/assets/javascripts/discourse/routes/discovery_route.js b/app/assets/javascripts/discourse/routes/discovery-route.js.es6 similarity index 74% rename from app/assets/javascripts/discourse/routes/discovery_route.js rename to app/assets/javascripts/discourse/routes/discovery-route.js.es6 index a4db51aa2f3..f4e3a0a6867 100644 --- a/app/assets/javascripts/discourse/routes/discovery_route.js +++ b/app/assets/javascripts/discourse/routes/discovery-route.js.es6 @@ -1,13 +1,11 @@ /** - The parent route for all discovery routes. Handles the logic for showing - the loading spinners. - - @class DiscoveryRoute - @extends Discourse.Route - @namespace Discourse - @module Discourse + The parent route for all discovery routes. + Handles the logic for showing the loading spinners. **/ -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(); }, beforeModel: function(transition) { @@ -20,24 +18,21 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse actions: { loading: function() { - var controller = this.controllerFor('discovery'); - - // If we're already loading don't do anything - if (controller.get('loading')) { return; } - controller.set('loading', true); + this.controllerFor('discovery').set("loading", true); return true; }, loadingComplete: function() { - var controller = this.controllerFor('discovery'); - controller.set('loading', false); + this.controllerFor('discovery').set('loading', false); if (!Discourse.Session.currentProp('topicListScrollPosition')) { this._scrollTop(); } }, didTransition: function() { + this.controllerFor("discovery")._showFooter(); this.send('loadingComplete'); + return true; }, // clear a pinned topic @@ -65,3 +60,4 @@ Discourse.DiscoveryRoute = Discourse.Route.extend(Discourse.ScrollTop, Discourse }); +export default Discourse.DiscoveryRoute; diff --git a/app/assets/javascripts/discourse/routes/exception.js.es6 b/app/assets/javascripts/discourse/routes/exception.js.es6 index 26152e058b5..a5c5fab878d 100644 --- a/app/assets/javascripts/discourse/routes/exception.js.es6 +++ b/app/assets/javascripts/discourse/routes/exception.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { serialize: function() { return ""; } diff --git a/app/assets/javascripts/discourse/routes/group-index.js.es6 b/app/assets/javascripts/discourse/routes/group-index.js.es6 index a3a19968c1a..63a1a23f766 100644 --- a/app/assets/javascripts/discourse/routes/group-index.js.es6 +++ b/app/assets/javascripts/discourse/routes/group-index.js.es6 @@ -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() { return this.modelFor('group').findPosts(); }, diff --git a/app/assets/javascripts/discourse/routes/group-members.js.es6 b/app/assets/javascripts/discourse/routes/group-members.js.es6 index 93d12740127..b95fdfd88be 100644 --- a/app/assets/javascripts/discourse/routes/group-members.js.es6 +++ b/app/assets/javascripts/discourse/routes/group-members.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { model: function() { return this.modelFor('group'); }, diff --git a/app/assets/javascripts/discourse/routes/preferences-about.js.es6 b/app/assets/javascripts/discourse/routes/preferences-about.js.es6 index b01c1941e6c..4293cd5f9f4 100644 --- a/app/assets/javascripts/discourse/routes/preferences-about.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-about.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.RestrictedUserRoute.extend({ +import RestrictedUserRoute from "discourse/routes/restricted-user"; + +export default RestrictedUserRoute.extend({ model: function() { return this.modelFor('user'); }, @@ -35,4 +37,3 @@ export default Discourse.RestrictedUserRoute.extend({ } }); - diff --git a/app/assets/javascripts/discourse/routes/preferences-badge-title.js.es6 b/app/assets/javascripts/discourse/routes/preferences-badge-title.js.es6 index 382c61a0f47..0c7a22d8b40 100644 --- a/app/assets/javascripts/discourse/routes/preferences-badge-title.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-badge-title.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.RestrictedUserRoute.extend({ +import RestrictedUserRoute from "discourse/routes/restricted-user"; + +export default RestrictedUserRoute.extend({ model: function() { return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username')); }, diff --git a/app/assets/javascripts/discourse/routes/preferences-card-badge.js.es6 b/app/assets/javascripts/discourse/routes/preferences-card-badge.js.es6 index e75a05092d9..37ad604ec06 100644 --- a/app/assets/javascripts/discourse/routes/preferences-card-badge.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-card-badge.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.RestrictedUserRoute.extend({ +import RestrictedUserRoute from "discourse/routes/restricted-user"; + +export default RestrictedUserRoute.extend({ model: function() { return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username')); }, diff --git a/app/assets/javascripts/discourse/routes/preferences-email.js.es6 b/app/assets/javascripts/discourse/routes/preferences-email.js.es6 index 4c17b9b2884..b9c02c3a850 100644 --- a/app/assets/javascripts/discourse/routes/preferences-email.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-email.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.RestrictedUserRoute.extend({ +import RestrictedUserRoute from "discourse/routes/restricted-user"; + +export default RestrictedUserRoute.extend({ model: function() { return this.modelFor('user'); }, diff --git a/app/assets/javascripts/discourse/routes/preferences-index.js.es6 b/app/assets/javascripts/discourse/routes/preferences-index.js.es6 index 2d3a66111dd..bb568ff6729 100644 --- a/app/assets/javascripts/discourse/routes/preferences-index.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-index.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.RestrictedUserRoute.extend({ +import RestrictedUserRoute from "discourse/routes/restricted-user"; + +export default RestrictedUserRoute.extend({ renderTemplate: function() { this.render('preferences', { into: 'user', controller: 'preferences' }); } diff --git a/app/assets/javascripts/discourse/routes/preferences-username.js.es6 b/app/assets/javascripts/discourse/routes/preferences-username.js.es6 index 2a9bbe0fbb5..09fbc0ec6b0 100644 --- a/app/assets/javascripts/discourse/routes/preferences-username.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences-username.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.RestrictedUserRoute.extend({ +import RestrictedUserRoute from "discourse/routes/restricted-user"; + +export default RestrictedUserRoute.extend({ model: function() { return this.modelFor('user'); }, diff --git a/app/assets/javascripts/discourse/routes/preferences.js.es6 b/app/assets/javascripts/discourse/routes/preferences.js.es6 index 40d879b2a08..6ad9efb5296 100644 --- a/app/assets/javascripts/discourse/routes/preferences.js.es6 +++ b/app/assets/javascripts/discourse/routes/preferences.js.es6 @@ -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() { return this.modelFor('user'); }, setupController: function(controller, user) { controller.setProperties({ model: user, newNameInput: user.get('name') }); - this.controllerFor('user').set('indexStream', false); }, actions: { showAvatarSelector: function() { Discourse.Route.showModal(this, 'avatar-selector'); + // all the properties needed for displaying the avatar selector modal var controller = this.controllerFor('avatar-selector'); var user = this.modelFor('user'); @@ -20,17 +23,17 @@ export default Discourse.RestrictedUserRoute.extend({ 'system_avatar_upload_id', 'gravatar_avatar_upload_id', 'custom_avatar_upload_id' - ); + ); - switch(props.uploaded_avatar_id){ - case props.system_avatar_upload_id: - props.selected = "system"; - break; - case props.gravatar_avatar_upload_id: - props.selected = "gravatar"; - break; - default: - props.selected = "uploaded"; + switch (props.uploaded_avatar_id) { + case props.system_avatar_upload_id: + props.selected = "system"; + break; + case props.gravatar_avatar_upload_id: + props.selected = "gravatar"; + break; + default: + props.selected = "uploaded"; } controller.setProperties(props); @@ -40,7 +43,6 @@ export default Discourse.RestrictedUserRoute.extend({ var user = this.modelFor('user'); var avatarSelector = this.controllerFor('avatar-selector'); - // sends the information to the server if it has changed if (avatarSelector.get('selectedUploadId') !== user.get('uploaded_avatar_id')) { user.pickAvatar(avatarSelector.get('selectedUploadId')); diff --git a/app/assets/javascripts/discourse/routes/restricted-user.js.es6 b/app/assets/javascripts/discourse/routes/restricted-user.js.es6 new file mode 100644 index 00000000000..ad9cb411efd --- /dev/null +++ b/app/assets/javascripts/discourse/routes/restricted-user.js.es6 @@ -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'); + } + } + +}); diff --git a/app/assets/javascripts/discourse/routes/topic-from-params-near.js.es6 b/app/assets/javascripts/discourse/routes/topic-from-params-near.js.es6 new file mode 100644 index 00000000000..8a09c86d36b --- /dev/null +++ b/app/assets/javascripts/discourse/routes/topic-from-params-near.js.es6 @@ -0,0 +1,3 @@ +import TopicFromParamsRoute from "discourse/routes/topic-from-params"; + +export default TopicFromParamsRoute; diff --git a/app/assets/javascripts/discourse/routes/topic_from_params_route.js b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 similarity index 84% rename from app/assets/javascripts/discourse/routes/topic_from_params_route.js rename to app/assets/javascripts/discourse/routes/topic-from-params.js.es6 index bc9e62f052c..0f648039ba8 100644 --- a/app/assets/javascripts/discourse/routes/topic_from_params_route.js +++ b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 @@ -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 - @extends Discourse.Route - @namespace Discourse - @module Discourse -**/ -Discourse.TopicFromParamsRoute = Discourse.Route.extend({ +export default Discourse.Route.extend({ setupController: function(controller, params) { params = params || {}; @@ -56,6 +50,3 @@ Discourse.TopicFromParamsRoute = Discourse.Route.extend({ } }); - -Discourse.TopicFromParamsNearRoute = Discourse.TopicFromParamsRoute; - diff --git a/app/assets/javascripts/discourse/routes/topic_route.js b/app/assets/javascripts/discourse/routes/topic-route.js.es6 similarity index 96% rename from app/assets/javascripts/discourse/routes/topic_route.js rename to app/assets/javascripts/discourse/routes/topic-route.js.es6 index 6f631e6d510..ba13ca1372d 100644 --- a/app/assets/javascripts/discourse/routes/topic_route.js +++ b/app/assets/javascripts/discourse/routes/topic-route.js.es6 @@ -3,7 +3,9 @@ var isTransitioning = false, lastScrollPos = null, 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(); }, queryParams: { @@ -108,7 +110,13 @@ Discourse.TopicRoute = Discourse.Route.extend({ } }, + didTransition: function() { + this.controllerFor("topic")._showFooter(); + return true; + }, + willTransition: function() { + this._super(); this.controllerFor("quote-button").deselectText(); Em.run.cancel(scheduledReplace); isTransitioning = true; @@ -228,3 +236,4 @@ Discourse.TopicRoute = Discourse.Route.extend({ }); RSVP.EventTarget.mixin(Discourse.TopicRoute); +export default Discourse.TopicRoute; diff --git a/app/assets/javascripts/discourse/routes/unknown.js.es6 b/app/assets/javascripts/discourse/routes/unknown.js.es6 new file mode 100644 index 00000000000..db0cde0c52e --- /dev/null +++ b/app/assets/javascripts/discourse/routes/unknown.js.es6 @@ -0,0 +1,5 @@ +export default Discourse.Route.extend({ + model: function() { + return Discourse.ajax("/404-body", { dataType: 'html' }); + } +}); diff --git a/app/assets/javascripts/discourse/routes/unknown_route.js b/app/assets/javascripts/discourse/routes/unknown_route.js deleted file mode 100644 index 334ce027427..00000000000 --- a/app/assets/javascripts/discourse/routes/unknown_route.js +++ /dev/null @@ -1,5 +0,0 @@ -Discourse.UnknownRoute = Discourse.Route.extend({ - model: function() { - return Discourse.ajax("/404-body", {dataType: 'html'}); - } -}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-bookmarks.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-bookmarks.js.es6 new file mode 100644 index 00000000000..ad2b2bd986f --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-bookmarks.js.es6 @@ -0,0 +1,5 @@ +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; + +export default UserActivityStreamRoute.extend({ + userActionType: Discourse.UserAction.TYPES["bookmarks"] +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-edits.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-edits.js.es6 new file mode 100644 index 00000000000..a3192d2a1d7 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-edits.js.es6 @@ -0,0 +1,5 @@ +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; + +export default UserActivityStreamRoute.extend({ + userActionType: Discourse.UserAction.TYPES["edits"] +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-index.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-index.js.es6 new file mode 100644 index 00000000000..3f5ae1272a9 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-index.js.es6 @@ -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; + } + } + +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-likes-given.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-likes-given.js.es6 new file mode 100644 index 00000000000..84ed7b4501d --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-likes-given.js.es6 @@ -0,0 +1,5 @@ +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; + +export default UserActivityStreamRoute.extend({ + userActionType: Discourse.UserAction.TYPES["likes_given"] +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-likes-received.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-likes-received.js.es6 new file mode 100644 index 00000000000..3e7e5cdc4cb --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-likes-received.js.es6 @@ -0,0 +1,5 @@ +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; + +export default UserActivityStreamRoute.extend({ + userActionType: Discourse.UserAction.TYPES["likes_received"] +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-posts.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-posts.js.es6 new file mode 100644 index 00000000000..0be8704abf5 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-posts.js.es6 @@ -0,0 +1,5 @@ +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; + +export default UserActivityStreamRoute.extend({ + userActionType: Discourse.UserAction.TYPES["posts"] +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-replies.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-replies.js.es6 new file mode 100644 index 00000000000..29fd25a2a2a --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-replies.js.es6 @@ -0,0 +1,5 @@ +import UserActivityStreamRoute from "discourse/routes/user-activity-stream"; + +export default UserActivityStreamRoute.extend({ + userActionType: Discourse.UserAction.TYPES["replies"] +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-starred.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-starred.js.es6 new file mode 100644 index 00000000000..2e74e1ddcbe --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-starred.js.es6 @@ -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') }); + } +}); diff --git a/app/assets/javascripts/discourse/routes/user_activity_stream_route.js b/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 similarity index 64% rename from app/assets/javascripts/discourse/routes/user_activity_stream_route.js rename to app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 index 62e8228b89f..712be34bda7 100644 --- a/app/assets/javascripts/discourse/routes/user_activity_stream_route.js +++ b/app/assets/javascripts/discourse/routes/user-activity-stream.js.es6 @@ -1,4 +1,6 @@ -var UserActivityStreamRoute = Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { model: function() { return this.modelFor('user').get('stream'); }, @@ -13,16 +15,16 @@ var UserActivityStreamRoute = Discourse.Route.extend({ setupController: function(controller, model) { controller.set('model', model); - this.controllerFor('user_activity').set('userActionType', this.get('userActionType')); - - this.controllerFor('user').setProperties({ - indexStream: !this.get('userActionType'), - datasource: "stream" - }); + this.controllerFor('user-activity').set('userActionType', this.get('userActionType')); }, actions: { + didTransition: function() { + this.controllerFor("user-activity")._showFooter(); + return true; + }, + removeBookmark: function(userAction) { var self = this; 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] - }); -}); diff --git a/app/assets/javascripts/discourse/routes/user-activity-topics.js.es6 b/app/assets/javascripts/discourse/routes/user-activity-topics.js.es6 new file mode 100644 index 00000000000..ba5e6aa748d --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-activity-topics.js.es6 @@ -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')); + } +}); diff --git a/app/assets/javascripts/discourse/routes/user-activity.js.es6 b/app/assets/javascripts/discourse/routes/user-activity.js.es6 index be81d645739..f214ce88b91 100644 --- a/app/assets/javascripts/discourse/routes/user-activity.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-activity.js.es6 @@ -5,7 +5,6 @@ export default Discourse.Route.extend({ setupController: function(controller, user) { this.controllerFor('user-activity').set('model', user); - this.controllerFor('user').set('pmView', null); // Bring up a draft var composerController = this.controllerFor('composer'); diff --git a/app/assets/javascripts/discourse/routes/user-badges.js.es6 b/app/assets/javascripts/discourse/routes/user-badges.js.es6 index 0ccfa32a0b1..54552578817 100644 --- a/app/assets/javascripts/discourse/routes/user-badges.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-badges.js.es6 @@ -1,14 +1,11 @@ -export default Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { model: function() { return Discourse.UserBadge.findByUsername(this.modelFor('user').get('username_lower'), {grouped: true}); }, setupController: function(controller, model) { - this.controllerFor('user').setProperties({ - indexStream: false, - datasource: "badges", - }); - if (this.controllerFor('user_activity').get('content')) { this.controllerFor('user_activity').set('userActionType', -1); } diff --git a/app/assets/javascripts/discourse/routes/user-deleted-posts.js.es6 b/app/assets/javascripts/discourse/routes/user-deleted-posts.js.es6 new file mode 100644 index 00000000000..75b35d804ff --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-deleted-posts.js.es6 @@ -0,0 +1,3 @@ +import createAdminUserPostsRoute from "discourse/routes/build-admin-user-posts-route"; + +export default createAdminUserPostsRoute("deleted"); diff --git a/app/assets/javascripts/discourse/routes/user-flagged-posts.js.es6 b/app/assets/javascripts/discourse/routes/user-flagged-posts.js.es6 new file mode 100644 index 00000000000..3485c8b72a1 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-flagged-posts.js.es6 @@ -0,0 +1,3 @@ +import createAdminUserPostsRoute from "discourse/routes/build-admin-user-posts-route"; + +export default createAdminUserPostsRoute("flagged"); diff --git a/app/assets/javascripts/discourse/routes/user-index.js.es6 b/app/assets/javascripts/discourse/routes/user-index.js.es6 index 8d46f92be0a..a2e100000ae 100644 --- a/app/assets/javascripts/discourse/routes/user-index.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-index.js.es6 @@ -1,8 +1,7 @@ export default Discourse.Route.extend({ beforeModel: function() { - this.controllerFor('user').set('indexStream', true); - return this.replaceWith('userActivity'); + this.replaceWith('userActivity'); } }); diff --git a/app/assets/javascripts/discourse/routes/user-invited.js.es6 b/app/assets/javascripts/discourse/routes/user-invited.js.es6 index 42acec4a2f9..5a03f2797ac 100644 --- a/app/assets/javascripts/discourse/routes/user-invited.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-invited.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.Route.extend({ +import ShowFooter from "discourse/mixins/show-footer"; + +export default Discourse.Route.extend(ShowFooter, { renderTemplate: function() { this.render({ into: 'user' }); }, @@ -14,7 +16,6 @@ export default Discourse.Route.extend({ searchTerm: '', totalInvites: model.invites.length }); - this.controllerFor('user').set('indexStream', false); }, actions: { diff --git a/app/assets/javascripts/discourse/routes/user-notifications.js.es6 b/app/assets/javascripts/discourse/routes/user-notifications.js.es6 index 2abd0f464ac..d5d942417f9 100644 --- a/app/assets/javascripts/discourse/routes/user-notifications.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-notifications.js.es6 @@ -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() { var user = this.modelFor('user'); return Discourse.NotificationContainer.loadHistory(undefined, user.get('username')); }, setupController: function(controller, model) { - this.controllerFor('user').setProperties({ - indexStream: false, - datasource: "notifications" - }); + controller.set('model', model); + controller.set('user', this.modelFor('user')); if (this.controllerFor('user_activity').get('content')) { this.controllerFor('user_activity').set('userActionType', -1); } - controller.set('model', model); - controller.set('user', this.modelFor('user')); + // properly initialize "canLoadMore" + controller.set("canLoadMore", model.get("length") === 60); }, renderTemplate: function() { diff --git a/app/assets/javascripts/discourse/routes/user-private-messages-index.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages-index.js.es6 new file mode 100644 index 00000000000..5265bfb6703 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-private-messages-index.js.es6 @@ -0,0 +1,3 @@ +import createPMRoute from "discourse/routes/build-user-topic-list-route"; + +export default createPMRoute('index', 'private-messages'); diff --git a/app/assets/javascripts/discourse/routes/user-private-messages-mine.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages-mine.js.es6 new file mode 100644 index 00000000000..47db6999246 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-private-messages-mine.js.es6 @@ -0,0 +1,3 @@ +import createPMRoute from "discourse/routes/build-user-topic-list-route"; + +export default createPMRoute('mine', 'private-messages-sent'); diff --git a/app/assets/javascripts/discourse/routes/user-private-messages-unread.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages-unread.js.es6 new file mode 100644 index 00000000000..19e2a5167d0 --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-private-messages-unread.js.es6 @@ -0,0 +1,3 @@ +import createPMRoute from "discourse/routes/build-user-topic-list-route"; + +export default createPMRoute('unread', 'private-messages-unread'); diff --git a/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 b/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 index b3103444a9e..328a304ca59 100644 --- a/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 +++ b/app/assets/javascripts/discourse/routes/user-private-messages.js.es6 @@ -1,3 +1,11 @@ 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; + } + } +}); diff --git a/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 b/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 new file mode 100644 index 00000000000..5455b03e2fd --- /dev/null +++ b/app/assets/javascripts/discourse/routes/user-topic-list.js.es6 @@ -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 + }); + } +}); diff --git a/app/assets/javascripts/discourse/routes/user.js.es6 b/app/assets/javascripts/discourse/routes/user.js.es6 index 7ae758de0b4..910abb196ff 100644 --- a/app/assets/javascripts/discourse/routes/user.js.es6 +++ b/app/assets/javascripts/discourse/routes/user.js.es6 @@ -1,3 +1,5 @@ +var INDEX_STREAM_ROUTES = ["user.deletedPosts", "user.flaggedPosts", "userActivity.index"]; + export default Discourse.Route.extend({ titleToken: function() { @@ -21,12 +23,19 @@ export default Discourse.Route.extend({ archetypeId: '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) { - // If we're viewing the currently logged in user, return that object - // instead. + // If we're viewing the currently logged in user, return that object instead var currentUser = Discourse.User.current(); if (currentUser && (params.username.toLowerCase() === currentUser.get('username_lower'))) { return currentUser; diff --git a/app/assets/javascripts/discourse/routes/user_admin_posts_routes.js b/app/assets/javascripts/discourse/routes/user_admin_posts_routes.js deleted file mode 100644 index 0eb874627fd..00000000000 --- a/app/assets/javascripts/discourse/routes/user_admin_posts_routes.js +++ /dev/null @@ -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"); diff --git a/app/assets/javascripts/discourse/routes/user_topic_list_routes.js b/app/assets/javascripts/discourse/routes/user_topic_list_routes.js deleted file mode 100644 index 35b4a86ddb5..00000000000 --- a/app/assets/javascripts/discourse/routes/user_topic_list_routes.js +++ /dev/null @@ -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') }); - } -}); diff --git a/app/assets/javascripts/discourse/templates/about.hbs b/app/assets/javascripts/discourse/templates/about.hbs index 2a240a4f59d..09b02a525c3 100644 --- a/app/assets/javascripts/discourse/templates/about.hbs +++ b/app/assets/javascripts/discourse/templates/about.hbs @@ -62,5 +62,3 @@ - -{{custom-html "footer"}} diff --git a/app/assets/javascripts/discourse/templates/application.hbs b/app/assets/javascripts/discourse/templates/application.hbs index 8577bf11f34..b5ff68ac9dd 100644 --- a/app/assets/javascripts/discourse/templates/application.hbs +++ b/app/assets/javascripts/discourse/templates/application.hbs @@ -5,6 +5,10 @@ {{render "user-card"}} +{{#if showFooter}} + {{custom-html "footer"}} +{{/if}} + {{render "modal"}} {{render "topic-entrance"}} {{render "composer"}} diff --git a/app/assets/javascripts/discourse/templates/badges/index.hbs b/app/assets/javascripts/discourse/templates/badges/index.hbs index 5c8197ec3e5..35b52a7fe6e 100644 --- a/app/assets/javascripts/discourse/templates/badges/index.hbs +++ b/app/assets/javascripts/discourse/templates/badges/index.hbs @@ -19,5 +19,3 @@ - -{{custom-html "footer"}} diff --git a/app/assets/javascripts/discourse/templates/badges/show.hbs b/app/assets/javascripts/discourse/templates/badges/show.hbs index d36ae914176..85dc9da6a73 100644 --- a/app/assets/javascripts/discourse/templates/badges/show.hbs +++ b/app/assets/javascripts/discourse/templates/badges/show.hbs @@ -37,8 +37,5 @@ {{loading-spinner condition=canLoadMore}} - {{#unless canLoadMore}} - {{custom-html "footer"}} - {{/unless}} {{/if}} diff --git a/app/assets/javascripts/discourse/templates/discovery.hbs b/app/assets/javascripts/discourse/templates/discovery.hbs index 49b41514837..04c3e4e5e53 100644 --- a/app/assets/javascripts/discourse/templates/discovery.hbs +++ b/app/assets/javascripts/discourse/templates/discovery.hbs @@ -28,6 +28,3 @@ -{{#if loadedAllItems}} - {{custom-html "footer"}} -{{/if}} diff --git a/app/assets/javascripts/discourse/templates/static.hbs b/app/assets/javascripts/discourse/templates/static.hbs index 5e094986f95..e6aa2f99a71 100644 --- a/app/assets/javascripts/discourse/templates/static.hbs +++ b/app/assets/javascripts/discourse/templates/static.hbs @@ -7,5 +7,3 @@ {{/if}} - -{{custom-html "footer"}} diff --git a/app/assets/javascripts/discourse/templates/topic.hbs b/app/assets/javascripts/discourse/templates/topic.hbs index 56cbdb99860..e203fdaf48a 100644 --- a/app/assets/javascripts/discourse/templates/topic.hbs +++ b/app/assets/javascripts/discourse/templates/topic.hbs @@ -134,10 +134,6 @@ {{/if}} -{{#if postStream.loadedAllPosts}} - {{custom-html "footer"}} -{{/if}} - {{render "share"}} {{#if currentUser.enable_quoting}} diff --git a/app/assets/javascripts/discourse/templates/user/user.hbs b/app/assets/javascripts/discourse/templates/user/user.hbs index 2ced5bce857..bf7074dbdfa 100644 --- a/app/assets/javascripts/discourse/templates/user/user.hbs +++ b/app/assets/javascripts/discourse/templates/user/user.hbs @@ -194,7 +194,3 @@ - -{{#if loadedAllItems}} - {{custom-html "footer"}} -{{/if}} diff --git a/app/assets/javascripts/discourse/views/badges-show.js.es6 b/app/assets/javascripts/discourse/views/badges-show.js.es6 index 62790685863..9b74c3e3f93 100644 --- a/app/assets/javascripts/discourse/views/badges-show.js.es6 +++ b/app/assets/javascripts/discourse/views/badges-show.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.View.extend(Discourse.LoadMore, { +import LoadMore from "discourse/mixins/load-more"; + +export default Discourse.View.extend(LoadMore, { eyelineSelector: '.badge-user', tickOrX: function(field){ var icon = this.get('controller.model.' + field) ? "fa-check" : "fa-times"; diff --git a/app/assets/javascripts/discourse/views/discovery-topics.js.es6 b/app/assets/javascripts/discourse/views/discovery-topics.js.es6 index 2885f09e00a..02d374c4ab0 100644 --- a/app/assets/javascripts/discourse/views/discovery-topics.js.es6 +++ b/app/assets/javascripts/discourse/views/discovery-topics.js.es6 @@ -1,6 +1,7 @@ import UrlRefresh from 'discourse/mixins/url-refresh'; +import LoadMore from "discourse/mixins/load-more"; -export default Discourse.View.extend(Discourse.LoadMore, UrlRefresh, { +export default Discourse.View.extend(LoadMore, UrlRefresh, { eyelineSelector: '.topic-list-item', actions: { diff --git a/app/assets/javascripts/discourse/views/group-index.js.es6 b/app/assets/javascripts/discourse/views/group-index.js.es6 index 5f26a832bd0..b1da6e3363c 100644 --- a/app/assets/javascripts/discourse/views/group-index.js.es6 +++ b/app/assets/javascripts/discourse/views/group-index.js.es6 @@ -1,11 +1,5 @@ -/** - Displays all posts within a group +import LoadMore from "discourse/mixins/load-more"; - @class Discourse.GroupIndexView - @extends Ember.Mixin - @namespace Discourse - @module Discourse -**/ -export default Discourse.View.extend(Discourse.ScrollTop, Discourse.LoadMore, { +export default Discourse.View.extend(Discourse.ScrollTop, LoadMore, { eyelineSelector: '.user-stream .item', }); diff --git a/app/assets/javascripts/discourse/views/user-invited.js.es6 b/app/assets/javascripts/discourse/views/user-invited.js.es6 index 55c4d94c857..a94430b7ce3 100644 --- a/app/assets/javascripts/discourse/views/user-invited.js.es6 +++ b/app/assets/javascripts/discourse/views/user-invited.js.es6 @@ -1,4 +1,6 @@ -export default Ember.View.extend(Discourse.LoadMore, { +import LoadMore from "discourse/mixins/load-more"; + +export default Ember.View.extend(LoadMore, { classNames: ['paginated-topics-list'], eyelineSelector: '.paginated-topics-list .invite-list tr', templateName: 'user/invited' diff --git a/app/assets/javascripts/discourse/views/user-notification-history.js.es6 b/app/assets/javascripts/discourse/views/user-notification-history.js.es6 index a31bea4931d..90dfc8e401e 100644 --- a/app/assets/javascripts/discourse/views/user-notification-history.js.es6 +++ b/app/assets/javascripts/discourse/views/user-notification-history.js.es6 @@ -1,4 +1,6 @@ -export default Ember.View.extend(Discourse.LoadMore, { +import LoadMore from "discourse/mixins/load-more"; + +export default Ember.View.extend(LoadMore, { eyelineSelector: '.user-stream .notification', classNames: ['user-stream', 'notification-history'], templateName: 'user/notifications' diff --git a/app/assets/javascripts/discourse/views/user-posts.js.es6 b/app/assets/javascripts/discourse/views/user-posts.js.es6 index ebe35fe0253..6a4d254fcfb 100644 --- a/app/assets/javascripts/discourse/views/user-posts.js.es6 +++ b/app/assets/javascripts/discourse/views/user-posts.js.es6 @@ -1,4 +1,6 @@ -export default Ember.View.extend(Discourse.LoadMore, { +import LoadMore from "discourse/mixins/load-more"; + +export default Ember.View.extend(LoadMore, { loading: false, eyelineSelector: ".user-stream .item", classNames: ["user-stream"], diff --git a/app/assets/javascripts/discourse/views/user-stream.js.es6 b/app/assets/javascripts/discourse/views/user-stream.js.es6 index 09e6eb5dcf7..367c089ed03 100644 --- a/app/assets/javascripts/discourse/views/user-stream.js.es6 +++ b/app/assets/javascripts/discourse/views/user-stream.js.es6 @@ -1,4 +1,6 @@ -export default Ember.View.extend(Discourse.LoadMore, { +import LoadMore from "discourse/mixins/load-more"; + +export default Ember.View.extend(LoadMore, { loading: false, eyelineSelector: '.user-stream .item', classNames: ['user-stream'], diff --git a/app/assets/javascripts/discourse/views/user-topics-list.js.es6 b/app/assets/javascripts/discourse/views/user-topics-list.js.es6 index 21e7e578563..8a97f78ff1c 100644 --- a/app/assets/javascripts/discourse/views/user-topics-list.js.es6 +++ b/app/assets/javascripts/discourse/views/user-topics-list.js.es6 @@ -1,4 +1,6 @@ -export default Discourse.View.extend(Discourse.LoadMore, { +import LoadMore from "discourse/mixins/load-more"; + +export default Discourse.View.extend(LoadMore, { classNames: ['paginated-topics-list'], eyelineSelector: '.paginated-topics-list .topic-list tr', templateName: 'list/user_topics_list' diff --git a/app/assets/javascripts/main_include.js b/app/assets/javascripts/main_include.js index 102cba9b5c5..6e3ca4c7d39 100644 --- a/app/assets/javascripts/main_include.js +++ b/app/assets/javascripts/main_include.js @@ -39,7 +39,10 @@ //= require ./discourse/views/pagedown-preview //= require ./discourse/routes/discourse_route //= require ./discourse/routes/build-topic-route -//= require ./discourse/routes/discourse_restricted_user_route +//= require ./discourse/routes/restricted-user +//= require ./discourse/routes/user-topic-list +//= require ./discourse/routes/user-activity-stream +//= require ./discourse/routes/topic-from-params //= require ./discourse/components/top-title //= require ./discourse/components/text-field //= require ./discourse/components/visible