From 36269cfbaaa7b32e3e8105205c1903cf40c5f82c Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 27 Mar 2013 16:17:49 -0400 Subject: [PATCH] Rename 'popular' to 'latest'. First stab at 'Hot' tab. --- .../discourse/controllers/list_controller.js | 2 +- .../controllers/list_topics_controller.js | 41 +- .../javascripts/discourse/models/nav_item.js | 5 +- .../discourse/routes/application_routes.js | 3 +- .../discourse/routes/filtered_list_route.js | 2 +- .../discourse/templates/header.js.handlebars | 2 +- .../templates/list/topics.js.handlebars | 4 +- .../discourse/templates/topic.js.handlebars | 2 +- .../javascripts/discourse/views/topic_view.js | 2 +- app/assets/javascripts/external/ember.js | 443 ++++++++++++++---- .../javascripts/external_production/ember.js | 417 ++++++++++++++--- app/controllers/exceptions_controller.rb | 2 +- app/controllers/list_controller.rb | 14 +- app/models/category.rb | 2 +- app/models/message_bus_observer.rb | 2 +- app/models/site.rb | 2 +- app/models/site_setting.rb | 6 +- .../common/_discourse_javascript.html.erb | 1 - app/views/exceptions/not_found.html.erb | 6 +- config/locales/client.cs.yml | 13 +- config/locales/client.da.yml | 13 +- config/locales/client.de.yml | 13 +- config/locales/client.en.yml | 24 +- config/locales/client.es.yml | 15 +- config/locales/client.fr.yml | 13 +- config/locales/client.id.yml | 19 +- config/locales/client.it.yml | 13 +- config/locales/client.nl.yml | 11 +- config/locales/client.pseudo.yml | 13 +- config/locales/client.pt.yml | 11 +- config/locales/client.sv.yml | 13 +- config/locales/client.zh_CN.yml | 13 +- config/locales/client.zh_TW.yml | 13 +- config/locales/server.cs.yml | 4 +- config/locales/server.da.yml | 4 +- config/locales/server.de.yml | 4 +- config/locales/server.en.yml | 4 +- config/locales/server.es.yml | 4 +- config/locales/server.fr.yml | 2 +- config/locales/server.id.yml | 4 +- config/locales/server.it.yml | 4 +- config/locales/server.pseudo.yml | 2 +- config/locales/server.pt.yml | 2 +- config/locales/server.sv.yml | 4 +- config/locales/server.zh_CN.yml | 4 +- config/locales/server.zh_TW.yml | 4 +- config/routes.rb | 11 +- ...0327185852_update_site_settings_for_hot.rb | 9 + lib/topic_query.rb | 14 +- spec/components/topic_query_spec.rb | 23 +- spec/controllers/list_controller_spec.rb | 9 + spec/models/topic_spec.rb | 2 +- 52 files changed, 946 insertions(+), 323 deletions(-) create mode 100644 db/migrate/20130327185852_update_site_settings_for_hot.rb diff --git a/app/assets/javascripts/discourse/controllers/list_controller.js b/app/assets/javascripts/discourse/controllers/list_controller.js index 1725f6bdbbd..22d50bb0182 100644 --- a/app/assets/javascripts/discourse/controllers/list_controller.js +++ b/app/assets/javascripts/discourse/controllers/list_controller.js @@ -98,7 +98,7 @@ Discourse.ListController = Discourse.Controller.extend({ }); Discourse.ListController.reopenClass({ - filters: ['popular', 'favorited', 'read', 'unread', 'new', 'posted'] + filters: ['latest', 'hot', 'favorited', 'read', 'unread', 'new', 'posted'] }); diff --git a/app/assets/javascripts/discourse/controllers/list_topics_controller.js b/app/assets/javascripts/discourse/controllers/list_topics_controller.js index d8c00a53dc5..8d666f67f04 100644 --- a/app/assets/javascripts/discourse/controllers/list_topics_controller.js +++ b/app/assets/javascripts/discourse/controllers/list_topics_controller.js @@ -1,7 +1,7 @@ /** This controller supports actions when listing topics or categories - @class ListTopicsController + @class ListTopicsController @extends Discourse.ObjectController @namespace Discourse @module Discourse @@ -11,31 +11,30 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({ // If we're changing our channel previousChannel: null, - popular: (function() { - return this.get('content.filter') === 'popular'; - }).property('content.filter'), + latest: Ember.computed.equal('content.filter', 'latest'), + + filterModeChanged: function() { - filterModeChanged: (function() { // Unsubscribe from a previous channel if necessary - var channel, filterMode, previousChannel, - _this = this; - if (previousChannel = this.get('previousChannel')) { + var previousChannel = this.get('previousChannel'); + if (previousChannel) { Discourse.MessageBus.unsubscribe("/" + previousChannel); this.set('previousChannel', null); } - filterMode = this.get('controllers.list.filterMode'); - if (!filterMode) { - return; - } - channel = filterMode; - Discourse.MessageBus.subscribe("/" + channel, function(data) { - return _this.get('content').insert(data); + + var filterMode = this.get('controllers.list.filterMode'); + if (!filterMode) return; + + var lsitTopicsController = this; + Discourse.MessageBus.subscribe("/" + filterMode, function(data) { + return lsitTopicsController.get('content').insert(data); }); - return this.set('previousChannel', channel); - }).observes('controllers.list.filterMode'), - draftLoaded: (function() { - var draft; - draft = this.get('content.draft'); + this.set('previousChannel', filterMode); + + }.observes('controllers.list.filterMode'), + + draftLoaded: function() { + var draft = this.get('content.draft'); if (draft) { return this.get('controllers.composer').open({ draft: draft, @@ -44,7 +43,7 @@ Discourse.ListTopicsController = Discourse.ObjectController.extend({ ignoreIfChanged: true }); } - }).observes('content.draft'), + }.observes('content.draft'), // Star a topic toggleStar: function(topic) { diff --git a/app/assets/javascripts/discourse/models/nav_item.js b/app/assets/javascripts/discourse/models/nav_item.js index bf501fed2a3..0e5d0e9db99 100644 --- a/app/assets/javascripts/discourse/models/nav_item.js +++ b/app/assets/javascripts/discourse/models/nav_item.js @@ -6,9 +6,8 @@ @namespace Discourse @module Discourse **/ -var validAnon, validNavNames; -validNavNames = ['read', 'popular', 'categories', 'favorited', 'category', 'unread', 'new', 'posted']; -validAnon = ['popular', 'category', 'categories']; +var validNavNames = ['read', 'latest', 'hot', 'categories', 'favorited', 'category', 'unread', 'new', 'posted']; +var validAnon = ['latest', 'hot', 'category', 'categories']; Discourse.NavItem = Discourse.Model.extend({ categoryName: (function() { diff --git a/app/assets/javascripts/discourse/routes/application_routes.js b/app/assets/javascripts/discourse/routes/application_routes.js index a491962d1d6..8d5cb265bfc 100644 --- a/app/assets/javascripts/discourse/routes/application_routes.js +++ b/app/assets/javascripts/discourse/routes/application_routes.js @@ -33,7 +33,8 @@ Discourse.Route.buildRoutes(function() { router.route(r, { path: "/" + r + "/more" }); }); - this.route('popular', { path: '/' }); + this.route('latest', { path: '/' }); + this.route('hot', { path: '/hot' }); this.route('categories', { path: '/categories' }); this.route('category', { path: '/category/:slug/more' }); this.route('category', { path: '/category/:slug' }); diff --git a/app/assets/javascripts/discourse/routes/filtered_list_route.js b/app/assets/javascripts/discourse/routes/filtered_list_route.js index bd124dffd51..2344b62b430 100644 --- a/app/assets/javascripts/discourse/routes/filtered_list_route.js +++ b/app/assets/javascripts/discourse/routes/filtered_list_route.js @@ -1,5 +1,5 @@ /** - A class used to handle filtering routes such as popular, read, etc. + A class used to handle filtering routes such as latest, hot, read, etc. @class FilteredListRoute @extends Discourse.Route diff --git a/app/assets/javascripts/discourse/templates/header.js.handlebars b/app/assets/javascripts/discourse/templates/header.js.handlebars index 173c5f109df..c53d6d8a6e8 100644 --- a/app/assets/javascripts/discourse/templates/header.js.handlebars +++ b/app/assets/javascripts/discourse/templates/header.js.handlebars @@ -70,7 +70,7 @@
  • {{i18n flags_title}}
  • {{/if}}
  • - {{#titledLinkTo "list.popular" titleKey="filters.popular.help"}}{{i18n filters.popular.title}}{{/titledLinkTo}} + {{#titledLinkTo "list.latest" titleKey="filters.latest.help"}}{{i18n filters.latest.title}}{{/titledLinkTo}}
  • {{#linkTo 'faq'}}{{i18n faq}}{{/linkTo}}
  • {{#if Discourse.currentUser.admin}} diff --git a/app/assets/javascripts/discourse/templates/list/topics.js.handlebars b/app/assets/javascripts/discourse/templates/list/topics.js.handlebars index fd53561a74f..9181cd95e7a 100644 --- a/app/assets/javascripts/discourse/templates/list/topics.js.handlebars +++ b/app/assets/javascripts/discourse/templates/list/topics.js.handlebars @@ -54,12 +54,12 @@

    {{view.footerMessage}} {{#if view.allLoaded}} - {{#if controller.popular}} + {{#if controller.latest}} {{#if view.canCreateTopic}} {{i18n topic.suggest_create_topic}} {{/if}} {{else}} - {{#linkTo list.categories}}{{i18n topic.browse_all_categories}}{{/linkTo}} {{i18n or}} {{#linkTo list.popular}}{{i18n topic.view_popular_topics}}{{/linkTo}} + {{#linkTo list.categories}}{{i18n topic.browse_all_categories}}{{/linkTo}} {{i18n or}} {{#linkTo list.latest}}{{i18n topic.view_latest_topics}}{{/linkTo}} {{/if}} {{/if}}

    diff --git a/app/assets/javascripts/discourse/templates/topic.js.handlebars b/app/assets/javascripts/discourse/templates/topic.js.handlebars index c432e04d354..4afd93ee27a 100644 --- a/app/assets/javascripts/discourse/templates/topic.js.handlebars +++ b/app/assets/javascripts/discourse/templates/topic.js.handlebars @@ -115,7 +115,7 @@

    {{message}}

    - {{#linkTo list.popular}}{{i18n topic.back_to_list}}{{/linkTo}} + {{#linkTo list.latest}}{{i18n topic.back_to_list}}{{/linkTo}} {{else}} diff --git a/app/assets/javascripts/discourse/views/topic_view.js b/app/assets/javascripts/discourse/views/topic_view.js index c60952af722..fe7c61d7f9c 100644 --- a/app/assets/javascripts/discourse/views/topic_view.js +++ b/app/assets/javascripts/discourse/views/topic_view.js @@ -437,7 +437,7 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, { var category, opts; opts = { - popularLink: "" + (Em.String.i18n("topic.view_popular_topics")) + "" + latestLink: "" + (Em.String.i18n("topic.view_latest_topics")) + "" }; if (category = this.get('controller.content.category')) { opts.catLink = Discourse.Utilities.categoryLink(category); diff --git a/app/assets/javascripts/external/ember.js b/app/assets/javascripts/external/ember.js index 3d37ed661d2..5eb66c83da5 100644 --- a/app/assets/javascripts/external/ember.js +++ b/app/assets/javascripts/external/ember.js @@ -1,5 +1,5 @@ -// Version: v1.0.0-pre.2-892-g1283274 -// Last commit: 1283274 (2013-03-21 14:18:06 -0700) +// Version: v1.0.0-pre.2-924-g9e5ec3b +// Last commit: 9e5ec3b (2013-03-26 21:49:38 -0700) (function() { @@ -151,8 +151,8 @@ Ember.deprecateFunc = function(message, func) { })(); -// Version: v1.0.0-pre.2-892-g1283274 -// Last commit: 1283274 (2013-03-21 14:18:06 -0700) +// Version: v1.0.0-pre.2-924-g9e5ec3b +// Last commit: 9e5ec3b (2013-03-26 21:49:38 -0700) (function() { @@ -3679,59 +3679,238 @@ Ember.cacheFor = function cacheFor(obj, key) { } }; -/** - @method computed.not - @for Ember - @param {String} dependentKey - @return {Ember.ComputedProperty} computed property which negate the original value for property -*/ -Ember.computed.not = function(dependentKey) { - return Ember.computed(dependentKey, function(key) { - return !get(this, dependentKey); - }); -}; +function getProperties(self, propertyNames) { + var ret = {}; + for(var i = 0; i < propertyNames.length; i++) { + ret[propertyNames[i]] = get(self, propertyNames[i]); + } + return ret; +} -/** - @method computed.none - @for Ember - @param {String} dependentKey -*/ -Ember.computed.none = function(dependentKey) { - return Ember.computed(dependentKey, function(key) { - var val = get(this, dependentKey); - return Ember.isNone(val); - }); -}; +function registerComputed(name, macro) { + Ember.computed[name] = function(dependentKey) { + var args = a_slice.call(arguments); + return Ember.computed(dependentKey, function() { + return macro.apply(this, args); + }); + }; +} + +function registerComputedWithProperties(name, macro) { + Ember.computed[name] = function() { + var properties = a_slice.call(arguments); + + var computed = Ember.computed(function() { + return macro.apply(this, [getProperties(this, properties)]); + }); + + return computed.property.apply(computed, properties); + }; +} /** @method computed.empty @for Ember @param {String} dependentKey + @return {Ember.ComputedProperty} computed property which negate + the original value for property */ -Ember.computed.empty = function(dependentKey) { - return Ember.computed(dependentKey, function(key) { - var val = get(this, dependentKey); - return Ember.isEmpty(val); - }); -}; +registerComputed('empty', function(dependentKey) { + return Ember.isEmpty(get(this, dependentKey)); +}); + +/** + @method computed.notEmpty + @for Ember + @param {String} dependentKey + @return {Ember.ComputedProperty} computed property which returns true if + original value for property is not empty. +*/ +registerComputed('notEmpty', function(dependentKey) { + return !Ember.isEmpty(get(this, dependentKey)); +}); + +/** + @method computed.none + @for Ember + @param {String} dependentKey + @return {Ember.ComputedProperty} computed property which + rturns true if original value for property is null or undefined. +*/ +registerComputed('none', function(dependentKey) { + return Ember.isNone(get(this, dependentKey)); +}); + +/** + @method computed.not + @for Ember + @param {String} dependentKey + @return {Ember.ComputedProperty} computed property which returns + inverse of the original value for property +*/ +registerComputed('not', function(dependentKey) { + return !get(this, dependentKey); +}); /** @method computed.bool @for Ember @param {String} dependentKey - @return {Ember.ComputedProperty} computed property which convert to boolean the original value for property + @return {Ember.ComputedProperty} computed property which convert + to boolean the original value for property */ -Ember.computed.bool = function(dependentKey) { - return Ember.computed(dependentKey, function(key) { - return !!get(this, dependentKey); - }); -}; +registerComputed('bool', function(dependentKey) { + return !!get(this, dependentKey); +}); + +/** + @method computed.match + @for Ember + @param {String} dependentKey + @param {RegExp} regexp + @return {Ember.ComputedProperty} computed property which match + the original value for property against a given RegExp +*/ +registerComputed('match', function(dependentKey, regexp) { + var value = get(this, dependentKey); + return typeof value === 'string' ? !!value.match(regexp) : false; +}); + +/** + @method computed.equal + @for Ember + @param {String} dependentKey + @param {String|Number|Object} value + @return {Ember.ComputedProperty} computed property which returns true if + the original value for property is equal to the given value. +*/ +registerComputed('equal', function(dependentKey, value) { + return get(this, dependentKey) === value; +}); + +/** + @method computed.gt + @for Ember + @param {String} dependentKey + @param {Number} value + @return {Ember.ComputedProperty} computed property which returns true if + the original value for property is greater then given value. +*/ +registerComputed('gt', function(dependentKey, value) { + return get(this, dependentKey) > value; +}); + +/** + @method computed.gte + @for Ember + @param {String} dependentKey + @param {Number} value + @return {Ember.ComputedProperty} computed property which returns true if + the original value for property is greater or equal then given value. +*/ +registerComputed('gte', function(dependentKey, value) { + return get(this, dependentKey) >= value; +}); + +/** + @method computed.lt + @for Ember + @param {String} dependentKey + @param {Number} value + @return {Ember.ComputedProperty} computed property which returns true if + the original value for property is less then given value. +*/ +registerComputed('lt', function(dependentKey, value) { + return get(this, dependentKey) < value; +}); + +/** + @method computed.lte + @for Ember + @param {String} dependentKey + @param {Number} value + @return {Ember.ComputedProperty} computed property which returns true if + the original value for property is less or equal then given value. +*/ +registerComputed('lte', function(dependentKey, value) { + return get(this, dependentKey) <= value; +}); + +/** + @method computed.and + @for Ember + @param {String} dependentKey, [dependentKey...] + @return {Ember.ComputedProperty} computed property which peforms + a logical `and` on the values of all the original values for properties. +*/ +registerComputedWithProperties('and', function(properties) { + for (var key in properties) { + if (properties.hasOwnProperty(key) && !properties[key]) { + return false; + } + } + return true; +}); + +/** + @method computed.or + @for Ember + @param {String} dependentKey, [dependentKey...] + @return {Ember.ComputedProperty} computed property which peforms + a logical `or` on the values of all the original values for properties. +*/ +registerComputedWithProperties('or', function(properties) { + for (var key in properties) { + if (properties.hasOwnProperty(key) && properties[key]) { + return true; + } + } + return false; +}); + +/** + @method computed.any + @for Ember + @param {String} dependentKey, [dependentKey...] + @return {Ember.ComputedProperty} computed property which returns + the first trouthy value of given list of properties. +*/ +registerComputedWithProperties('any', function(properties) { + for (var key in properties) { + if (properties.hasOwnProperty(key) && properties[key]) { + return properties[key]; + } + } + return null; +}); + +/** + @method computed.map + @for Ember + @param {String} dependentKey, [dependentKey...] + @return {Ember.ComputedProperty} computed property which maps + values of all passed properties in to an array. +*/ +registerComputedWithProperties('map', function(properties) { + var res = []; + for (var key in properties) { + if (properties.hasOwnProperty(key)) { + if (Ember.isNone(properties[key])) { + res.push(null); + } else { + res.push(properties[key]); + } + } + } + return res; +}); /** @method computed.alias @for Ember - @param {String} dependentKey + @return {Ember.ComputedProperty} computed property which creates an + alias to the original value for property. */ Ember.computed.alias = function(dependentKey) { return Ember.computed(dependentKey, function(key, value){ @@ -3744,6 +3923,23 @@ Ember.computed.alias = function(dependentKey) { }); }; +/** + @method computed.defaultTo + @for Ember + @param {String} defaultPath + @return {Ember.ComputedProperty} computed property which acts like + a standard getter and setter, but defaults to the value from `defaultPath`. +*/ +Ember.computed.defaultTo = function(defaultPath) { + return Ember.computed(function(key, newValue, cachedValue) { + var result; + if (arguments.length === 1) { + return cachedValue != null ? cachedValue : get(this, defaultPath); + } + return newValue != null ? newValue : get(this, defaultPath); + }); +}; + })(); @@ -4576,8 +4772,7 @@ function invokeLaterTimers() { If you pass a string it will be resolved on the target at the time the method is invoked. @param {Object} [args*] Optional arguments to pass to the timeout. - @param {Number} wait - Number of milliseconds to wait. + @param {Number} wait Number of milliseconds to wait. @return {String} a string you can use to cancel the timer in {{#crossLink "Ember/run.cancel"}}{{/crossLink}} later. */ @@ -4699,15 +4894,54 @@ Ember.run.scheduleOnce = function(queue, target, method, args) { }; /** - Schedules an item to run after control has been returned to the system. - This is equivalent to calling `Ember.run.later` with a wait time of 1ms. + Schedules an item to run from within a separate run loop, after + control has been returned to the system. This is equivalent to calling + `Ember.run.later` with a wait time of 1ms. ```javascript Ember.run.next(myContext, function(){ - // code to be executed in the next RunLoop, which will be scheduled after the current one + // code to be executed in the next run loop, which will be scheduled after the current one }); ``` + Multiple operations scheduled with `Ember.run.next` will coalesce + into the same later run loop, along with any other operations + scheduled by `Ember.run.later` that expire right around the same + time that `Ember.run.next` operations will fire. + + Note that there are often alternatives to using `Ember.run.next`. + For instance, if you'd like to schedule an operation to happen + after all DOM element operations have completed within the current + run loop, you can make use of the `afterRender` run loop queue (added + by the `ember-views` package, along with the preceding `render` queue + where all the DOM element operations happen). Example: + + ```javascript + App.MyCollectionView = Ember.CollectionView.extend({ + didInsertElement: function() { + Ember.run.scheduleOnce('afterRender', this, 'processChildElements'); + }, + processChildElements: function() { + // ... do something with collectionView's child view + // elements after they've finished rendering, which + // can't be done within the CollectionView's + // `didInsertElement` hook because that gets run + // before the child elements have been added to the DOM. + } + }); + ``` + + One benefit of the above approach compared to using `Ember.run.next` is + that you will be able to perform DOM/CSS operations before unprocessed + elements are rendered to the screen, which may prevent flickering or + other artifacts caused by delaying processing until after rendering. + + The other major benefit to the above approach is that `Ember.run.next` + introduces an element of non-determinism, which can make things much + harder to test, due to its reliance on `setTimeout`; it's much harder + to guarantee the order of scheduled operations when they are scheduled + outside of the current run loop, i.e. with `Ember.run.next`. + @method next @param {Object} [target] target of method to invoke @param {Function|String} method The method to invoke. @@ -6266,7 +6500,7 @@ define("container", factory = name; fullName = type; } else { - Ember.deprecate('register("'+type +'", "'+ name+'") is now deprecated in-favour of register("'+type+':'+name+'");', true); + Ember.deprecate('register("'+type +'", "'+ name+'") is now deprecated in-favour of register("'+type+':'+name+'");', false); fullName = type + ":" + name; } @@ -12825,7 +13059,7 @@ Ember Runtime */ var jQuery = Ember.imports.jQuery; -Ember.assert("Ember Views require jQuery 1.8 or 1.9", jQuery && (jQuery().jquery.match(/^1\.(8|9)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY)); +Ember.assert("Ember Views require jQuery 1.8, 1.9 or 2.0", jQuery && (jQuery().jquery.match(/^((1\.(8|9))|2.0)(\.\d+)?(pre|rc\d?)?/) || Ember.ENV.FORCE_JQUERY)); /** Alias for jQuery @@ -12967,9 +13201,11 @@ var setInnerHTML = function(element, html) { if (canSetInnerHTML(tagName)) { setInnerHTMLWithoutFix(element, html); } else { - Ember.assert("Can't set innerHTML on "+element.tagName+" in this browser", element.outerHTML); + // Firefox versions < 11 do not have support for element.outerHTML. + var outerHTML = element.outerHTML || new XMLSerializer().serializeToString(element); + Ember.assert("Can't set innerHTML on "+element.tagName+" in this browser", outerHTML); - var startTag = element.outerHTML.match(new RegExp("<"+tagName+"([^>]*)>", 'i'))[0], + var startTag = outerHTML.match(new RegExp("<"+tagName+"([^>]*)>", 'i'))[0], endTag = ''; var wrapper = document.createElement('div'); @@ -13452,7 +13688,9 @@ Ember._RenderBuffer.prototype = */ string: function() { if (this._element) { - return this.element().outerHTML; + // Firefox versions < 11 do not have support for element.outerHTML. + return this.element().outerHTML || + new XMLSerializer().serializeToString(this.element()); } else { return this.innerString(); } @@ -15324,9 +15562,9 @@ Ember.View = Ember.CoreView.extend( willInsertElement: Ember.K, /** - Called when the element of the view has been inserted into the DOM. - Override this function to do any set up that requires an element in the - document body. + Called when the element of the view has been inserted into the DOM + or after the view was re-rendered. Override this function to do any + set up that requires an element in the document body. @event didInsertElement */ @@ -17774,7 +18012,7 @@ if(!Handlebars && typeof require === 'function') { Handlebars = require('handlebars'); } -Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater", Handlebars && Handlebars.VERSION.match(/^1\.0\.[0-9](\.rc\.[23456789]+)?/)); +Ember.assert("Ember Handlebars requires Handlebars 1.0.0-rc.3 or greater. Include a SCRIPT tag in the HTML HEAD linking to the Handlebars file before you link to Ember.", Handlebars && Handlebars.VERSION.match(/^1\.0\.[0-9](\.rc\.[23456789]+)?/)); /** Prepares the Handlebars templating library for use inside Ember's view @@ -20531,11 +20769,12 @@ Ember.Handlebars.registerHelper('each', function(path, options) { */ Ember.Handlebars.registerHelper('template', function(name, options) { - var template = Ember.TEMPLATES[name]; + var view = options.data.view, + template = view.templateForName(name); Ember.assert("Unable to find template with name '"+name+"'.", !!template); - Ember.TEMPLATES[name](this, { data: options.data }); + template(this, { data: options.data }); }); })(); @@ -20550,7 +20789,7 @@ Ember.Handlebars.registerHelper('template', function(name, options) { /** `partial` renders a template directly using the current context. - If needed the context can be set using the `{{#with foo}}` helper. + If needed the context can be set using the `{{#with foo}}` helper. ```html diff --git a/app/views/exceptions/not_found.html.erb b/app/views/exceptions/not_found.html.erb index 5e2e2f99bed..5bf26a88bf9 100644 --- a/app/views/exceptions/not_found.html.erb +++ b/app/views/exceptions/not_found.html.erb @@ -4,12 +4,12 @@
    -

    <%= t 'page_not_found.popular_topics' %>

    - <% @popular.each do |t| %> +

    <%= t 'page_not_found.latest_topics' %>

    + <% @latest.each do |t| %> <%= link_to t.title, t.relative_url %>
    <% end %>
    - <%= t 'page_not_found.see_more' %>… + <%= t 'page_not_found.see_more' %>…

    <%= t 'page_not_found.recent_topics' %>

    diff --git a/config/locales/client.cs.yml b/config/locales/client.cs.yml index f30acc5c5a9..d926eb64fc7 100644 --- a/config/locales/client.cs.yml +++ b/config/locales/client.cs.yml @@ -373,10 +373,10 @@ cs: new: "Nemáte žádná nová témata ke čtení." read: "Zatím jste nečetli žádná témata." posted: "Zatím jste nepřispěli do žádného tématu." - popular: "Nejsou tu žádná populární témata. To je docela smutné." + latest: "Nejsou tu žádná populární témata. To je docela smutné." category: "V kategorii {{category}} nejsou žádná témata." bottom: - popular: "Nejsou tu žádná další populární témata k přečtení." + latest: "Nejsou tu žádná další populární témata k přečtení." posted: "Nejsou tu žádná další zaslaná témata k přečtení." read: "Nejsou tu žádná další přečtená témata." new: "Nejsou tu žádná další nová témata k přečtení." @@ -412,10 +412,11 @@ cs: options: "Možnosti" show_links: "zobrazit odkazy v tomto tématu" toggle_information: "zobrazit/skrýt detaily tématu" - read_more_in_category: "Chcete si přečíst další informace? Projděte si témata v {{catLink}} nebo {{popularLink}}." - read_more: "Chcete si přečíst další informace? {{catLink}} nebo {{popularLink}}." + read_more_in_category: "Chcete si přečíst další informace? Projděte si témata v {{catLink}} nebo {{latestLink}}." + read_more: "Chcete si přečíst další informace? {{catLink}} nebo {{latestLink}}." browse_all_categories: Procházet všechny kategorie - view_popular_topics: zobrazit populární témata + + view_latest_topics: zobrazit populární témata suggest_create_topic: Co takhle založit nové téma? read_position_reset: "Vaše pozice čtení byla zresetována." jump_reply_up: přejít na předchozí odpověď @@ -652,7 +653,7 @@ cs: categories_list: "Seznam kategorií" filters: - popular: + latest: title: "Populární" help: "populární témata z poslední doby" favorited: diff --git a/config/locales/client.da.yml b/config/locales/client.da.yml index 8c8e7610d49..e5650f079bb 100644 --- a/config/locales/client.da.yml +++ b/config/locales/client.da.yml @@ -366,10 +366,10 @@ da: new: "Du har ingen nye emner." read: "Du har ikke læst nogen emner endnu." posted: "Du har ikke skrevet nogen indlæg endnu." - popular: "Der er ikke nogen populære emner. Det er sørgeligt." + latest: "Der er ikke nogen populære emner. Det er sørgeligt." category: "Der er ingen emner i kategorien {{category}}." bottom: - popular: "Der er ikke flere populære emner." + latest: "Der er ikke flere populære emner." posted: "Der er ikke flere emner." read: "Der er ikke flere læste emner." new: "Der er ikke flere nye emner." @@ -405,10 +405,11 @@ da: options: "Emneindstillinger" show_links: "vis links i dette emne" toggle_information: "vis detaljer om emnet" - read_more_in_category: "Mere læsestof? Se andre emner i {{catLink}} eller {{popularLink}}." - read_more: "Mere læsestof? {{catLink}} else {{popularLink}}." + read_more_in_category: "Mere læsestof? Se andre emner i {{catLink}} eller {{latestLink}}." + read_more: "Mere læsestof? {{catLink}} else {{latestLink}}." browse_all_categories: Vis alle kategorier - view_popular_topics: vis populære emner + + view_latest_topics: vis populære emner suggest_create_topic: Hvorfor ikke oprette et emne? read_position_reset: "Din læseposition er blevet nulstillet." jump_reply_up: hop til tidligere svar @@ -640,7 +641,7 @@ da: categories_list: "Kategorioversigt" filters: - popular: + latest: title: "Populære" help: "de mest populære nyere emner" favorited: diff --git a/config/locales/client.de.yml b/config/locales/client.de.yml index 273b303397b..d26a02b34a3 100644 --- a/config/locales/client.de.yml +++ b/config/locales/client.de.yml @@ -354,10 +354,10 @@ de: new: "Es sind keine für Dich neuen Themen da." read: "Du hast bislang keine Themen gelesen." posted: "Du hast bislang keine Beiträge gepostet." - popular: "Es gibt keine populären Themen. Wie traurig." + latest: "Es gibt keine populären Themen. Wie traurig." category: "Es gibt keine Themen in {{category}}." bottom: - popular: "Das waren alle populären Themen." + latest: "Das waren alle populären Themen." posted: "Das waren alle Themen." read: "Das waren alle gelesenen Themen." new: "Das waren alle neuen Themen." @@ -393,10 +393,11 @@ de: options: "Themenoptionen" show_links: "Zeige Links in diesem Thema" toggle_information: "Themendetails ein-/ausblenden" - read_more_in_category: "Möchtest Du mehr lesen? Finde andere Themen in {{catLink}} oder {{popularLink}}." - read_more: "Möchtest Du mehr lesen? {{catLink}} oder {{popularLink}}." + read_more_in_category: "Möchtest Du mehr lesen? Finde andere Themen in {{catLink}} oder {{latestLink}}." + read_more: "Möchtest Du mehr lesen? {{catLink}} oder {{latestLink}}." browse_all_categories: Zeige alle Kategorien - view_popular_topics: Zeige populäre Themen + + view_latest_topics: Zeige populäre Themen suggest_create_topic: Fang ein neues Thema an? read_position_reset: "Deine Leseposition wurde zurückgesetzt." jump_reply_up: Springe zur vorigen Antwort @@ -622,7 +623,7 @@ de: categories_list: "Liste der Kategorien" filters: - popular: + latest: title: "Populär" help: "Die populärsten unter den jüngsten Themen" favorited: diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 02b8ebbfc39..f9515ab86e1 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -373,10 +373,12 @@ en: new: "You have no new topics to read." read: "You haven't read any topics yet." posted: "You haven't posted in any topics yet." - popular: "There are no popular topics. That's sad." + latest: "There are no latest topics. That's sad." + hot: "There are no hot topics." category: "There are no {{category}} topics." bottom: - popular: "There are no more popular topics to read." + latest: "There are no more latest topics to read." + hot: "There are no more hot topics to read." posted: "There are no more posted topics to read." read: "There are no more read topics to read." new: "There are no more new topics to read." @@ -412,10 +414,11 @@ en: options: "Topic Options" show_links: "show links within this topic" toggle_information: "toggle topic details" - read_more_in_category: "Want to read more? Browse other topics in {{catLink}} or {{popularLink}}." - read_more: "Want to read more? {{catLink}} or {{popularLink}}." + read_more_in_category: "Want to read more? Browse other topics in {{catLink}} or {{latestLink}}." + read_more: "Want to read more? {{catLink}} or {{latestLink}}." browse_all_categories: Browse all categories - view_popular_topics: view popular topics + + view_latest_topics: view latest topics suggest_create_topic: Why not create a topic? read_position_reset: "Your read position has been reset." jump_reply_up: jump to earlier reply @@ -652,9 +655,12 @@ en: categories_list: "Categories List" filters: - popular: - title: "Popular" - help: "the most popular recent topics" + latest: + title: "Latest" + help: "the most recent topics" + hot: + title: "Hot" + help: "a seclection of the hottest topics" favorited: title: "Favorited" help: "topics you marked as favorites" @@ -685,7 +691,7 @@ en: zero: "{{categoryName}}" one: "{{categoryName}} (1)" other: "{{categoryName}} ({{count}})" - help: "popular topics in the {{categoryName}} category" + help: "latest topics in the {{categoryName}} category" # This section is exported to the javascript for i18n in the admin section admin_js: diff --git a/config/locales/client.es.yml b/config/locales/client.es.yml index 9ea5e1a83d5..5283f879841 100644 --- a/config/locales/client.es.yml +++ b/config/locales/client.es.yml @@ -367,10 +367,10 @@ es: new: "No tienes temas nuevos por leer." read: "Todavía no has leído ningún tema." posted: "Todavía no has publicado en ningún tema." - popular: "No hay temas populares. Eso es triste." + latest: "No hay temas populares. Eso es triste." category: "No hay temas en la categoría {{category}}." bottom: - popular: "No hay más temas populares para leer." + latest: "No hay más temas populares para leer." posted: "No hay más temas publicados para leer." read: "No hay más temas leídos." new: "No hay temas nuevos para leer." @@ -407,10 +407,11 @@ es: options: "Opciones del Tema" show_links: "show links within this topic" toggle_information: "toggle topic details" - read_more_in_category: "Want to read more? Browse other topics in {{catLink}} or {{popularLink}}." - read_more: "Want to read more? {{catLink}} or {{popularLink}}." + read_more_in_category: "Want to read more? Browse other topics in {{catLink}} or {{latestLink}}." + read_more: "Want to read more? {{catLink}} or {{latestLink}}." browse_all_categories: Browse all categories - view_popular_topics: view popular topics + + view_latest_topics: view latest topics suggest_create_topic: Why not create a topic? read_position_reset: "Your read position has been reset." jump_reply_up: jump to earlier reply @@ -639,7 +640,7 @@ es: categories_list: "Lista de Categorías" filters: - popular: + latest: title: "Populares" help: "los temas más recientes más populares" favorited: @@ -672,7 +673,7 @@ es: zero: "{{categoryName}}" one: "{{categoryName}} (1)" other: "{{categoryName}} ({{count}})" - help: "popular topics in the {{categoryName}} category" + help: "latest topics in the {{categoryName}} category" # This section is exported to the javascript for i18n in the admin section admin_js: diff --git a/config/locales/client.fr.yml b/config/locales/client.fr.yml index 0d25cc0131f..301312ff8a9 100644 --- a/config/locales/client.fr.yml +++ b/config/locales/client.fr.yml @@ -377,10 +377,10 @@ fr: new: "Vous n'avez aucune discussion non lue." read: "Vous n'avez lu aucune discussion pour le moment." posted: "Vous n'avez écrit aucun message pour le moment." - popular: "Il n'y a aucune discussion populaire pour le moment. C'est triste..." + latest: "Il n'y a aucune discussion populaire pour le moment. C'est triste..." category: "Il n'y a aucune discussion sur {{category}}." bottom: - popular: "Il n'y a plus de discussion populaire à lire." + latest: "Il n'y a plus de discussion populaire à lire." posted: "Il n'y a plus de discussion à lire." read: "Il n'y a plus de discussion à lire." new: "Il n'y a plus de discussion à lire." @@ -416,10 +416,11 @@ fr: options: "options de la discussion" show_links: "afficher les liens de cette discussion" toggle_information: "afficher les détails de la discussion" - read_more_in_category: "Vous voulez en lire plus ? Afficher d'autres discussions dans {{catLink}} ou {{popularLink}}." - read_more: "Vous voulez en lire plus? {{catLink}} or {{popularLink}}." + read_more_in_category: "Vous voulez en lire plus ? Afficher d'autres discussions dans {{catLink}} ou {{latestLink}}." + read_more: "Vous voulez en lire plus? {{catLink}} or {{latestLink}}." browse_all_categories: 'Voir toutes les catégories' - view_popular_topics: "voir la liste des discussions populaires" + + view_latest_topics: "voir la liste des discussions populaires" suggest_create_topic: "pourquoi ne pas créer une nouvelle discussion ?" read_position_reset: "Votre position de lecture à été remise à zéro." jump_reply_up: "aller à des réponses précédentes" @@ -656,7 +657,7 @@ fr: categories_list: "Liste des catégories" filters: - popular: + latest: title: "Populaires" help: "discussions récentes les plus populaires" favorited: diff --git a/config/locales/client.id.yml b/config/locales/client.id.yml index a957621b308..ab21c6b22f7 100644 --- a/config/locales/client.id.yml +++ b/config/locales/client.id.yml @@ -326,10 +326,10 @@ id: new: "You have no new topics to read." read: "You haven't read any topics yet." posted: "You haven't posted in any topics yet." - popular: "There are no popular topics. That's sad." + latest: "There are no latest topics. That's sad." category: "There are no {{category}} topics." bottom: - popular: "There are no more popular topics to read." + latest: "There are no more latest topics to read." posted: "There are no more posted topics to read." read: "There are no more read topics to read." new: "There are no more new topics to read." @@ -365,10 +365,11 @@ id: options: "Topic Options" show_links: "show links within this topic" toggle_information: "toggle topic details" - read_more_in_category: "Want to read more? Browse other topics in {{catLink}} or {{popularLink}}." - read_more: "Want to read more? {{catLink}} or {{popularLink}}." + read_more_in_category: "Want to read more? Browse other topics in {{catLink}} or {{latestLink}}." + read_more: "Want to read more? {{catLink}} or {{latestLink}}." browse_all_categories: Browse all categories - view_popular_topics: view popular topics + + view_latest_topics: view latest topics suggest_create_topic: Why not create a topic? read_position_reset: "Your read position has been reset." jump_reply_up: jump to earlier reply @@ -590,9 +591,9 @@ id: categories_list: "Categories List" filters: - popular: - title: "Popular" - help: "the most popular recent topics" + latest: + title: "Latest" + help: "the latest topics" favorited: title: "Favorited" help: "topics you marked as favorites" @@ -623,7 +624,7 @@ id: zero: "{{categoryName}}" one: "{{categoryName}} (1)" other: "{{categoryName}} ({{count}})" - help: "popular topics in the {{categoryName}} category" + help: "latest topics in the {{categoryName}} category" # This section is exported to the javascript for i18n in the admin section admin_js: diff --git a/config/locales/client.it.yml b/config/locales/client.it.yml index b85dfc2753f..c3dcf14da5a 100644 --- a/config/locales/client.it.yml +++ b/config/locales/client.it.yml @@ -370,10 +370,10 @@ it: new: "Non hai nuovi topic da leggere." read: "Non hai ancora letto alcun topic." posted: "Non hai ancora postato in nessun topic." - popular: "Non ci sono post popolari. È molto triste." + latest: "Non ci sono post popolari. È molto triste." category: "Non ci sono topic nella categoria {{category}}." bottom: - popular: "Non ci sono altri topic popolari topics da leggere." + latest: "Non ci sono altri topic popolari topics da leggere." posted: "Non ci sono altri post da leggere." read: "Non ci sono altri topic da leggere." new: "Non ci sono altri nuovi topic da leggere." @@ -409,10 +409,11 @@ it: options: "Opzioni Topic" show_links: "mostra i links in questo topic" toggle_information: "informazioni sul topic" - read_more_in_category: "Vuoi leggere di più? Guarda altri topic nella categoria {{catLink}} o {{popularLink}}." - read_more: "Vuoi leggere di più? {{catLink}} o {{popularLink}}." + read_more_in_category: "Vuoi leggere di più? Guarda altri topic nella categoria {{catLink}} o {{latestLink}}." + read_more: "Vuoi leggere di più? {{catLink}} o {{latestLink}}." browse_all_categories: Guarda tutte le categorie - view_popular_topics: guarda i topic popolari + + view_latest_topics: guarda i topic popolari suggest_create_topic: Perchè non creare un topic? read_position_reset: "La tua posizione di lettura è stata resettata (wtf?)." jump_reply_up: vai alla risposta precedente @@ -648,7 +649,7 @@ it: categories_list: "Lista Categorie" filters: - popular: + latest: title: "Popolari" help: "i topic recenti più popolari" favorited: diff --git a/config/locales/client.nl.yml b/config/locales/client.nl.yml index 48c857b8d42..ea6eb100792 100644 --- a/config/locales/client.nl.yml +++ b/config/locales/client.nl.yml @@ -304,7 +304,7 @@ nl: no_new: "Je hebt geen nieuwe topics om te lezen." no_read: "Je hebt nog geen topics gelezen." no_posted: "Je hebt nog niet in een topic gepost." - no_popular: "Er zijn geen populaire topics. Dat is best wel sneu." + no_latest: "Er zijn geen populaire topics. Dat is best wel sneu." topic: create_in: 'Maak een {{categoryName}} Topic' @@ -327,10 +327,11 @@ nl: options: "Topic Opties" show_links: "laat links binnen dit topic zien" toggle_information: "Zet topic details Aan/Uit" - read_more_in_category: "Wil je meer lezen? Kijk dan voor andere topics in {{catLink}} of {{popularLink}}." - read_more: "Wil je meer lezen? {{catLink}} of {{popularLink}}." + read_more_in_category: "Wil je meer lezen? Kijk dan voor andere topics in {{catLink}} of {{latestLink}}." + read_more: "Wil je meer lezen? {{catLink}} of {{latestLink}}." browse_all_categories: Bekijk alle categorieën - view_popular_topics: bekijk populaire topics + + view_latest_topics: bekijk populaire topics progress: title: topic voortgang @@ -543,7 +544,7 @@ nl: categories_list: "Categorie-lijst" filters: - popular: + latest: title: "Populair" help: "de meest populaire recente topics" favorited: diff --git a/config/locales/client.pseudo.yml b/config/locales/client.pseudo.yml index 353d936ad93..37ec0eea607 100644 --- a/config/locales/client.pseudo.yml +++ b/config/locales/client.pseudo.yml @@ -371,10 +371,10 @@ pseudo: new: '[[ Ýóů ĥáνé ɳó ɳéŵ ťóƿíčš ťó řéáď. ]]' read: '[[ Ýóů ĥáνéɳ''ť řéáď áɳý ťóƿíčš ýéť. ]]' posted: '[[ Ýóů ĥáνéɳ''ť ƿóšťéď íɳ áɳý ťóƿíčš ýéť. ]]' - popular: '[[ Ťĥéřé ářé ɳó ƿóƿůłář ťóƿíčš. Ťĥáť''š šáď. ]]' + latest: '[[ Ťĥéřé ářé ɳó ƿóƿůłář ťóƿíčš. Ťĥáť''š šáď. ]]' category: '[[ Ťĥéřé ářé ɳó {{category}} ťóƿíčš. ]]' bottom: - popular: '[[ Ťĥéřé ářé ɳó ɱóřé ƿóƿůłář ťóƿíčš ťó řéáď. ]]' + latest: '[[ Ťĥéřé ářé ɳó ɱóřé ƿóƿůłář ťóƿíčš ťó řéáď. ]]' posted: '[[ Ťĥéřé ářé ɳó ɱóřé ƿóšťéď ťóƿíčš ťó řéáď. ]]' read: '[[ Ťĥéřé ářé ɳó ɱóřé řéáď ťóƿíčš ťó řéáď. ]]' new: '[[ Ťĥéřé ářé ɳó ɱóřé ɳéŵ ťóƿíčš ťó řéáď. ]]' @@ -414,10 +414,11 @@ pseudo: show_links: '[[ šĥóŵ łíɳǩš ŵíťĥíɳ ťĥíš ťóƿíč ]]' toggle_information: '[[ ťóǧǧłé ťóƿíč ďéťáíłš ]]' read_more_in_category: '[[ Ŵáɳť ťó řéáď ɱóřé? Ɓřóŵšé óťĥéř ťóƿíčš íɳ {{catLink}} - óř {{popularLink}}. ]]' - read_more: '[[ Ŵáɳť ťó řéáď ɱóřé? {{catLink}} óř {{popularLink}}. ]]' + óř {{latestLink}}. ]]' + read_more: '[[ Ŵáɳť ťó řéáď ɱóřé? {{catLink}} óř {{latestLink}}. ]]' browse_all_categories: '[[ Ɓřóŵšé áłł čáťéǧóříéš ]]' - view_popular_topics: '[[ νíéŵ ƿóƿůłář ťóƿíčš ]]' + + view_latest_topics: '[[ νíéŵ ƿóƿůłář ťóƿíčš ]]' suggest_create_topic: '[[ Ŵĥý ɳóť čřéáťé á ťóƿíč? ]]' read_position_reset: '[[ Ýóůř řéáď ƿóšíťíóɳ ĥáš ƀééɳ řéšéť. ]]' jump_reply_up: '[[ ʲůɱƿ ťó éářłíéř řéƿłý ]]' @@ -651,7 +652,7 @@ pseudo: changed_by: '[[ ƀý {{author}} ]]' categories_list: '[[ Čáťéǧóříéš Łíšť ]]' filters: - popular: + latest: title: '[[ Рóƿůłář ]]' help: '[[ ťĥé ɱóšť ƿóƿůłář řéčéɳť ťóƿíčš ]]' favorited: diff --git a/config/locales/client.pt.yml b/config/locales/client.pt.yml index 8a018a94241..efd0842f559 100644 --- a/config/locales/client.pt.yml +++ b/config/locales/client.pt.yml @@ -315,7 +315,7 @@ pt: no_new: "Não tens novos tópicos para ler." no_read: "Ainda não leste nenhum tópico." no_posted: "Ainda não postaste em nenhum tópico." - no_popular: "Não há tópicos populares. Isso é triste." + no_latest: "Não há tópicos populares. Isso é triste." footer: "Não há mais tópicos neste categoria. Procurar todas as categorias ou ver tópicos populares" topic: @@ -339,10 +339,11 @@ pt: options: "Opções do Tópico" show_links: "mostrar links dentro deste post" toggle_information: "alternar detalhes do tópico" - read_more_in_category: "Queres ler mais? Procura outros tópicos em {{catLink}} ou {{popularLink}}." - read_more: "Queres ler mais? {{catLink}} ou {{popularLink}}." + read_more_in_category: "Queres ler mais? Procura outros tópicos em {{catLink}} ou {{latestLink}}." + read_more: "Queres ler mais? {{catLink}} ou {{latestLink}}." browse_all_categories: Procurar todas as categorias - view_popular_topics: ver tópicos populares + + view_latest_topics: ver tópicos populares progress: title: progresso do tópico @@ -555,7 +556,7 @@ pt: categories_list: "Lista de Categorias" filters: - popular: + latest: title: "Populares" help: "os tópicos recentes mais populares" favorited: diff --git a/config/locales/client.sv.yml b/config/locales/client.sv.yml index 9439bdb5d39..5db57308702 100644 --- a/config/locales/client.sv.yml +++ b/config/locales/client.sv.yml @@ -323,10 +323,10 @@ sv: new: "Du har inga nya trådar att läsa." read: "Du har inte läst några trådar än." posted: "Du har inte postat i några trådar än." - popular: "Det finns inga populära trådar. Det är lite sorgligt." + latest: "Det finns inga populära trådar. Det är lite sorgligt." category: "Det finns inga {{category}}-trådar." bottom: - popular: "Det finns inga fler populära trådar att läsa." + latest: "Det finns inga fler populära trådar att läsa." posted: "Det finns inga fler postade trådar att läsa" read: "Det finns inga fler lästa trådar att läsa." new: "Det finns inga fler nya trådar att läsa." @@ -363,10 +363,11 @@ sv: options: "Trådinställningar" show_links: "visa länkar som finns i den här tråden" toggle_information: "slå på/av tråddetaljer" - read_more_in_category: "Vill du läsa mer? Bläddra bland andra trådar i {{catLink}} eller {{popularLink}}." - read_more: "Vill du läsa mer? {{catLink}} eller {{popularLink}}." + read_more_in_category: "Vill du läsa mer? Bläddra bland andra trådar i {{catLink}} eller {{latestLink}}." + read_more: "Vill du läsa mer? {{catLink}} eller {{latestLink}}." browse_all_categories: Bläddra bland alla kategorier - view_popular_topics: visa populära trådar + + view_latest_topics: visa populära trådar suggest_create_topic: Varför inte skapa en tråd? read_position_reset: "Din läsposition har blivit återställd." jump_reply_up: hoppa till tidigare svar @@ -587,7 +588,7 @@ sv: categories_list: "Kategorilista" filters: - popular: + latest: title: "Populära" help: "det populäraste trådarna nyligen" favorited: diff --git a/config/locales/client.zh_CN.yml b/config/locales/client.zh_CN.yml index 10bc71b0fb1..fe4cfa63651 100644 --- a/config/locales/client.zh_CN.yml +++ b/config/locales/client.zh_CN.yml @@ -376,10 +376,10 @@ zh_CN: new: "你没有新主题可读。" read: "你尚未阅读任何主题。" posted: "你尚未在任何主题中发帖。" - popular: "伤心啊,没有热门主题。" + latest: "伤心啊,没有热门主题。" category: "没有 {{category}} 分类的主题。" bottom: - popular: "没有更多热门主题可看了。" + latest: "没有更多热门主题可看了。" posted: "没有更多已发布主题可看了。" read: "没有更多已阅主题可看了。" new: "没有更多新主题可看了。" @@ -415,10 +415,11 @@ zh_CN: options: "主题选项" show_links: "显示此主题中的链接" toggle_information: "切换主题详细" - read_more_in_category: "想阅读更多内容?浏览 {{catLink}} 或 {{popularLink}} 里的其它主题。" - read_more: "想阅读更多内容?{{catLink}} 或 {{popularLink}}。" + read_more_in_category: "想阅读更多内容?浏览 {{catLink}} 或 {{latestLink}} 里的其它主题。" + read_more: "想阅读更多内容?{{catLink}} 或 {{latestLink}}。" browse_all_categories: 浏览所有分类 - view_popular_topics: 浏览热门主题 + + view_latest_topics: 浏览热门主题 suggest_create_topic: 这就创建一个主题吧! read_position_reset: "你的阅读位置已经被重置。" jump_reply_up: 跳转至更早的回复 @@ -654,7 +655,7 @@ zh_CN: categories_list: "分类列表" filters: - popular: + latest: title: "热门" help: "最近最受欢迎的主题" favorited: diff --git a/config/locales/client.zh_TW.yml b/config/locales/client.zh_TW.yml index 7650fbb621f..a6f7b601397 100644 --- a/config/locales/client.zh_TW.yml +++ b/config/locales/client.zh_TW.yml @@ -376,10 +376,10 @@ zh_TW: new: "你沒有新主題可讀。" read: "你尚未閱讀任何主題。" posted: "你尚未在任何主題中發帖。" - popular: "傷心啊,沒有熱門主題。" + latest: "傷心啊,沒有熱門主題。" category: "沒有 {{category}} 分類的主題。" bottom: - popular: "沒有更多熱門主題可看了。" + latest: "沒有更多熱門主題可看了。" posted: "沒有更多已發布主題可看了。" read: "沒有更多已閱主題可看了。" new: "沒有更多新主題可看了。" @@ -415,10 +415,11 @@ zh_TW: options: "主題選項" show_links: "顯示此主題中的鏈接" toggle_information: "切換主題詳細" - read_more_in_category: "想閱讀更多內容?浏覽 {{catLink}} 或 {{popularLink}} 裏的其它主題。" - read_more: "想閱讀更多內容?{{catLink}} 或 {{popularLink}}。" + read_more_in_category: "想閱讀更多內容?浏覽 {{catLink}} 或 {{latestLink}} 裏的其它主題。" + read_more: "想閱讀更多內容?{{catLink}} 或 {{latestLink}}。" browse_all_categories: 浏覽所有分類 - view_popular_topics: 浏覽熱門主題 + + view_latest_topics: 浏覽熱門主題 suggest_create_topic: 這就創建一個主題吧! read_position_reset: "你的閱讀位置已經被重置。" jump_reply_up: 跳轉至更早的回複 @@ -654,7 +655,7 @@ zh_TW: categories_list: "分類列表" filters: - popular: + latest: title: "熱門" help: "最近最受歡迎的主題" favorited: diff --git a/config/locales/server.cs.yml b/config/locales/server.cs.yml index eaa2d0cbc6f..e2df3c831c7 100644 --- a/config/locales/server.cs.yml +++ b/config/locales/server.cs.yml @@ -360,7 +360,7 @@ cs: post_undo_action_window_mins: "Počet sekund, během kterých smí uživatelé vrátit akce na příspěvcích (líbí se, nahlášení, atd.)" must_approve_users: "Administrátoři musí schválit všechny uživatele, než získají přístup" ga_tracking_code: "Kód pro sledování přes 'Google analytics', např. UA-12345678-9; viz http://google.com/analytics" - top_menu: "Určuje, které položky se zobrazí v navigaci na hlavní stránce a v jakém pořadí. Příklad: popular|read|favorited|unread|new|posted|categories" + top_menu: "Určuje, které položky se zobrazí v navigaci na hlavní stránce a v jakém pořadí. Příklad: latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Určuje, které položky se zobrazí v menu u příspěvku a v jakém pořadí. Příklad: like|edit|flag|delete|share|bookmark|reply" share_links: "Určuje, které položky se zobrazí ve sdílecím dialogu a v jakém pořadí. Příklad: twitter|facebook|google+" track_external_right_clicks: "Počítat kliknutí na externí odkazy pravým tlačítkem (např. otevření do nové záložky); defaultně zakázáno kvůli přepisu URL" @@ -822,7 +822,7 @@ cs: page_not_found: title: "Stránka, kterou žádáte, na tomto diskuzním fóru neexistuje. Možná vám můžeme pomoci ji najít, nebo poradit jiné téma, které se vám může líbit:" - popular_topics: "Populární témata" + latest_topics: "Populární témata" recent_topics: "Témata z poslední doby" see_more: "Více" search_title: "Hledat toto téma" diff --git a/config/locales/server.da.yml b/config/locales/server.da.yml index 0edc3610bbe..1264ddb722d 100644 --- a/config/locales/server.da.yml +++ b/config/locales/server.da.yml @@ -343,7 +343,7 @@ da: post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)" must_approve_users: "Admins must approve all users before they gain access" ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics" - top_menu: "Determine which items appear in the homepage navigation, and in what order. Example popular|read|favorited|unread|new|posted|categories" + top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs" topics_per_page: "How many topics are loaded by default on the topics list page" @@ -800,7 +800,7 @@ da: page_not_found: title: "Den side du efterspurgte findes ikke. Måske kan vi hjælpe dig med at finde den, eller et andet lignende emne:" - popular_topics: "Populære emner" + latest_topics: "Populære emner" recent_topics: "Nyeste emner" see_more: "Se mere" search_title: "Søg efter dette emne" diff --git a/config/locales/server.de.yml b/config/locales/server.de.yml index cf8ed753d89..e3aac466d7d 100644 --- a/config/locales/server.de.yml +++ b/config/locales/server.de.yml @@ -312,7 +312,7 @@ de: post_undo_action_window_mins: "Sekunden, die ein Nutzer hat, um Aktionen auf Beiträgen rückgängig zu machen (Like, Meldung, etc.)." must_approve_users: "Administratoren müssen Nutzer freischalten, bevor sie Zugriff erlangen." ga_tracking_code: "Google Analytics Trackingcode, zum Beispiel: UA-12345678-9; siehe http://google.com/analytics" - top_menu: "Bestimme, welche Navigationselemente in welcher Reihenfolge auftauchen. Beispiel: popular|read|favorited|unread|new|posted|categories" + top_menu: "Bestimme, welche Navigationselemente in welcher Reihenfolge auftauchen. Beispiel: latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Bestimme, welche Funktionen in welcher Reihenfolge im Beitragsmenü auftauchen. Beispiel: like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "Verfolge, welche externen Links per Rechtsklick geöffnet werden (zum Beispiel in einem neuen Browser-Tab). Standardmäßig deaktiviert, da dies URL-Rewrites erfordert." topics_per_page: "Zahl der Themen, die standardmäßig auf die Themenübersichtsseite geladen werden." @@ -763,7 +763,7 @@ de: page_not_found: title: "Die angefragte Seite, gibt es in diesem Forum nicht. Vielleicht können wir aber dabei behilflich sein, sie oder ein ähnliches Thema zu finden:" - popular_topics: "Populäre Themen" + latest_topics: "Populäre Themen" recent_topics: "Kürzliche Themen" see_more: "Mehr ansehen" search_title: "Suche nach diesem Thema" diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 60a790b5f08..075f7b969a7 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -360,7 +360,7 @@ en: post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)" must_approve_users: "Admins must approve all users before they gain access" ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics" - top_menu: "Determine which items appear in the homepage navigation, and in what order. Example popular|read|favorited|unread|new|posted|categories" + top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" share_links: "Determine which items appear on the share dialog, and in what order. Example twitter|facebook|google+" track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs" @@ -822,7 +822,7 @@ en: page_not_found: title: "The page you requested doesn't exist on this discussion forum. Perhaps we can help find it, or another topic like it:" - popular_topics: "Popular topics" + latest_topics: "Latest topics" recent_topics: "Recent topics" see_more: "See More" search_title: "Search for this topic" diff --git a/config/locales/server.es.yml b/config/locales/server.es.yml index b5c311825aa..1d1648321c4 100644 --- a/config/locales/server.es.yml +++ b/config/locales/server.es.yml @@ -333,7 +333,7 @@ es: post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)" must_approve_users: "Admins must approve all users before they gain access" ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics" - top_menu: "Determine which items appear in the homepage navigation, and in what order. Example popular|read|favorited|unread|new|posted|categories" + top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs" topics_per_page: "How many topics are loaded by default on the topics list page" @@ -784,7 +784,7 @@ es: page_not_found: title: "The page you requested doesn't exist on this discussion forum. Perhaps we can help find it, or another topic like it:" - popular_topics: "Temas populares" + latest_topics: "Temas populares" recent_topics: "Temas recientes" see_more: "Ver Más" search_title: "Buscar por este tema" diff --git a/config/locales/server.fr.yml b/config/locales/server.fr.yml index 02c94920bec..934fcb22a19 100644 --- a/config/locales/server.fr.yml +++ b/config/locales/server.fr.yml @@ -832,7 +832,7 @@ fr: page_not_found: title: "La page que vous avez demandée n'existe pas dans ce forum de discussion.Peut-être nous pouvons vous aider à la trouver, ou une autre discussion similaire :" - popular_topics: "Discussions populaires" + latest_topics: "Discussions populaires" recent_topics: "Discussions récentes" see_more: "Voir plus" search_title: "Rechercher pour cette discussion" diff --git a/config/locales/server.id.yml b/config/locales/server.id.yml index 62ab6e6584e..ec78fa2fff3 100644 --- a/config/locales/server.id.yml +++ b/config/locales/server.id.yml @@ -348,7 +348,7 @@ id: post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)" must_approve_users: "Admins must approve all users before they gain access" ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics" - top_menu: "Determine which items appear in the homepage navigation, and in what order. Example popular|read|favorited|unread|new|posted|categories" + top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs" topics_per_page: "How many topics are loaded by default on the topics list page" @@ -804,7 +804,7 @@ id: page_not_found: title: "The page you requested doesn't exist on this discussion forum. Perhaps we can help find it, or another topic like it:" - popular_topics: "Popular topics" + latest_topics: "Latest topics" recent_topics: "Recent topics" see_more: "See More" search_title: "Search for this topic" diff --git a/config/locales/server.it.yml b/config/locales/server.it.yml index bfdbc146b62..f9f131df7b8 100644 --- a/config/locales/server.it.yml +++ b/config/locales/server.it.yml @@ -348,7 +348,7 @@ it: post_undo_action_window_mins: "Numero di secondi durante i quali gli utenti sono autorizzati ad annullare le loro azioni su un post (segnalazioni, like, etc)" must_approve_users: "Gli amministratori devono autorizzare ogni utente prima che esso abbia accesso" ga_tracking_code: "Codice Google Analytics per il tracking, es: UA-12345678-9; per informazioni http://google.com/analytics" - top_menu: "Determina quali elementi vengono mostrati nella navigazione in homepage, ed in quale ordine. Esempio popular|read|favorited|unread|new|posted|categories" + top_menu: "Determina quali elementi vengono mostrati nella navigazione in homepage, ed in quale ordine. Esempio latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Determina quali elementi vengono mostrati nel menù del post, ed in quale ordine. Esempio like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "Traccia i link esterni sui quali viene fatto click destro (es: apri in una nuova tab). Disabilitato di default perchè viene fatto il rewrite delle URL" topics_per_page: "Quanti topic vengono caricati di default nella pagina di lista topic" @@ -805,7 +805,7 @@ it: page_not_found: title: "La pagina richiesta non esiste in questo forum. Forse possiamo aiutarti a trovarla, o un topic simile:" - popular_topics: "Topic popolari" + latest_topics: "Topic popolari" recent_topics: "Topic recenti" see_more: "Di più" search_title: "Cerca per questo topic" diff --git a/config/locales/server.pseudo.yml b/config/locales/server.pseudo.yml index 8370d535359..04a64d5631c 100644 --- a/config/locales/server.pseudo.yml +++ b/config/locales/server.pseudo.yml @@ -879,7 +879,7 @@ pseudo: page_not_found: title: '[[ Ťĥé ƿáǧé ýóů řéƣůéšťéď ďóéšɳ''ť éхíšť óɳ ťĥíš ďíščůššíóɳ ƒóřůɱ. Рéřĥáƿš ŵé čáɳ ĥéłƿ ƒíɳď íť, óř áɳóťĥéř ťóƿíč łíǩé íť: ]]' - popular_topics: '[[ Рóƿůłář ťóƿíčš ]]' + latest_topics: '[[ Рóƿůłář ťóƿíčš ]]' recent_topics: '[[ Řéčéɳť ťóƿíčš ]]' see_more: '[[ Šéé Ϻóřé ]]' search_title: '[[ Šéářčĥ ƒóř ťĥíš ťóƿíč ]]' diff --git a/config/locales/server.pt.yml b/config/locales/server.pt.yml index 9e91754c74f..4c647ac2b33 100644 --- a/config/locales/server.pt.yml +++ b/config/locales/server.pt.yml @@ -284,7 +284,7 @@ pt: post_undo_action_window_mins: "The window in which someone can reverse an action on a post (such as liking)" must_approve_users: "The owners of the forum must approve users before they gain access." ga_tracking_code: "Google analytics tracking code, see: http://google.com/analytics" - top_menu: "The order of the items in the top menu. Example popular|read|favorited|unread|new|posted|categories" + top_menu: "The order of the items in the top menu. Example latest|hot|read|favorited|unread|new|posted|categories" post_menu: "The order of the items on the post menu." max_length_show_reply: "Embedded replies to posts won't be shown if they directly below and are below this length." track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default cause it has to re-write urls, hurting usability" diff --git a/config/locales/server.sv.yml b/config/locales/server.sv.yml index 6c89757c955..2395f79d776 100644 --- a/config/locales/server.sv.yml +++ b/config/locales/server.sv.yml @@ -348,7 +348,7 @@ sv: post_undo_action_window_mins: "Number of seconds users are allowed to reverse actions on a post (like, flag, etc)" must_approve_users: "Admins must approve all users before they gain access" ga_tracking_code: "Google analytics tracking code code, eg: UA-12345678-9; see http://google.com/analytics" - top_menu: "Determine which items appear in the homepage navigation, and in what order. Example popular|read|favorited|unread|new|posted|categories" + top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|hot|read|favorited|unread|new|posted|categories" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "Track external links that are right clicked (eg: open in new tab) disabled by default because it rewrites URLs" topics_per_page: "How many topics are loaded by default on the topics list page" @@ -804,7 +804,7 @@ sv: page_not_found: title: "The page you requested doesn't exist on this discussion forum. Perhaps we can help find it, or another topic like it:" - popular_topics: "Popular topics" + latest_topics: "Latest topics" recent_topics: "Recent topics" see_more: "See More" search_title: "Search for this topic" diff --git a/config/locales/server.zh_CN.yml b/config/locales/server.zh_CN.yml index 99e2def44ac..bb6b27a0c2d 100644 --- a/config/locales/server.zh_CN.yml +++ b/config/locales/server.zh_CN.yml @@ -348,7 +348,7 @@ zh_CN: post_undo_action_window_mins: "允许用户在帖子上进行撤销操作(赞、投诉等)所需等待的间隔秒数" must_approve_users: "用户必须获得管理员批准方能访问" ga_tracking_code: "谷歌分析追踪代码,例如:UA-12345678-9。参考 http://google.com/analytics" - top_menu: "确定在主页导航条包含哪些条目,以及排列顺序。例如:popular|read|favorited|unread|new|posted|categories" + top_menu: "确定在主页导航条包含哪些条目,以及排列顺序。例如:latest|hot|read|favorited|unread|new|posted|categories" post_menu: "确定在帖子菜单条包含哪些条目,以及排列顺序。例如:like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "追踪外部链接的右键点击(例如:在浏览器新标签打开),缺省是禁用的,因为它会重写URL" topics_per_page: "在主题列表页面,缺省载入多少个主题" @@ -813,7 +813,7 @@ zh_CN: page_not_found: title: "你请求的页面在本论坛不存在。可能我们能帮助你找到它,或者类似的其它主题:" - popular_topics: "热门主题" + latest_topics: "热门主题" recent_topics: "近期主题" see_more: "查看更多" search_title: "搜索该主题" diff --git a/config/locales/server.zh_TW.yml b/config/locales/server.zh_TW.yml index 20d947a1376..1d1d182a2b4 100644 --- a/config/locales/server.zh_TW.yml +++ b/config/locales/server.zh_TW.yml @@ -348,7 +348,7 @@ zh_TW: post_undo_action_window_mins: "允許用戶在帖子上進行撤銷操作(贊、投訴等)所需等待的間隔秒數" must_approve_users: "用戶必須獲得管理員批准方能訪問" ga_tracking_code: "谷歌分析追蹤代碼,例如:UA-12345678-9。參考 http://google.com/analytics" - top_menu: "確定在主頁導航條包含哪些條目,以及排列順序。例如:popular|read|favorited|unread|new|posted|categories" + top_menu: "確定在主頁導航條包含哪些條目,以及排列順序。例如:latest|hot|read|favorited|unread|new|posted|categories" post_menu: "確定在帖子菜單條包含哪些條目,以及排列順序。例如:like|edit|flag|delete|share|bookmark|reply" track_external_right_clicks: "追蹤外部鏈接的右鍵點擊(例如:在浏覽器新標簽打開),缺省是禁用的,因爲它會重寫URL" topics_per_page: "在主題列表頁面,缺省載入多少個主題" @@ -813,7 +813,7 @@ zh_TW: page_not_found: title: "你請求的頁面在本論壇不存在。可能我們能幫助你找到它,或者類似的其它主題:" - popular_topics: "熱門主題" + latest_topics: "熱門主題" recent_topics: "近期主題" see_more: "查看更多" search_title: "搜索該主題" diff --git a/config/routes.rb b/config/routes.rb index 5de23056d8c..81de68fe7ea 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -149,8 +149,15 @@ Discourse::Application.routes.draw do get 'category/:category' => 'list#category', as: 'category' get 'category/:category/more' => 'list#category', as: 'category' get 'categories' => 'categories#index' - get 'popular' => 'list#index' - get 'popular/more' => 'list#index' + + # We've renamed popular to latest. If people access it we want a permanent redirect. + get 'popular' => 'list#popular_redirect' + get 'popular/more' => 'list#popular_redirect' + + get 'latest' => 'list#index' + get 'latest/more' => 'list#index' + get 'hot' => 'list#hot' + get 'hot/more' => 'list#hot' get 'favorited' => 'list#favorited' get 'favorited/more' => 'list#favorited' get 'read' => 'list#read' diff --git a/db/migrate/20130327185852_update_site_settings_for_hot.rb b/db/migrate/20130327185852_update_site_settings_for_hot.rb new file mode 100644 index 00000000000..1040a2ccc7f --- /dev/null +++ b/db/migrate/20130327185852_update_site_settings_for_hot.rb @@ -0,0 +1,9 @@ +class UpdateSiteSettingsForHot < ActiveRecord::Migration + def up + execute "UPDATE site_settings SET value = REPLACE(value, 'popular|', 'latest|hot|') where name = 'top_menu'" + end + + def down + execute "UPDATE site_settings SET value = REPLACE(value, 'latest|hot', 'popular|') where name = 'top_menu'" + end +end diff --git a/lib/topic_query.rb b/lib/topic_query.rb index 61d8a959080..22d1d246a02 100644 --- a/lib/topic_query.rb +++ b/lib/topic_query.rb @@ -103,8 +103,8 @@ class TopicQuery TopicList.new(@user, results) end - # The popular view of topics - def list_popular + # The latest view of topics + def list_latest TopicList.new(@user, default_list) end @@ -121,6 +121,16 @@ class TopicQuery end end + def list_hot + return_list(unordered: true) do |list| + + # Let's not include topic categories on hot + list = list.where("categories.topic_id <> topics.id") + + list =list.order("coalesce(categories.hotness, 5) desc, topics.bumped_at desc") + end + end + def list_new TopicList.new(@user, new_results) end diff --git a/spec/components/topic_query_spec.rb b/spec/components/topic_query_spec.rb index 20717e45239..eee43e87549 100644 --- a/spec/components/topic_query_spec.rb +++ b/spec/components/topic_query_spec.rb @@ -16,19 +16,19 @@ describe TopicQuery do let!(:archived_topic) { Fabricate(:topic, title: 'this is an archived topic', user: creator, archived: true, bumped_at: 6.minutes.ago) } let!(:invisible_topic) { Fabricate(:topic, title: 'this is an invisible topic', user: creator, visible: false, bumped_at: 5.minutes.ago) } let!(:closed_topic) { Fabricate(:topic, title: 'this is a closed topic', user: creator, closed: true, bumped_at: 1.minute.ago) } - let(:topics) { topic_query.list_popular.topics } + let(:topics) { topic_query.list_latest.topics } - context 'list_popular' do + context 'list_latest' do it "returns the topics in the correct order" do topics.should == [pinned_topic, closed_topic, archived_topic, regular_topic] end it "includes the invisible topic if you're a moderator" do - TopicQuery.new(moderator).list_popular.topics.include?(invisible_topic).should be_true + TopicQuery.new(moderator).list_latest.topics.include?(invisible_topic).should be_true end it "includes the invisible topic if you're an admin" do - TopicQuery.new(admin).list_popular.topics.include?(invisible_topic).should be_true + TopicQuery.new(admin).list_latest.topics.include?(invisible_topic).should be_true end end @@ -71,6 +71,21 @@ describe TopicQuery do end end + context 'hot' do + let(:cold_category) { Fabricate(:category, name: 'brrrrrr', hotness: 5) } + let(:hot_category) { Fabricate(:category, name: 'yeeouch', hotness: 10) } + + let!(:t1) { Fabricate(:topic, category: cold_category)} + let!(:t2) { Fabricate(:topic, category: hot_category)} + let!(:t3) { Fabricate(:topic, category: hot_category)} + let!(:t4) { Fabricate(:topic, category: cold_category)} + + it "returns the hot categories first" do + topic_query.list_hot.topics.should == [t3, t2, t4, t1] + end + + end + context 'unread / read topics' do context 'with no data' do diff --git a/spec/controllers/list_controller_spec.rb b/spec/controllers/list_controller_spec.rb index e9cb598d3ba..0725c0bbf96 100644 --- a/spec/controllers/list_controller_spec.rb +++ b/spec/controllers/list_controller_spec.rb @@ -69,6 +69,14 @@ describe ListController do end + context 'hot' do + before do + xhr :get, :hot + end + + it { should respond_with(:success) } + end + context 'favorited' do it 'raises an error when not logged in' do lambda { xhr :get, :favorited }.should raise_error(Discourse::NotLoggedIn) @@ -84,6 +92,7 @@ describe ListController do end end + context 'read' do it 'raises an error when not logged in' do lambda { xhr :get, :read }.should raise_error(Discourse::NotLoggedIn) diff --git a/spec/models/topic_spec.rb b/spec/models/topic_spec.rb index f4cffabf847..d16abf5340b 100644 --- a/spec/models/topic_spec.rb +++ b/spec/models/topic_spec.rb @@ -365,7 +365,7 @@ describe Topic do end it "should be excluded from the list view" do - TopicQuery.new(evil_trout).list_popular.topics.should_not include(topic) + TopicQuery.new(evil_trout).list_latest.topics.should_not include(topic) end context 'invite' do