Commit f0d20b09 authored by Mike Greiling's avatar Mike Greiling

use wiki pages index for sidebar overflow and limit sidebar list to 15 pages

parent b2137632
......@@ -55,6 +55,7 @@
}
renderSidebar() {
if (!this.sidebarEl) return;
const { classList } = this.sidebarEl;
if (this.sidebarExpanded || !this.sidebarCanCollapse()) {
if (!classList.contains('right-sidebar-expanded')) {
......
......@@ -115,6 +115,8 @@ class Projects::WikisController < Projects::ApplicationController
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki.wiki
@sidebar_wiki_pages = @project_wiki.pages.first(15)
rescue ProjectWiki::CouldNotCreateWikiError
flash[:notice] = "Could not create Wiki Repository at this time. Please try again later."
redirect_to project_path(@project)
......
......@@ -23,7 +23,6 @@ module NavHelper
elsif current_path?('wikis#show') ||
current_path?('wikis#edit') ||
current_path?('wikis#history') ||
current_path?('wikis#pages') ||
current_path?('wikis#git_access')
"page-gutter wiki-sidebar right-sidebar-expanded"
end
......
......@@ -12,9 +12,12 @@
.blocks-container
.block.block-first
%ul.wiki-pages
- @project_wiki.pages.each do |wiki_page|
- @sidebar_wiki_pages.each do |wiki_page|
%li{ class: params[:id] == wiki_page.slug ? 'active' : '' }
= link_to namespace_project_wiki_path(@project.namespace, @project, wiki_page) do
= wiki_page.title.capitalize
.block
= link_to namespace_project_wiki_pages_path(@project.namespace, @project), class: 'btn btn-block' do
More Pages
= render 'projects/wikis/new'
......@@ -3,13 +3,16 @@
%div{ class: container_class }
.wiki-page-header
%button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
= icon('angle-double-left')
.nav-text
%h2.wiki-page-title
Wiki Pages
.nav-controls
= link_to namespace_project_wikis_git_access_path(@project.namespace, @project), class: 'btn' do
= icon('cloud-download')
Clone repository
%ul.content-list
- @wiki_pages.each do |wiki_page|
%li
......@@ -18,5 +21,3 @@
.pull-right
%small Last edited #{time_ago_with_tooltip(wiki_page.commit.authored_date)}
= paginate @wiki_pages, theme: 'gitlab'
= render 'sidebar'
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