mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Show something on categories page when js is disabled
This commit is contained in:
parent
b82e408351
commit
6063f81946
@ -4,11 +4,15 @@ class CategoriesController < ApplicationController
|
|||||||
|
|
||||||
before_filter :ensure_logged_in, except: [:index, :show]
|
before_filter :ensure_logged_in, except: [:index, :show]
|
||||||
before_filter :fetch_category, only: [:show, :update, :destroy]
|
before_filter :fetch_category, only: [:show, :update, :destroy]
|
||||||
|
skip_before_filter :check_xhr, only: [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
list = CategoryList.new(current_user)
|
@list = CategoryList.new(current_user)
|
||||||
discourse_expires_in 1.minute
|
discourse_expires_in 1.minute
|
||||||
render_serialized(list, CategoryListSerializer)
|
respond_to do |format|
|
||||||
|
format.html { render }
|
||||||
|
format.json { render_serialized(@list, CategoryListSerializer) }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
12
app/views/categories/index.html.erb
Normal file
12
app/views/categories/index.html.erb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<% @list.categories.each do |c| %>
|
||||||
|
<div class="category">
|
||||||
|
<h2><a href="/category/<%= c.slug.blank? ? c.id : c.slug %>"><%= c.name %></a></h2>
|
||||||
|
<div class="topic-list">
|
||||||
|
<% c.topics.limit(6).each do |t| %>
|
||||||
|
<a href="<%= t.relative_url %>"><%= t.title %></a> <span title='<%= t 'posts' %>'>(<%= t.posts_count %>)</span><br/>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<p><%= t 'powered_by_html' %></p>
|
Loading…
Reference in New Issue
Block a user