Commit 87248267 authored by Marin Jankovski's avatar Marin Jankovski

Speed up loading and add pagination to wiki pages page.

parent 415c0f4b
...@@ -7,7 +7,7 @@ class Projects::WikisController < Projects::ApplicationController ...@@ -7,7 +7,7 @@ class Projects::WikisController < Projects::ApplicationController
before_filter :load_project_wiki before_filter :load_project_wiki
def pages def pages
@wiki_pages = @project_wiki.pages @wiki_pages = Kaminari.paginate_array(@project_wiki.pages).page(params[:page]).per(30)
end end
def show def show
......
...@@ -57,12 +57,16 @@ class WikiPage ...@@ -57,12 +57,16 @@ class WikiPage
# The raw content of this page. # The raw content of this page.
def content def content
@attributes[:content] @attributes[:content] ||= if @page
@page.raw_data
end
end end
# The processed/formatted content of this page. # The processed/formatted content of this page.
def formatted_content def formatted_content
@attributes[:formatted_content] @attributes[:formatted_content] ||= if @page
@page.formatted_data
end
end end
# The markup format for the page. # The markup format for the page.
...@@ -163,8 +167,6 @@ class WikiPage ...@@ -163,8 +167,6 @@ class WikiPage
def set_attributes def set_attributes
attributes[:slug] = @page.escaped_url_path attributes[:slug] = @page.escaped_url_path
attributes[:title] = @page.title attributes[:title] = @page.title
attributes[:content] = @page.raw_data
attributes[:formatted_content] = @page.formatted_data
attributes[:format] = @page.format attributes[:format] = @page.format
end end
......
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
%small (#{wiki_page.format}) %small (#{wiki_page.format})
.pull-right .pull-right
%small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)} %small Last edited #{time_ago_with_tooltip(wiki_page.commit.created_at)}
= paginate @wiki_pages, theme: 'gitlab'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment