2015-09-17 14:51:14 +09:00
|
|
|
// Meteor.startup(function () {
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// Posts.controllers.search = Posts.controllers.list.extend({
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// view: 'search',
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// showViewsNav: false,
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// getTitle: function() {
|
|
|
|
// return i18n.t("Search") + ' - ' + Settings.get('title', "Telescope");
|
|
|
|
// },
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// getDescription: function() {
|
|
|
|
// return Settings.get('description');
|
|
|
|
// },
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// onBeforeAction: function() {
|
|
|
|
// var query = this.params.query;
|
|
|
|
// if ('q' in query) {
|
|
|
|
// // if search box has 'empty' class, that means user just deleted last character in search keyword
|
|
|
|
// // but router hasn't updated url, so params.query still has '?q=<LAST CHARACTER>'
|
|
|
|
// // if we set searchQuery in this case, user will see last character pops up again unexpectedly
|
|
|
|
// // so add this check to fix the bug. issue #825
|
|
|
|
// if (!$('.search').hasClass('empty')) {
|
|
|
|
// Session.set('searchQuery', query.q);
|
|
|
|
// }
|
|
|
|
// if (query.q) {
|
|
|
|
// Meteor.call('logSearch', query.q);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// this.next();
|
|
|
|
// },
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// data: function () {
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// var terms = {
|
|
|
|
// view: "search",
|
|
|
|
// limit: this.params.query.limit || Settings.get('postsPerPage', 10),
|
|
|
|
// query: this.params.query.q
|
|
|
|
// };
|
2015-05-06 17:38:19 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// return {searchQuery: this.params.query.q, terms: terms};
|
|
|
|
// }
|
|
|
|
// });
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// Router.onBeforeAction(Router._filters.isAdmin, {only: ['logs']});
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// // Search
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// Router.route('/search', {
|
|
|
|
// name: 'search',
|
|
|
|
// controller: Posts.controllers.search
|
|
|
|
// });
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// // Search Logs
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// Router.route('/logs/:limit?', {
|
|
|
|
// controller: Telescope.controllers.admin,
|
|
|
|
// name: 'searchLogs',
|
|
|
|
// template: 'search_logs',
|
|
|
|
// waitOn: function () {
|
|
|
|
// var limit = this.params.limit || 100;
|
|
|
|
// if(Meteor.isClient) {
|
|
|
|
// Session.set('logsLimit', limit);
|
|
|
|
// }
|
|
|
|
// return Meteor.subscribe('searches', limit);
|
|
|
|
// },
|
|
|
|
// data: function () {
|
|
|
|
// return Searches.find({}, {sort: {timestamp: -1}});
|
|
|
|
// },
|
|
|
|
// fastRender: true
|
|
|
|
// });
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-09-17 14:51:14 +09:00
|
|
|
// });
|