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