Added support for custom wiki sidebar using _sidebar.md in the wiki root. If _sidebar.md exists it will be parsed and rendered otherwise the default sidebar file list will display

deleted _sidebar_custom.html.haml and modified _sidebar.html.haml to check for sidebar_page and render it or the default wiki page list. Also removed white space.

fix indent in show.html.haml

restore newline at end of ile

Add a newline at the end of changelogs/custom_wiki_sidebar.yml
This commit is contained in:
Joshua Sooter 2018-01-04 15:10:17 -07:00 committed by Lin Jen-Shin
parent 551b9e109e
commit 4333fbf2e4
3 changed files with 15 additions and 5 deletions

View File

@ -107,6 +107,8 @@ class Projects::WikisController < Projects::ApplicationController
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki.wiki
@sidebar_wiki_entries = WikiPage.group_by_directory(@project_wiki.pages(limit: 15))
# Optional _sidebar.md page
@sidebar_page = @project_wiki.find_page('_sidebar', params[:version_id])
rescue ProjectWiki::CouldNotCreateWikiError
flash[:notice] = "Could not create Wiki Repository at this time. Please try again later."
redirect_to project_path(@project)

View File

@ -11,11 +11,14 @@
.blocks-container
.block.block-first
%ul.wiki-pages
= render @sidebar_wiki_entries, context: 'sidebar'
- if @sidebar_page
= render_wiki_content(@sidebar_page)
- else
%ul.wiki-pages
= render @sidebar_wiki_entries, context: 'sidebar'
.block
= link_to project_wikis_pages_path(@project), class: 'btn btn-block' do
= s_("Wiki|More Pages")
.block
= link_to project_wikis_pages_path(@project), class: 'btn btn-block' do
= s_("Wiki|More Pages")
= render 'projects/wikis/new'

View File

@ -0,0 +1,5 @@
---
title: "Custom Wiki Sidebar Support Issue 14995"
merge_request:
author: Josh Sooter
type: added