FIX: footer was missing in some pages
- error pages - search results pages - list of all tags - topics list of a specific tag - user leaderboard
This commit is contained in:
parent
d1994cad27
commit
35e6e5ff67
|
@ -1,32 +1,39 @@
|
||||||
import DiscourseController from 'discourse/controllers/controller';
|
import DiscourseController from "discourse/controllers/controller";
|
||||||
import { translateResults } from 'discourse/lib/search-for-term';
|
import { translateResults } from "discourse/lib/search-for-term";
|
||||||
|
|
||||||
export default DiscourseController.extend({
|
export default DiscourseController.extend({
|
||||||
loading: Em.computed.not('model'),
|
needs: ["application"],
|
||||||
queryParams: ['q'],
|
|
||||||
|
loading: Em.computed.not("model"),
|
||||||
|
queryParams: ["q"],
|
||||||
q: null,
|
q: null,
|
||||||
modelChanged: function(){
|
|
||||||
if (this.get('searchTerm') !== this.get('q')) {
|
|
||||||
this.set('searchTerm', this.get('q'));
|
|
||||||
}
|
|
||||||
}.observes('model'),
|
|
||||||
|
|
||||||
qChanged: function(){
|
modelChanged: function() {
|
||||||
var model = this.get('model');
|
if (this.get("searchTerm") !== this.get("q")) {
|
||||||
if (model && this.get('model.q') !== this.get('q')){
|
this.set("searchTerm", this.get("q"));
|
||||||
this.set('searchTerm', this.get('q'));
|
|
||||||
this.send('search');
|
|
||||||
}
|
}
|
||||||
}.observes('q'),
|
}.observes("model"),
|
||||||
|
|
||||||
|
qChanged: function() {
|
||||||
|
const model = this.get("model");
|
||||||
|
if (model && this.get("model.q") !== this.get("q")) {
|
||||||
|
this.set("searchTerm", this.get("q"));
|
||||||
|
this.send("search");
|
||||||
|
}
|
||||||
|
}.observes("q"),
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", !this.get("loading"));
|
||||||
|
}.observes("loading"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
search: function(){
|
search() {
|
||||||
var self = this;
|
this.set("q", this.get("searchTerm"));
|
||||||
this.set('q', this.get('searchTerm'));
|
this.set("model", null);
|
||||||
this.set('model', null);
|
|
||||||
|
|
||||||
Discourse.ajax('/search', {data: {q: this.get('searchTerm')}}).then(function(results) {
|
Discourse.ajax("/search", { data: { q: this.get("searchTerm") } }).then(results => {
|
||||||
self.set('model', translateResults(results) || {});
|
this.set("model", translateResults(results) || {});
|
||||||
self.set('model.q', self.get('q'));
|
this.set("model.q", this.get("q"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,24 @@
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
queryParams: ['period', 'order', 'asc', 'name'],
|
needs: ["application"],
|
||||||
period: 'weekly',
|
queryParams: ["period", "order", "asc", "name"],
|
||||||
order: 'likes_received',
|
period: "weekly",
|
||||||
|
order: "likes_received",
|
||||||
asc: null,
|
asc: null,
|
||||||
name: '',
|
name: "",
|
||||||
|
|
||||||
showTimeRead: Ember.computed.equal('period', 'all'),
|
showTimeRead: Ember.computed.equal("period", "all"),
|
||||||
|
|
||||||
_setName: Discourse.debounce(function() {
|
_setName: Discourse.debounce(function() {
|
||||||
this.set('name', this.get('nameInput'));
|
this.set("name", this.get("nameInput"));
|
||||||
}, 500).observes('nameInput'),
|
}, 500).observes("nameInput"),
|
||||||
|
|
||||||
|
_showFooter: function() {
|
||||||
|
this.set("controllers.application.showFooter", !this.get("model.canLoadMore"));
|
||||||
|
}.observes("model.canLoadMore"),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore() {
|
loadMore() {
|
||||||
this.get('model').loadMore();
|
this.get("model").loadMore();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import RestModel from 'discourse/models/rest';
|
import RestModel from 'discourse/models/rest';
|
||||||
import Model from 'discourse/models/model';
|
import Model from 'discourse/models/model';
|
||||||
|
|
||||||
|
|
||||||
function topicsFrom(result, store) {
|
function topicsFrom(result, store) {
|
||||||
if (!result) { return; }
|
if (!result) { return; }
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
||||||
error(err, transition) {
|
error(err, transition) {
|
||||||
if (err.status === 404) {
|
if (err.status === 404) {
|
||||||
// 404
|
// 404
|
||||||
this.intermediateTransitionTo('unknown');
|
this.transitionTo('unknown');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
||||||
}
|
}
|
||||||
exceptionController.setProperties({ lastTransition: transition, thrown: err });
|
exceptionController.setProperties({ lastTransition: transition, thrown: err });
|
||||||
|
|
||||||
this.intermediateTransitionTo('exception');
|
this.transitionTo('exception');
|
||||||
},
|
},
|
||||||
|
|
||||||
showLogin: unlessReadOnly('handleShowLogin'),
|
showLogin: unlessReadOnly('handleShowLogin'),
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
serialize() { return ""; }
|
serialize() { return ""; },
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
didTransition() {
|
||||||
|
this.controllerFor("application").set("showFooter", true);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
import { translateResults } from 'discourse/lib/search-for-term';
|
import { translateResults } from "discourse/lib/search-for-term";
|
||||||
|
|
||||||
export default Discourse.Route.extend({
|
export default Discourse.Route.extend({
|
||||||
queryParams: {
|
queryParams: { q: {} },
|
||||||
q: {
|
|
||||||
}
|
model(params) {
|
||||||
},
|
|
||||||
model: function(params) {
|
|
||||||
return PreloadStore.getAndRemove("search", function() {
|
return PreloadStore.getAndRemove("search", function() {
|
||||||
return Discourse.ajax('/search', {data: {q: params.q}});
|
return Discourse.ajax("/search", { data: { q: params.q } });
|
||||||
}).then(function(results){
|
}).then(results => {
|
||||||
var model = translateResults(results) || {};
|
const model = translateResults(results) || {};
|
||||||
model.q = params.q;
|
model.q = params.q;
|
||||||
return model;
|
return model;
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
didTransition() {
|
||||||
|
this.controllerFor("full-page-search")._showFooter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,16 +9,16 @@ export default Discourse.Route.extend({
|
||||||
refreshQueryWithoutTransition: true,
|
refreshQueryWithoutTransition: true,
|
||||||
|
|
||||||
titleToken() {
|
titleToken() {
|
||||||
return I18n.t('directory.title');
|
return I18n.t("directory.title");
|
||||||
},
|
},
|
||||||
|
|
||||||
resetController(controller, isExiting) {
|
resetController(controller, isExiting) {
|
||||||
if (isExiting) {
|
if (isExiting) {
|
||||||
controller.setProperties({
|
controller.setProperties({
|
||||||
period: 'weekly',
|
period: "weekly",
|
||||||
order: 'likes_received',
|
order: "likes_received",
|
||||||
asc: null,
|
asc: null,
|
||||||
name: ''
|
name: ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -26,11 +26,18 @@ export default Discourse.Route.extend({
|
||||||
model(params) {
|
model(params) {
|
||||||
// If we refresh via `refreshModel` set the old model to loading
|
// If we refresh via `refreshModel` set the old model to loading
|
||||||
this._params = params;
|
this._params = params;
|
||||||
return this.store.find('directoryItem', params);
|
return this.store.find("directoryItem", params);
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController(controller, model) {
|
setupController(controller, model) {
|
||||||
const params = this._params;
|
const params = this._params;
|
||||||
controller.setProperties({ model, period: params.period, nameInput: params.name });
|
controller.setProperties({ model, period: params.period, nameInput: params.name });
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
didTransition() {
|
||||||
|
this.controllerFor("users")._showFooter();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,45 +1,45 @@
|
||||||
<div class="search row">
|
<div class="search row">
|
||||||
{{input type="text" value=searchTerm class="input-xxlarge search no-blur" action="search"}}
|
{{input type="text" value=searchTerm class="input-xxlarge search no-blur" action="search"}}
|
||||||
<button {{action "search"}} class="btn btn-primary"><i class='fa fa-search'></i></button>
|
{{d-button action="search" icon="search" class="btn-primary"}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{#conditional-loading-spinner condition=loading}}
|
{{#conditional-loading-spinner condition=loading}}
|
||||||
|
|
||||||
{{#unless model.posts}}
|
{{#unless model.posts}}
|
||||||
<h3>{{i18n "search.no_results"}} <a href class="show-help" {{action "showSearchHelp" bubbles=false}}>{{i18n "search.search_help"}}</a>
|
<h3>
|
||||||
</h3>
|
{{i18n "search.no_results"}} <a href class="show-help" {{action "showSearchHelp" bubbles=false}}>{{i18n "search.search_help"}}</a>
|
||||||
{{/unless}}
|
</h3>
|
||||||
|
{{/unless}}
|
||||||
|
|
||||||
{{#each model.posts as |result|}}
|
{{#each model.posts as |result|}}
|
||||||
<div class='fps-result'>
|
<div class='fps-result'>
|
||||||
<div class='topic'>
|
<div class='topic'>
|
||||||
{{avatar result imageSize="tiny"}}
|
{{avatar result imageSize="tiny"}}
|
||||||
<a class='search-link' href='{{unbound result.url}}'>
|
<a class='search-link' href='{{unbound result.url}}'>
|
||||||
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{unbound result.topic.title}}</span>
|
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{unbound result.topic.title}}</span>
|
||||||
</a>{{category-link result.topic.category}}
|
</a>{{category-link result.topic.category}}
|
||||||
</div>
|
</div>
|
||||||
<div class='blurb container'>
|
<div class='blurb container'>
|
||||||
<span class='date'>
|
<span class='date'>
|
||||||
{{format-age result.created_at}}
|
{{format-age result.created_at}}
|
||||||
{{#if result.blurb}}
|
{{#if result.blurb}}
|
||||||
-
|
-
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
{{#if result.blurb}}
|
{{#if result.blurb}}
|
||||||
{{#highlight-text highlight=controller.q}}
|
{{#highlight-text highlight=controller.q}}
|
||||||
{{{unbound result.blurb}}}
|
{{{unbound result.blurb}}}
|
||||||
{{/highlight-text}}
|
{{/highlight-text}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#if model.posts}}
|
{{#if model.posts}}
|
||||||
<h3 class="search-footer">
|
<h3 class="search-footer">
|
||||||
{{i18n "search.no_more_results"}}
|
{{i18n "search.no_more_results"}}
|
||||||
<a href class="show-help" {{action "showSearchHelp" bubbles=false}}>{{i18n "search.search_help"}}</a>
|
<a href class="show-help" {{action "showSearchHelp" bubbles=false}}>{{i18n "search.search_help"}}</a>
|
||||||
</h3>
|
</h3>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{/conditional-loading-spinner}}
|
{{/conditional-loading-spinner}}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import ScrollTop from 'discourse/mixins/scroll-top';
|
import ScrollTop from "discourse/mixins/scroll-top";
|
||||||
|
|
||||||
export default Ember.View.extend(ScrollTop, {
|
export default Ember.View.extend(ScrollTop, {});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%- unless customization_disabled? %>
|
<%- unless customization_disabled? %>
|
||||||
<%= SiteCustomization.custom_header(session[:preview_style]) %>
|
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<header>
|
<header>
|
||||||
<a href="<%= path "/" %>"><img src="<%=SiteSetting.logo_url%>" alt="<%=SiteSetting.title%>" id="site-logo"></a>
|
<a href="<%= path "/" %>"><img src="<%=SiteSetting.logo_url%>" alt="<%=SiteSetting.title%>" id="site-logo"></a>
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%- unless customization_disabled? %>
|
<%- unless customization_disabled? %>
|
||||||
<%= SiteCustomization.custom_header(session[:preview_style]) %>
|
<%= SiteCustomization.custom_header(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||||
<%- end %>
|
<%- end %>
|
||||||
<section id='main'>
|
<section id='main'>
|
||||||
<%= render partial: 'header' %>
|
<%= render partial: 'header' %>
|
||||||
|
@ -24,5 +24,8 @@
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<%- unless customization_disabled? %>
|
||||||
|
<%= SiteCustomization.custom_footer(session[:preview_style], mobile_view? ? :mobile : :desktop) %>
|
||||||
|
<%- end %>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue