From 6063f81946456b605fb0c8459dd5276c7f386c3b Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 26 Apr 2013 13:10:41 -0400 Subject: [PATCH] Show something on categories page when js is disabled --- app/controllers/categories_controller.rb | 8 ++++++-- app/views/categories/index.html.erb | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 app/views/categories/index.html.erb diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index b5835edc309..de9946abf35 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -4,11 +4,15 @@ class CategoriesController < ApplicationController before_filter :ensure_logged_in, except: [:index, :show] before_filter :fetch_category, only: [:show, :update, :destroy] + skip_before_filter :check_xhr, only: [:index] def index - list = CategoryList.new(current_user) + @list = CategoryList.new(current_user) discourse_expires_in 1.minute - render_serialized(list, CategoryListSerializer) + respond_to do |format| + format.html { render } + format.json { render_serialized(@list, CategoryListSerializer) } + end end def show diff --git a/app/views/categories/index.html.erb b/app/views/categories/index.html.erb new file mode 100644 index 00000000000..e2b388dcbba --- /dev/null +++ b/app/views/categories/index.html.erb @@ -0,0 +1,12 @@ +<% @list.categories.each do |c| %> +
+

<%= c.name %>

+
+ <% c.topics.limit(6).each do |t| %> + <%= t.title %> '>(<%= t.posts_count %>)
+ <% end %> +
+
+<% end %> + +

<%= t 'powered_by_html' %>

\ No newline at end of file