diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-14 13:20:35 +0000 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-04-14 13:20:35 +0000 |
| commit | 2ed56ce9d445e0ab22b5c20ec0d28342396d01cf (patch) | |
| tree | a69a33b46c9d760864c8a2cbb88a9d5c3cf27e39 | |
| parent | 1b60913e8dedeed78c166c9d9113d260d7059e97 (diff) | |
| parent | 872482678be0eef25191e118b8300112735f0023 (diff) | |
| download | gitlab-ce-2ed56ce9d445e0ab22b5c20ec0d28342396d01cf.tar.gz | |
Merge branch 'speed_up_wiki_pages' into 'master'
Speed up wiki pages page
| -rw-r--r-- | app/controllers/projects/wikis_controller.rb | 2 | ||||
| -rw-r--r-- | app/models/wiki_page.rb | 10 | ||||
| -rw-r--r-- | app/views/projects/wikis/pages.html.haml | 1 |
3 files changed, 8 insertions, 5 deletions
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 4d8cfd6368f..76f311ed0b4 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -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 diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml index 673e3078be8..74317faf9d6 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' |
