Fixed All Pages with a category
This commit is contained in:
parent
614a48c6ff
commit
a2cb920489
|
@ -337,7 +337,8 @@ class WikiController < ApplicationController
|
||||||
@category = @params['category']
|
@category = @params['category']
|
||||||
if @category
|
if @category
|
||||||
@set_name = "category '#{@category}'"
|
@set_name = "category '#{@category}'"
|
||||||
@pages_in_category = WikiReference.pages_in_category(@category).map { |page_name| @web.page(page_name) }.by_name
|
pages = WikiReference.pages_in_category(@category).sort.map { |page_name| @web.page(page_name) }
|
||||||
|
@pages_in_category = PageSet.new(@web, pages)
|
||||||
else
|
else
|
||||||
# no category specified, return all pages of the web
|
# no category specified, return all pages of the web
|
||||||
@pages_in_category = @web.select_all.by_name
|
@pages_in_category = @web.select_all.by_name
|
||||||
|
|
|
@ -42,7 +42,7 @@ class WikiReference < ActiveRecord::Base
|
||||||
query =
|
query =
|
||||||
'SELECT name FROM pages JOIN wiki_references ON pages.id = wiki_references.page_id ' +
|
'SELECT name FROM pages JOIN wiki_references ON pages.id = wiki_references.page_id ' +
|
||||||
'WHERE wiki_references.referenced_name = ? ' +
|
'WHERE wiki_references.referenced_name = ? ' +
|
||||||
"AND wiki_references.link_type = '#{CATEGORY}'" +
|
"AND wiki_references.link_type = '#{CATEGORY}'"
|
||||||
names = connection.select_all(sanitize_sql([query, category])).map { |row| row['name'] }
|
names = connection.select_all(sanitize_sql([query, category])).map { |row| row['name'] }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue