From 34a12f83f49bd35b394364d49c6ecd47043d845f Mon Sep 17 00:00:00 2001 From: Jacob Schatz Date: Thu, 26 Oct 2017 21:46:16 -0400 Subject: Adds empty sidebar to empty pages. --- app/helpers/wiki_helper.rb | 4 ++++ app/views/projects/wikis/_sidebar.html.haml | 31 +++++++++++++++-------------- app/views/projects/wikis/empty.html.haml | 1 + 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 815fab9e061..25423b6cd2e 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -11,6 +11,10 @@ module WikiHelper .join(' / ') end + def has_articles? + @sidebar_wiki_entries.any? + end + def wiki_breadcrumb_dropdown_links(page_slug) page_slug_split = page_slug.split('/') page_slug_split.pop(1) diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/projects/wikis/_sidebar.html.haml index 5b781294d68..afa3822829b 100644 --- a/app/views/projects/wikis/_sidebar.html.haml +++ b/app/views/projects/wikis/_sidebar.html.haml @@ -1,22 +1,23 @@ %aside.right-sidebar.right-sidebar-expanded.wiki-sidebar.js-wiki-sidebar.js-right-sidebar{ data: { "offset-top" => "50", "spy" => "affix" } } .sidebar-container - .block.wiki-sidebar-header.append-bottom-default - %a.gutter-toggle.pull-right.visible-xs-block.visible-sm-block.js-sidebar-wiki-toggle{ href: "#" } - = icon('angle-double-right') + - if has_articles? + .block.wiki-sidebar-header.append-bottom-default + %a.gutter-toggle.pull-right.visible-xs-block.visible-sm-block.js-sidebar-wiki-toggle{ href: "#" } + = icon('angle-double-right') - - git_access_url = project_wikis_git_access_path(@project) - = link_to git_access_url, class: active_nav_link?(path: 'wikis#git_access') ? 'active' : '' do - = succeed ' ' do - = icon('cloud-download') - = _("Clone repository") + - git_access_url = project_wikis_git_access_path(@project) + = link_to git_access_url, class: active_nav_link?(path: 'wikis#git_access') ? 'active' : '' do + = succeed ' ' do + = icon('cloud-download') + = _("Clone repository") - .blocks-container - .block.block-first - %ul.wiki-pages - = render @sidebar_wiki_entries, context: 'sidebar' + .blocks-container + .block.block-first + %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' diff --git a/app/views/projects/wikis/empty.html.haml b/app/views/projects/wikis/empty.html.haml index d6e568bac94..481ecd41c83 100644 --- a/app/views/projects/wikis/empty.html.haml +++ b/app/views/projects/wikis/empty.html.haml @@ -4,3 +4,4 @@ %hr .error_message = s_("WikiEmptyPageError|You are not allowed to create wiki pages") += render 'sidebar' \ No newline at end of file -- cgit v1.2.1