summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2017-10-26 21:46:16 -0400
committerJacob Schatz <jschatz1@gmail.com>2017-10-26 21:46:16 -0400
commit34a12f83f49bd35b394364d49c6ecd47043d845f (patch)
tree9083d7b5d7d6206dc4b72fa892bef4144b4e4d8e
parentb3ba3996e0bd329eaa574ff53c69673efaca6eef (diff)
downloadgitlab-ce-wiki-sidebar-bug.tar.gz
Adds empty sidebar to empty pages.wiki-sidebar-bug
-rw-r--r--app/helpers/wiki_helper.rb4
-rw-r--r--app/views/projects/wikis/_sidebar.html.haml31
-rw-r--r--app/views/projects/wikis/empty.html.haml1
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 '&nbsp;' 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 '&nbsp;' 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