Merge branch 'speed_up_wiki_pages' into 'master'

Speed up wiki pages page
This commit is contained in:
Dmitriy Zaporozhets 2014-04-14 13:20:35 +00:00
commit 2ed56ce9d4
3 changed files with 8 additions and 5 deletions

View file

@ -7,7 +7,7 @@ class Projects::WikisController < Projects::ApplicationController
before_filter :load_project_wiki
def pages
@wiki_pages = @project_wiki.pages
@wiki_pages = Kaminari.paginate_array(@project_wiki.pages).page(params[:page]).per(30)
end
def show

View file

@ -61,12 +61,16 @@ class WikiPage
# The raw content of this page.
def content
@attributes[:content]
@attributes[:content] ||= if @page
@page.raw_data
end
end
# The processed/formatted content of this page.
def formatted_content
@attributes[:formatted_content]
@attributes[:formatted_content] ||= if @page
@page.formatted_data
end
end
# The markup format for the page.
@ -167,8 +171,6 @@ class WikiPage
def set_attributes
attributes[:slug] = @page.escaped_url_path
attributes[:title] = @page.title
attributes[:content] = @page.raw_data
attributes[:formatted_content] = @page.formatted_data
attributes[:format] = @page.format
end

View file

@ -9,3 +9,4 @@
%small (#{wiki_page.format})
.pull-right
%small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)}
= paginate @wiki_pages, theme: 'gitlab'