BREAKS BUILD: all pages etc are much faster, but categories functionality is broken (it was responsible for calling the renderer once per every page on All Pages)
This commit is contained in:
parent
541a5d3994
commit
ac819d4d68
|
@ -291,7 +291,9 @@ class WikiController < ApplicationController
|
|||
@category = @params['category']
|
||||
@categories = []
|
||||
@pages_in_category = @web.select do |page|
|
||||
page_categories = PageRenderer.new(page.revisions.last).display_content.find_chunks(Category)
|
||||
# FIXME: was PageRenderer.new(page.revisions.last).display_content.find_chunks(Category),
|
||||
# heinously slow
|
||||
page_categories = []
|
||||
page_categories = page_categories.map { |cat| cat.list }.flatten
|
||||
page_categories.each {|c| @categories << c unless @categories.include? c }
|
||||
page_categories.include?(@category)
|
||||
|
|
|
@ -81,7 +81,9 @@ class PageSet < Array
|
|||
end
|
||||
|
||||
def wiki_words
|
||||
self.inject([]) { |wiki_words, page| WikiReference.wiki_words(page) }.flatten.uniq
|
||||
self.inject([]) { |wiki_words, page|
|
||||
wiki_words + page.wiki_references.map { |ref| ref.referenced_page_name }
|
||||
}.flatten.uniq
|
||||
end
|
||||
|
||||
def authors
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Web < ActiveRecord::Base
|
||||
has_many :pages#, :include => [:current_revision, :web]
|
||||
has_many :pages
|
||||
|
||||
def wiki
|
||||
Wiki.new
|
||||
|
|
|
@ -88,6 +88,7 @@ class PageRenderer
|
|||
|
||||
def render(options = {})
|
||||
result = WikiContent.new(@revision, @@url_generator, options).render!
|
||||
WikiReference.delete_all ['page_id = ?', @revision.page_id]
|
||||
@revision.page.wiki_references.delete
|
||||
|
||||
wiki_word_chunks = result.find_chunks(WikiChunk::WikiLink)
|
||||
|
|
Loading…
Reference in a new issue