diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb index 9444d5a6b77..bcd9e0d5219 100644 --- a/app/controllers/projects/wikis_controller.rb +++ b/app/controllers/projects/wikis_controller.rb @@ -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 diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 431c1e33f55..c149f40a723 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -57,12 +57,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. @@ -163,8 +167,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 diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml index 7a890816568..144e2a57a50 100644 --- a/app/views/projects/wikis/pages.html.haml +++ b/app/views/projects/wikis/pages.html.haml @@ -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'