mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Show something on categories page when js is disabled
This commit is contained in:
parent
b82e408351
commit
6063f81946
2 changed files with 18 additions and 2 deletions
|
@ -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
|
||||
|
|
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 a new issue