FIX: footer should also be hidden when using back/forward buttons
This commit is contained in:
parent
d7aa4e81d6
commit
fb65970530
|
@ -725,7 +725,8 @@ export default ObjectController.extend(SelectedPostsCount, BufferedContent, {
|
||||||
},
|
},
|
||||||
|
|
||||||
_showFooter: function() {
|
_showFooter: function() {
|
||||||
this.set("controllers.application.showFooter", this.get("model.postStream.loadedAllPosts"));
|
const showFooter = this.get("model.postStream.loaded") && this.get("model.postStream.loadedAllPosts");
|
||||||
}.observes("model.postStream.loadedAllPosts")
|
this.set("controllers.application.showFooter", showFooter);
|
||||||
|
}.observes("model.postStream.{loaded,loadedAllPosts}")
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
export default {
|
||||||
|
name: "show-footer",
|
||||||
|
|
||||||
|
initialize(container) {
|
||||||
|
const router = container.lookup("router:main");
|
||||||
|
const application = container.lookup("controller:application");
|
||||||
|
|
||||||
|
// only take care of hiding the footer here
|
||||||
|
// controllers MUST take care of displaying it
|
||||||
|
router.on("willTransition", () => {
|
||||||
|
application.set("showFooter", false);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,5 +1,3 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
|
|
||||||
var configs = {
|
var configs = {
|
||||||
'faq': 'faq_url',
|
'faq': 'faq_url',
|
||||||
'tos': 'tos_url',
|
'tos': 'tos_url',
|
||||||
|
@ -7,7 +5,7 @@ var configs = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function(page) {
|
export default function(page) {
|
||||||
return Discourse.Route.extend(ShowFooter, {
|
return Discourse.Route.extend({
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
this.render('static');
|
this.render('static');
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
export default Em.Mixin.create({
|
|
||||||
actions: {
|
|
||||||
didTransition() {
|
|
||||||
Em.run.schedule("afterRender", () => {
|
|
||||||
this.controllerFor("application").set("showFooter", true);
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
|
|
||||||
willTransition() {
|
|
||||||
this.controllerFor("application").set("showFooter", false);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
|
@ -1,6 +1,4 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
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,6 +1,4 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, {
|
|
||||||
actions: {
|
actions: {
|
||||||
didTransition: function() {
|
didTransition: function() {
|
||||||
this.controllerFor("badges/show")._showFooter();
|
this.controllerFor("badges/show")._showFooter();
|
||||||
|
|
|
@ -1,31 +1,29 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
|
|
||||||
export default function (filter) {
|
export default function (filter) {
|
||||||
return Discourse.Route.extend(ShowFooter, {
|
return Discourse.Route.extend({
|
||||||
actions: {
|
actions: {
|
||||||
didTransition: function() {
|
didTransition() {
|
||||||
this.controllerFor('user').set('indexStream', true);
|
this.controllerFor("user").set("indexStream", true);
|
||||||
this.controllerFor("user-posts")._showFooter();
|
this.controllerFor("user-posts")._showFooter();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
model: function () {
|
model() {
|
||||||
return this.modelFor("user").get("postsStream");
|
return this.modelFor("user").get("postsStream");
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel: function () {
|
afterModel() {
|
||||||
return this.modelFor("user").get("postsStream").filterBy(filter);
|
return this.modelFor("user").get("postsStream").filterBy(filter);
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController(controller, model) {
|
||||||
// initialize "canLoadMore"
|
// initialize "canLoadMore"
|
||||||
model.set("canLoadMore", model.get("itemsLoaded") === 60);
|
model.set("canLoadMore", model.get("itemsLoaded") === 60);
|
||||||
|
|
||||||
this.controllerFor("user-posts").set("model", model);
|
this.controllerFor("user-posts").set("model", model);
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate() {
|
||||||
this.render("user/posts", { into: "user" });
|
this.render("user/posts", { into: "user" });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,36 +1,35 @@
|
||||||
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
import UserTopicListRoute from "discourse/routes/user-topic-list";
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
|
|
||||||
// A helper to build a user topic list route
|
// A helper to build a user topic list route
|
||||||
export default function (viewName, path) {
|
export default (viewName, path) => {
|
||||||
return UserTopicListRoute.extend(ShowFooter, {
|
return UserTopicListRoute.extend({
|
||||||
userActionType: Discourse.UserAction.TYPES.messages_received,
|
userActionType: Discourse.UserAction.TYPES.messages_received,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
didTransition: function() {
|
didTransition() {
|
||||||
this.controllerFor("user-topics-list")._showFooter();
|
this.controllerFor("user-topics-list")._showFooter();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
model: function() {
|
model() {
|
||||||
return this.store.findFiltered('topicList', {filter: 'topics/' + path + '/' + this.modelFor('user').get('username_lower')});
|
return this.store.findFiltered("topicList", { filter: "topics/" + path + "/" + this.modelFor("user").get("username_lower") });
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function() {
|
setupController() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
this.controllerFor('user-topics-list').setProperties({
|
this.controllerFor("user-topics-list").setProperties({
|
||||||
hideCategory: true,
|
hideCategory: true,
|
||||||
showParticipants: true
|
showParticipants: true
|
||||||
});
|
});
|
||||||
|
|
||||||
this.controllerFor('user').set('pmView', viewName);
|
this.controllerFor("user").set("pmView", viewName);
|
||||||
this.controllerFor('search').set('contextType', 'private_messages');
|
this.controllerFor("search").set("contextType", "private_messages");
|
||||||
},
|
},
|
||||||
|
|
||||||
deactivate: function(){
|
deactivate() {
|
||||||
this.controllerFor('search').set('contextType', 'user');
|
this.controllerFor("search").set("contextType", "user");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import ShowFooter from 'discourse/mixins/show-footer';
|
|
||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
import OpenComposer from "discourse/mixins/open-composer";
|
import OpenComposer from "discourse/mixins/open-composer";
|
||||||
|
|
||||||
Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, ShowFooter, {
|
Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
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' });
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
The parent route for all discovery routes.
|
The parent route for all discovery routes.
|
||||||
Handles the logic for showing the loading spinners.
|
Handles the logic for showing the loading spinners.
|
||||||
**/
|
**/
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
import OpenComposer from "discourse/mixins/open-composer";
|
import OpenComposer from "discourse/mixins/open-composer";
|
||||||
import { scrollTop } from 'discourse/mixins/scroll-top';
|
import { scrollTop } from 'discourse/mixins/scroll-top';
|
||||||
|
|
||||||
const DiscoveryRoute = Discourse.Route.extend(OpenComposer, ShowFooter, {
|
const DiscoveryRoute = Discourse.Route.extend(OpenComposer, {
|
||||||
redirect: function() { return this.redirectIfLoginRequired(); },
|
redirect() {
|
||||||
|
return this.redirectIfLoginRequired();
|
||||||
|
},
|
||||||
|
|
||||||
beforeModel: function(transition) {
|
beforeModel(transition) {
|
||||||
if (transition.intent.url === "/" &&
|
if (transition.intent.url === "/" &&
|
||||||
transition.targetName.indexOf("discovery.top") === -1 &&
|
transition.targetName.indexOf("discovery.top") === -1 &&
|
||||||
Discourse.User.currentProp("should_be_redirected_to_top")) {
|
Discourse.User.currentProp("should_be_redirected_to_top")) {
|
||||||
|
@ -19,30 +20,30 @@ const DiscoveryRoute = Discourse.Route.extend(OpenComposer, ShowFooter, {
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loading: function() {
|
loading() {
|
||||||
this.controllerFor('discovery').set("loading", true);
|
this.controllerFor('discovery').set("loading", true);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
loadingComplete: function() {
|
loadingComplete() {
|
||||||
this.controllerFor('discovery').set('loading', false);
|
this.controllerFor('discovery').set('loading', false);
|
||||||
if (!this.session.get('topicListScrollPosition')) {
|
if (!this.session.get('topicListScrollPosition')) {
|
||||||
scrollTop();
|
scrollTop();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
didTransition: function() {
|
didTransition() {
|
||||||
this.controllerFor("discovery")._showFooter();
|
this.controllerFor("discovery")._showFooter();
|
||||||
this.send('loadingComplete');
|
this.send('loadingComplete');
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
// clear a pinned topic
|
// clear a pinned topic
|
||||||
clearPin: function(topic) {
|
clearPin(topic) {
|
||||||
topic.clearPin();
|
topic.clearPin();
|
||||||
},
|
},
|
||||||
|
|
||||||
createTopic: function() {
|
createTopic() {
|
||||||
this.openComposer(this.controllerFor('discovery/topics'));
|
this.openComposer(this.controllerFor('discovery/topics'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,3 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
export default Discourse.Route.extend({
|
||||||
|
serialize() { return ""; }
|
||||||
export default Discourse.Route.extend(ShowFooter, {
|
|
||||||
serialize: function() {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, {
|
|
||||||
actions: {
|
actions: {
|
||||||
didTransition: function() {
|
didTransition() { return true; }
|
||||||
return true;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
model: function() {
|
model() {
|
||||||
return this.modelFor('group').findPosts();
|
return this.modelFor("group").findPosts();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set('model', model);
|
controller.set("model", model);
|
||||||
this.controllerFor('group').set('showing', 'index');
|
this.controllerFor("group").set("showing", "index");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, {
|
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor('group');
|
return this.modelFor("group");
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
this.controllerFor('group').set('showing', 'members');
|
this.controllerFor("group").set("showing", "members");
|
||||||
controller.set("model", model);
|
controller.set("model", model);
|
||||||
model.findMembers();
|
model.findMembers();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
import RestrictedUserRoute from "discourse/routes/restricted-user";
|
||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
|
|
||||||
export default RestrictedUserRoute.extend(ShowFooter, {
|
export default RestrictedUserRoute.extend({
|
||||||
model() {
|
model() {
|
||||||
return this.modelFor('user');
|
return this.modelFor('user');
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,10 +4,9 @@ let isTransitioning = false,
|
||||||
|
|
||||||
const SCROLL_DELAY = 500;
|
const SCROLL_DELAY = 500;
|
||||||
|
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
import showModal from 'discourse/lib/show-modal';
|
import showModal from 'discourse/lib/show-modal';
|
||||||
|
|
||||||
const TopicRoute = Discourse.Route.extend(ShowFooter, {
|
const TopicRoute = Discourse.Route.extend({
|
||||||
redirect() { return this.redirectIfLoginRequired(); },
|
redirect() { return this.redirectIfLoginRequired(); },
|
||||||
|
|
||||||
queryParams: {
|
queryParams: {
|
||||||
|
|
|
@ -1,32 +1,31 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
import ViewingActionType from "discourse/mixins/viewing-action-type";
|
import ViewingActionType from "discourse/mixins/viewing-action-type";
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, ViewingActionType, {
|
export default Discourse.Route.extend(ViewingActionType, {
|
||||||
model: function() {
|
model() {
|
||||||
return this.modelFor('user').get('stream');
|
return this.modelFor('user').get('stream');
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel: function() {
|
afterModel() {
|
||||||
return this.modelFor('user').get('stream').filterBy(this.get('userActionType'));
|
return this.modelFor('user').get('stream').filterBy(this.get('userActionType'));
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate() {
|
||||||
this.render('user_stream');
|
this.render('user_stream');
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set('model', model);
|
controller.set('model', model);
|
||||||
this.viewingActionType(this.get('userActionType'));
|
this.viewingActionType(this.get('userActionType'));
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
|
||||||
didTransition: function() {
|
didTransition() {
|
||||||
this.controllerFor("user-activity")._showFooter();
|
this.controllerFor("user-activity")._showFooter();
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeBookmark: function(userAction) {
|
removeBookmark(userAction) {
|
||||||
var user = this.modelFor('user');
|
var user = this.modelFor('user');
|
||||||
Discourse.Post.updateBookmark(userAction.get('post_id'), false)
|
Discourse.Post.updateBookmark(userAction.get('post_id'), false)
|
||||||
.then(function() {
|
.then(function() {
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
import ViewingActionType from "discourse/mixins/viewing-action-type";
|
import ViewingActionType from "discourse/mixins/viewing-action-type";
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, ViewingActionType, {
|
export default Discourse.Route.extend(ViewingActionType, {
|
||||||
model: function() {
|
model() {
|
||||||
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(controller, model) {
|
||||||
this.viewingActionType(-1);
|
this.viewingActionType(-1);
|
||||||
controller.set('model', model);
|
controller.set("model", model);
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate() {
|
||||||
this.render('user/badges', {into: 'user'});
|
this.render("user/badges", {into: "user"});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,33 +1,32 @@
|
||||||
import ShowFooter from 'discourse/mixins/show-footer';
|
import showModal from "discourse/lib/show-modal";
|
||||||
import showModal from 'discourse/lib/show-modal';
|
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, {
|
export default Discourse.Route.extend({
|
||||||
|
|
||||||
model: function(params) {
|
model(params) {
|
||||||
this.inviteFilter = params.filter;
|
this.inviteFilter = params.filter;
|
||||||
return Discourse.Invite.findInvitedBy(this.modelFor('user'), params.filter);
|
return Discourse.Invite.findInvitedBy(this.modelFor("user"), params.filter);
|
||||||
},
|
},
|
||||||
|
|
||||||
afterModel: function(model) {
|
afterModel(model) {
|
||||||
if (!model.can_see_invite_details) {
|
if (!model.can_see_invite_details) {
|
||||||
this.replaceWith('userInvited.show', 'redeemed');
|
this.replaceWith("userInvited.show", "redeemed");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
model: model,
|
model: model,
|
||||||
user: this.controllerFor('user').get('model'),
|
user: this.controllerFor("user").get("model"),
|
||||||
filter: this.inviteFilter,
|
filter: this.inviteFilter,
|
||||||
searchTerm: '',
|
searchTerm: "",
|
||||||
totalInvites: model.invites.length
|
totalInvites: model.invites.length
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
showInvite() {
|
showInvite() {
|
||||||
showModal('invite', { model: this.currentUser });
|
showModal("invite", { model: this.currentUser });
|
||||||
this.controllerFor('invite').reset();
|
this.controllerFor("invite").reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
uploadSuccess(filename) {
|
uploadSuccess(filename) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import ShowFooter from "discourse/mixins/show-footer";
|
|
||||||
import ViewingActionType from "discourse/mixins/viewing-action-type";
|
import ViewingActionType from "discourse/mixins/viewing-action-type";
|
||||||
|
|
||||||
export default Discourse.Route.extend(ShowFooter, ViewingActionType, {
|
export default Discourse.Route.extend(ViewingActionType, {
|
||||||
actions: {
|
actions: {
|
||||||
didTransition() {
|
didTransition() {
|
||||||
this.controllerFor("user-notifications")._showFooter();
|
this.controllerFor("user-notifications")._showFooter();
|
||||||
|
@ -10,13 +9,13 @@ export default Discourse.Route.extend(ShowFooter, ViewingActionType, {
|
||||||
},
|
},
|
||||||
|
|
||||||
model() {
|
model() {
|
||||||
var user = this.modelFor('user');
|
var user = this.modelFor("user");
|
||||||
return this.store.find('notification', {username: user.get('username')});
|
return this.store.find("notification", { username: user.get("username") });
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
controller.set('model', model);
|
controller.set("model", model);
|
||||||
controller.set('user', this.modelFor('user'));
|
controller.set("user", this.modelFor("user"));
|
||||||
this.viewingActionType(-1);
|
this.viewingActionType(-1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue