FIX: some pages were missing the footer
This commit is contained in:
parent
fb65970530
commit
1a5c3b4331
|
@ -1,8 +1,8 @@
|
|||
export default Ember.Controller.extend({
|
||||
showLoginButton: Em.computed.equal('model.path', 'login'),
|
||||
showLoginButton: Em.computed.equal("model.path", "login"),
|
||||
|
||||
actions: {
|
||||
markFaqRead: function() {
|
||||
markFaqRead() {
|
||||
if (this.currentUser) {
|
||||
Discourse.ajax("/users/read-faq", { method: "POST" });
|
||||
}
|
||||
|
|
|
@ -1,37 +1,41 @@
|
|||
var configs = {
|
||||
'faq': 'faq_url',
|
||||
'tos': 'tos_url',
|
||||
'privacy': 'privacy_policy_url'
|
||||
const configs = {
|
||||
"faq": "faq_url",
|
||||
"tos": "tos_url",
|
||||
"privacy": "privacy_policy_url"
|
||||
};
|
||||
|
||||
export default function(page) {
|
||||
export default (page) => {
|
||||
return Discourse.Route.extend({
|
||||
renderTemplate: function() {
|
||||
this.render('static');
|
||||
renderTemplate() {
|
||||
this.render("static");
|
||||
},
|
||||
|
||||
beforeModel: function(transition) {
|
||||
var configKey = configs[page];
|
||||
beforeModel(transition) {
|
||||
const configKey = configs[page];
|
||||
if (configKey && Discourse.SiteSettings[configKey].length > 0) {
|
||||
transition.abort();
|
||||
Discourse.URL.redirectTo(Discourse.SiteSettings[configKey]);
|
||||
}
|
||||
},
|
||||
|
||||
activate: function() {
|
||||
activate() {
|
||||
this._super();
|
||||
|
||||
// Scroll to an element if exists
|
||||
Discourse.URL.scrollToId(document.location.hash);
|
||||
},
|
||||
|
||||
model: function() {
|
||||
model() {
|
||||
return Discourse.StaticPage.find(page);
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
this.controllerFor('static').set('model', model);
|
||||
setupController(controller, model) {
|
||||
this.controllerFor("static").set("model", model);
|
||||
},
|
||||
|
||||
actions: {
|
||||
didTransition() {
|
||||
this.controllerFor("application").set("showFooter", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
export default Discourse.Route.extend({
|
||||
model: function() {
|
||||
return Discourse.ajax("/about.json").then(function(result) {
|
||||
return result.about;
|
||||
});
|
||||
model() {
|
||||
return Discourse.ajax("/about.json").then(result => result.about);
|
||||
},
|
||||
|
||||
titleToken: function() {
|
||||
titleToken() {
|
||||
return I18n.t('about.simple_title');
|
||||
},
|
||||
|
||||
actions: {
|
||||
didTransition() {
|
||||
this.controllerFor("application").set("showFooter", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
export default Discourse.Route.extend({
|
||||
model: function() {
|
||||
if (PreloadStore.get('badges')) {
|
||||
return PreloadStore.getAndRemove('badges').then(function(json) {
|
||||
return Discourse.Badge.createFromJson(json);
|
||||
});
|
||||
model() {
|
||||
if (PreloadStore.get("badges")) {
|
||||
return PreloadStore.getAndRemove("badges").then(json => Discourse.Badge.createFromJson(json));
|
||||
} else {
|
||||
return Discourse.Badge.findAll({onlyListable: true});
|
||||
return Discourse.Badge.findAll({ onlyListable: true });
|
||||
}
|
||||
},
|
||||
|
||||
titleToken: function() {
|
||||
return I18n.t('badges.title');
|
||||
titleToken() {
|
||||
return I18n.t("badges.title");
|
||||
},
|
||||
|
||||
actions: {
|
||||
didTransition() {
|
||||
this.controllerFor("application").set("showFooter", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
export default Discourse.Route.extend({
|
||||
actions: {
|
||||
didTransition: function() {
|
||||
didTransition() {
|
||||
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()};
|
||||
serialize(model) {
|
||||
return {
|
||||
id: model.get("id"),
|
||||
slug: model.get("name").replace(/[^A-Za-z0-9_]+/g, "-").toLowerCase()
|
||||
};
|
||||
},
|
||||
|
||||
model: function(params) {
|
||||
if (PreloadStore.get('badge')) {
|
||||
return PreloadStore.getAndRemove('badge').then(function(json) {
|
||||
return Discourse.Badge.createFromJson(json);
|
||||
});
|
||||
model(params) {
|
||||
if (PreloadStore.get("badge")) {
|
||||
return PreloadStore.getAndRemove("badge").then(json => Discourse.Badge.createFromJson(json));
|
||||
} else {
|
||||
return Discourse.Badge.findById(params.id);
|
||||
}
|
||||
},
|
||||
|
||||
afterModel: function(model) {
|
||||
var self = this;
|
||||
return Discourse.UserBadge.findByBadgeId(model.get('id')).then(function(userBadges) {
|
||||
self.userBadges = userBadges;
|
||||
afterModel(model) {
|
||||
return Discourse.UserBadge.findByBadgeId(model.get("id")).then(userBadges => {
|
||||
this.userBadges = userBadges;
|
||||
});
|
||||
},
|
||||
|
||||
titleToken: function() {
|
||||
var model = this.modelFor('badges.show');
|
||||
titleToken() {
|
||||
const model = this.modelFor("badges.show");
|
||||
if (model) {
|
||||
return model.get('displayName');
|
||||
return model.get("displayName");
|
||||
}
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set('userBadges', this.userBadges);
|
||||
setupController(controller, model) {
|
||||
controller.set("model", model);
|
||||
controller.set("userBadges", this.userBadges);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ const DiscourseRoute = Ember.Route.extend({
|
|||
// changes
|
||||
resfreshQueryWithoutTransition: false,
|
||||
|
||||
refresh: function() {
|
||||
refresh() {
|
||||
if (!this.refreshQueryWithoutTransition) { return this._super(); }
|
||||
|
||||
if (!this.router.router.activeTransition) {
|
||||
|
@ -17,13 +17,13 @@ const DiscourseRoute = Ember.Route.extend({
|
|||
}
|
||||
},
|
||||
|
||||
_refreshTitleOnce: function() {
|
||||
_refreshTitleOnce() {
|
||||
this.send('_collectTitleTokens', []);
|
||||
},
|
||||
|
||||
actions: {
|
||||
|
||||
_collectTitleTokens: function(tokens) {
|
||||
_collectTitleTokens(tokens) {
|
||||
// If there's a title token method, call it and get the token
|
||||
if (this.titleToken) {
|
||||
const t = this.titleToken();
|
||||
|
@ -40,19 +40,19 @@ const DiscourseRoute = Ember.Route.extend({
|
|||
return true;
|
||||
},
|
||||
|
||||
refreshTitle: function() {
|
||||
refreshTitle() {
|
||||
Ember.run.once(this, this._refreshTitleOnce);
|
||||
}
|
||||
},
|
||||
|
||||
redirectIfLoginRequired: function() {
|
||||
redirectIfLoginRequired() {
|
||||
const app = this.controllerFor('application');
|
||||
if (app.get('loginRequired')) {
|
||||
this.replaceWith('login');
|
||||
}
|
||||
},
|
||||
|
||||
openTopicDraft: function(model){
|
||||
openTopicDraft(model){
|
||||
// If there's a draft, open the create topic composer
|
||||
if (model.draft) {
|
||||
const composer = this.controllerFor('composer');
|
||||
|
@ -67,7 +67,7 @@ const DiscourseRoute = Ember.Route.extend({
|
|||
}
|
||||
},
|
||||
|
||||
isPoppedState: function(transition) {
|
||||
isPoppedState(transition) {
|
||||
return (!transition._discourse_intercepted) && (!!transition.intent.url);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import showModal from 'discourse/lib/show-modal';
|
||||
import showModal from "discourse/lib/show-modal";
|
||||
import OpenComposer from "discourse/mixins/open-composer";
|
||||
|
||||
Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
||||
renderTemplate() {
|
||||
this.render('navigation/categories', { outlet: 'navigation-bar' });
|
||||
this.render('discovery/categories', { outlet: 'list-container' });
|
||||
this.render("navigation/categories", { outlet: "navigation-bar" });
|
||||
this.render("discovery/categories", { outlet: "list-container" });
|
||||
},
|
||||
|
||||
beforeModel() {
|
||||
this.controllerFor('navigation/categories').set('filterMode', 'categories');
|
||||
this.controllerFor("navigation/categories").set("filterMode", "categories");
|
||||
},
|
||||
|
||||
model() {
|
||||
|
@ -16,11 +16,11 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
|||
// if default page is categories
|
||||
PreloadStore.remove("topic_list");
|
||||
|
||||
return Discourse.CategoryList.list('categories').then(function(list) {
|
||||
return Discourse.CategoryList.list("categories").then(function(list) {
|
||||
const tracking = Discourse.TopicTrackingState.current();
|
||||
if (tracking) {
|
||||
tracking.sync(list, 'categories');
|
||||
tracking.trackIncoming('categories');
|
||||
tracking.sync(list, "categories");
|
||||
tracking.trackIncoming("categories");
|
||||
}
|
||||
return list;
|
||||
});
|
||||
|
@ -28,15 +28,15 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
|||
|
||||
titleToken() {
|
||||
if (Discourse.Utilities.defaultHomepage() === "categories") { return; }
|
||||
return I18n.t('filters.categories.title');
|
||||
return I18n.t("filters.categories.title");
|
||||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
controller.set('model', model);
|
||||
controller.set("model", model);
|
||||
|
||||
// Only show either the Create Category or Create Topic button
|
||||
this.controllerFor('navigation/categories').set('canCreateCategory', model.get('can_create_category'));
|
||||
this.controllerFor('navigation/categories').set('canCreateTopic', model.get('can_create_topic') && !model.get('can_create_category'));
|
||||
this.controllerFor("navigation/categories").set("canCreateCategory", model.get("can_create_category"));
|
||||
this.controllerFor("navigation/categories").set("canCreateTopic", model.get("can_create_topic") && !model.get("can_create_category"));
|
||||
|
||||
this.openTopicDraft(model);
|
||||
},
|
||||
|
@ -44,20 +44,24 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(OpenComposer, {
|
|||
actions: {
|
||||
createCategory() {
|
||||
const groups = this.site.groups,
|
||||
everyoneName = groups.findBy('id', 0).name;
|
||||
everyoneName = groups.findBy("id", 0).name;
|
||||
|
||||
const model = Discourse.Category.create({
|
||||
color: 'AB9364', text_color: 'FFFFFF', group_permissions: [{group_name: everyoneName, permission_type: 1}],
|
||||
color: "AB9364", text_color: "FFFFFF", group_permissions: [{group_name: everyoneName, permission_type: 1}],
|
||||
available_groups: groups.map(g => g.name),
|
||||
allow_badges: true
|
||||
});
|
||||
|
||||
showModal('editCategory', { model });
|
||||
this.controllerFor('editCategory').set('selectedTab', 'general');
|
||||
showModal("editCategory", { model });
|
||||
this.controllerFor("editCategory").set("selectedTab", "general");
|
||||
},
|
||||
|
||||
createTopic() {
|
||||
this.openComposer(this.controllerFor('discovery/categories'));
|
||||
this.openComposer(this.controllerFor("discovery/categories"));
|
||||
},
|
||||
|
||||
didTransition() {
|
||||
this.controllerFor("application").set("showFooter", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -12,5 +12,11 @@ export default Discourse.Route.extend(ViewingActionType, {
|
|||
|
||||
renderTemplate() {
|
||||
this.render("user/badges", {into: "user"});
|
||||
},
|
||||
|
||||
actions: {
|
||||
didTransition() {
|
||||
this.controllerFor("application").set("showFooter", true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue