summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2016-11-16 12:10:16 -0600
committerMike Greiling <mike@pixelcog.com>2016-11-30 15:22:43 -0600
commitf0d20b09dc6604d4ea11a39a7d7492ad10574094 (patch)
tree0befb294ef5d0e4f639ccae10c60fe0e36f7ec70
parentb2137632203cda91b79763c33ac80c51e88ed010 (diff)
downloadgitlab-ce-f0d20b09dc6604d4ea11a39a7d7492ad10574094.tar.gz
use wiki pages index for sidebar overflow and limit sidebar list to 15 pages
-rw-r--r--app/assets/javascripts/wikis.js.es61
-rw-r--r--app/controllers/projects/wikis_controller.rb2
-rw-r--r--app/helpers/nav_helper.rb1
-rw-r--r--app/views/projects/wikis/_sidebar.html.haml5
-rw-r--r--app/views/projects/wikis/pages.html.haml9
5 files changed, 12 insertions, 6 deletions
diff --git a/app/assets/javascripts/wikis.js.es6 b/app/assets/javascripts/wikis.js.es6
index 8710ca973c4..fa6d0e1f56c 100644
--- a/app/assets/javascripts/wikis.js.es6
+++ b/app/assets/javascripts/wikis.js.es6
@@ -55,6 +55,7 @@
}
renderSidebar() {
+ if (!this.sidebarEl) return;
const { classList } = this.sidebarEl;
if (this.sidebarExpanded || !this.sidebarCanCollapse()) {
if (!classList.contains('right-sidebar-expanded')) {
diff --git a/app/controllers/projects/wikis_controller.rb b/app/controllers/projects/wikis_controller.rb
index 177ccf5eec9..c3353446fd1 100644
--- a/app/controllers/projects/wikis_controller.rb
+++ b/app/controllers/projects/wikis_controller.rb
@@ -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)
diff --git a/app/helpers/nav_helper.rb b/app/helpers/nav_helper.rb
index 2aeab4b6b62..a3331dc80cb 100644
--- a/app/helpers/nav_helper.rb
+++ b/app/helpers/nav_helper.rb
@@ -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
diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml
index 85604c69865..0e64d1c6e8a 100644
--- a/app/views/projects/wikis/_sidebar.html.haml
+++ b/app/views/projects/wikis/_sidebar.html.haml
@@ -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'
diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml
index d89f860d9a8..e1eaffc6884 100644
--- a/app/views/projects/wikis/pages.html.haml
+++ b/app/views/projects/wikis/pages.html.haml
@@ -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'