summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/layouts/nav/sidebar/_project.html.haml4
-rw-r--r--app/views/projects/wiki_directories/_pages_wiki_directory.html.haml15
-rw-r--r--app/views/projects/wiki_directories/_sidebar_wiki_directory.html.haml7
-rw-r--r--app/views/projects/wiki_directories/_wiki_directory.html.haml1
-rw-r--r--app/views/projects/wiki_directories/empty.html.haml34
-rw-r--r--app/views/projects/wiki_directories/show.html.haml6
-rw-r--r--app/views/projects/wiki_pages/_form.html.haml (renamed from app/views/projects/wikis/_form.html.haml)10
-rw-r--r--app/views/projects/wiki_pages/_page_title.html.haml4
-rw-r--r--app/views/projects/wiki_pages/_pages_wiki_page.html.haml8
-rw-r--r--app/views/projects/wiki_pages/_sidebar_wiki_page.html.haml11
-rw-r--r--app/views/projects/wiki_pages/_wiki_page.html.haml1
-rw-r--r--app/views/projects/wiki_pages/edit.html.haml (renamed from app/views/projects/wikis/edit.html.haml)14
-rw-r--r--app/views/projects/wiki_pages/history.html.haml (renamed from app/views/projects/wikis/history.html.haml)8
-rw-r--r--app/views/projects/wiki_pages/missing_page.html.haml (renamed from app/views/projects/wikis/empty.html.haml)0
-rw-r--r--app/views/projects/wiki_pages/show.html.haml34
-rw-r--r--app/views/projects/wikis/_pages_wiki_page.html.haml6
-rw-r--r--app/views/projects/wikis/_sidebar_wiki_page.html.haml3
-rw-r--r--app/views/projects/wikis/_wiki_directory.html.haml4
-rw-r--r--app/views/projects/wikis/_wiki_page.html.haml1
-rw-r--r--app/views/projects/wikis/pages.html.haml32
-rw-r--r--app/views/projects/wikis/show.html.haml35
-rw-r--r--app/views/shared/empty_states/_wikis.html.haml9
-rw-r--r--app/views/shared/wiki/_main_links.html.haml (renamed from app/views/projects/wikis/_main_links.html.haml)2
-rw-r--r--app/views/shared/wiki/_page_listing.html.haml45
-rw-r--r--app/views/shared/wiki/_sidebar.html.haml (renamed from app/views/projects/wikis/_sidebar.html.haml)0
25 files changed, 196 insertions, 98 deletions
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml
index c84bc0b5cd4..ec27f3c24df 100644
--- a/app/views/layouts/nav/sidebar/_project.html.haml
+++ b/app/views/layouts/nav/sidebar/_project.html.haml
@@ -282,14 +282,14 @@
- if project_nav_tab? :wiki
- wiki_url = project_wiki_path(@project, :home)
- = nav_link(controller: :wikis) do
+ = nav_link(controller: [:wikis, :wiki_pages, :wiki_directories]) do
= link_to wiki_url, class: 'shortcuts-wiki', data: { qa_selector: 'wiki_link' } do
.nav-icon-container
= sprite_icon('book')
%span.nav-item-name
= _('Wiki')
%ul.sidebar-sub-level-items.is-fly-out-only
- = nav_link(controller: :wikis, html_options: { class: "fly-out-top-item" } ) do
+ = nav_link(controller: [:wikis, :wiki_pages, :wiki_directories], html_options: { class: "fly-out-top-item" } ) do
= link_to wiki_url do
%strong.fly-out-top-item-name
= _('Wiki')
diff --git a/app/views/projects/wiki_directories/_pages_wiki_directory.html.haml b/app/views/projects/wiki_directories/_pages_wiki_directory.html.haml
new file mode 100644
index 00000000000..a9d2f38da88
--- /dev/null
+++ b/app/views/projects/wiki_directories/_pages_wiki_directory.html.haml
@@ -0,0 +1,15 @@
+%li
+ %span.text-secondary-500.svg-icon.svg-baseline
+ - if @show_children
+ = sprite_icon('folder-open', size: 16)
+ - else
+ = sprite_icon('folder-o', size: 16)
+
+ = link_to wiki_dir.slug, project_wiki_dir_path(@project, wiki_dir)
+ - unless @show_children
+ %span.badge.badge-pill.wiki-dir-page-count= wiki_dir.page_count
+ .float-right
+ %small= (s_("Last edited %{date}") % { date: time_ago_with_tooltip(wiki_dir.last_version.authored_date) }).html_safe
+ - if @show_children
+ %ul
+ = render wiki_dir.pages, context: context
diff --git a/app/views/projects/wiki_directories/_sidebar_wiki_directory.html.haml b/app/views/projects/wiki_directories/_sidebar_wiki_directory.html.haml
new file mode 100644
index 00000000000..2f62e9d4516
--- /dev/null
+++ b/app/views/projects/wiki_directories/_sidebar_wiki_directory.html.haml
@@ -0,0 +1,7 @@
+%li
+ %span.text-secondary-300.svg-icon.svg-baseline
+ = sprite_icon('folder-open', size: 16)
+
+ = link_to wiki_dir.slug, project_wiki_dir_path(@project, wiki_dir)
+ %ul= render wiki_dir.pages, context: context
+
diff --git a/app/views/projects/wiki_directories/_wiki_directory.html.haml b/app/views/projects/wiki_directories/_wiki_directory.html.haml
new file mode 100644
index 00000000000..022c209c5bd
--- /dev/null
+++ b/app/views/projects/wiki_directories/_wiki_directory.html.haml
@@ -0,0 +1 @@
+= render wiki_directory.to_partial_path(context), wiki_dir: wiki_directory, context: context
diff --git a/app/views/projects/wiki_directories/empty.html.haml b/app/views/projects/wiki_directories/empty.html.haml
new file mode 100644
index 00000000000..cab1c3acb60
--- /dev/null
+++ b/app/views/projects/wiki_directories/empty.html.haml
@@ -0,0 +1,34 @@
+- layout_path = 'shared/empty_states/wikis_layout'
+- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, :home)
+- add_to_breadcrumbs s_("Wiki|Pages"), project_wikis_pages_path(@project)
+- breadcrumb_title s_(@wiki_dir.slug)
+- page_title @wiki_dir.slug
+
+- if can?(current_user, :create_wiki, @project)
+ - create_path = project_wiki_path(@project, params[:id], { view: 'create', params: { title: "#{params[:id]}/" } })
+ - create_link = link_to s_('WikiDirEmpty|Create a page in this directory'), create_path, class: 'btn btn-success qa-create-first-page-link', title: s_('WikiDirEmpty|Create a page')
+
+ = render layout: layout_path, locals: { image_path: 'illustrations/wiki_login_empty.svg' } do
+ %h4.text-left
+ = s_('WikiDirEmpty|This directory has no wiki pages')
+ %p.text-left
+ = s_("WikiDirEmpty|A wiki is where you can store all the details about your project. This can include why you've created it, its principles, how to use it, and so on.")
+ = create_link
+
+- elsif can?(current_user, :read_issue, @project)
+ - issues_link = link_to s_('WikiEmptyIssueMessage|issue tracker'), project_issues_path(@project)
+ - new_issue_link = link_to s_('WikiEmpty|Suggest wiki improvement'), new_project_issue_path(@project), class: 'btn btn-success', title: s_('WikiEmptyIssueMessage|Suggest wiki improvement')
+
+ = render layout: layout_path, locals: { image_path: 'illustrations/wiki_logout_empty.svg' } do
+ %h4
+ = s_('WikiDirEmpty|This directory has no wiki pages')
+ %p.text-left
+ = s_('WikiEmptyIssueMessage|You must be a project member in order to add wiki pages. If you have suggestions for how to improve the wiki for this project, consider opening an issue in the %{issues_link}.').html_safe % { issues_link: issues_link }
+ = new_issue_link
+
+- else
+ = render layout: layout_path, locals: { image_path: 'illustrations/wiki_logout_empty.svg' } do
+ %h4
+ = s_('WikiDirEmpty|This directory has no wiki pages')
+ %p
+ = s_('WikiEmpty|You must be a project member in order to add wiki pages.')
diff --git a/app/views/projects/wiki_directories/show.html.haml b/app/views/projects/wiki_directories/show.html.haml
new file mode 100644
index 00000000000..4c7978d1216
--- /dev/null
+++ b/app/views/projects/wiki_directories/show.html.haml
@@ -0,0 +1,6 @@
+- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, :home)
+- add_to_breadcrumbs s_("Wiki|Pages"), project_wikis_pages_path(@project)
+- breadcrumb_title s_(@wiki_dir.slug)
+- page_title @wiki_dir.slug
+
+= render 'page_listing', { allow_change_nesting: false, wiki_page_title: page_title, page_path: ->(opts) { project_wiki_dir_path(@project, @wiki_dir, opts) } }
diff --git a/app/views/projects/wikis/_form.html.haml b/app/views/projects/wiki_pages/_form.html.haml
index a153f527ee0..8f5757d6d98 100644
--- a/app/views/projects/wikis/_form.html.haml
+++ b/app/views/projects/wiki_pages/_form.html.haml
@@ -1,9 +1,11 @@
- form_classes = 'wiki-form common-note-form prepend-top-default js-quick-submit'
- form_classes += ' js-new-wiki-page' unless @page.persisted?
-= form_for [@project.namespace.becomes(Namespace), @project, @page], method: @page.persisted? ? :put : :post,
- html: { class: form_classes },
- data: { uploads_path: uploads_path } do |f|
+= form_for [@project.namespace.becomes(Namespace), @project, @page],
+ method: @page.persisted? ? 'put' : 'post',
+ url: { controller: 'wiki_pages', action: @page.persisted? ? :update : :create },
+ html: { class: form_classes },
+ data: { uploads_path: uploads_path } do |f|
= form_errors(@page)
- if @page.persisted?
@@ -12,7 +14,7 @@
.form-group.row
.col-sm-12= f.label :title, class: 'control-label-full-width'
.col-sm-12
- = f.text_field :title, class: 'form-control qa-wiki-title-textbox', value: @page.title, required: true, autofocus: !@page.persisted?, placeholder: _('Wiki|Page title')
+ = f.text_field :title, class: 'form-control qa-wiki-title-textbox', value: @page.title, required: true, autofocus: !@page.persisted?, placeholder: s_('Wiki|Page title')
%span.d-inline-block.mw-100.prepend-top-5
= icon('lightbulb-o')
- if @page.persisted?
diff --git a/app/views/projects/wiki_pages/_page_title.html.haml b/app/views/projects/wiki_pages/_page_title.html.haml
new file mode 100644
index 00000000000..a3b077999e6
--- /dev/null
+++ b/app/views/projects/wiki_pages/_page_title.html.haml
@@ -0,0 +1,4 @@
+= link_to @page.human_title, project_wiki_path(@project, @page)
+%span.light
+ = _('·').html_safe
+ = subtitle
diff --git a/app/views/projects/wiki_pages/_pages_wiki_page.html.haml b/app/views/projects/wiki_pages/_pages_wiki_page.html.haml
new file mode 100644
index 00000000000..c177d03bee1
--- /dev/null
+++ b/app/views/projects/wiki_pages/_pages_wiki_page.html.haml
@@ -0,0 +1,8 @@
+%li
+ %span.text-secondary-500.svg-icon.svg-baseline= sprite_icon('book', size: 16)
+ = wiki_page_link(wiki_page, @nesting, @project)
+ .float-right
+ %span.badge.badge-pill.wiki-page-format= _(wiki_page.format)
+ - if wiki_page.last_version
+ = '/'
+ %small= (s_("Last edited %{date}") % { date: time_ago_with_tooltip(wiki_page.last_version.authored_date) }).html_safe
diff --git a/app/views/projects/wiki_pages/_sidebar_wiki_page.html.haml b/app/views/projects/wiki_pages/_sidebar_wiki_page.html.haml
new file mode 100644
index 00000000000..205c3dd76bf
--- /dev/null
+++ b/app/views/projects/wiki_pages/_sidebar_wiki_page.html.haml
@@ -0,0 +1,11 @@
+- is_active = params[:id] == wiki_page.slug
+- icon_active_class = is_active ? 'text-secondary-800' : 'text-secondary-300'
+
+%li{ class: active_when(is_active) }
+ %span.svg-icon.svg-baseline{ class: icon_active_class }
+ = sprite_icon('book', size: 16)
+ - if is_active
+ = wiki_page.human_title
+ - else
+ = link_to project_wiki_path(@project, wiki_page) do
+ = wiki_page.human_title
diff --git a/app/views/projects/wiki_pages/_wiki_page.html.haml b/app/views/projects/wiki_pages/_wiki_page.html.haml
new file mode 100644
index 00000000000..947e96fed6b
--- /dev/null
+++ b/app/views/projects/wiki_pages/_wiki_page.html.haml
@@ -0,0 +1 @@
+= render wiki_page.to_partial_path(context), wiki_page: wiki_page
diff --git a/app/views/projects/wikis/edit.html.haml b/app/views/projects/wiki_pages/edit.html.haml
index 9ccf5acfefc..4e5f6a077a4 100644
--- a/app/views/projects/wikis/edit.html.haml
+++ b/app/views/projects/wiki_pages/edit.html.haml
@@ -1,5 +1,10 @@
-- @content_class = "limit-container-width" unless fluid_layout
-- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, @page)
+- @content_class = 'edit-wiki-page' + (fluid_layout ? '' : ' limit-container-width')
+- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, :home)
+- add_to_breadcrumbs s_("Wiki|Pages"), project_wikis_pages_path(@project)
+- if @page.persisted? && @page_dir.present?
+ - add_to_breadcrumbs _(@page_dir.slug), project_wiki_dir_path(@project, @page_dir)
+- if @page.persisted?
+ - add_to_breadcrumbs @page.human_title, project_wiki_path(@project, @page)
- breadcrumb_title @page.persisted? ? _("Edit") : _("New")
- page_title @page.persisted? ? _("Edit") : _("New"), @page.human_title, _("Wiki")
@@ -12,10 +17,7 @@
.nav-text
%h2.wiki-page-title
- if @page.persisted?
- = link_to @page.human_title, project_wiki_path(@project, @page)
- %span.light
- ·
- = s_("Wiki|Edit Page")
+ = render partial: 'page_title', locals: { subtitle: s_("Wiki|Edit Page") }
- else
= s_("Wiki|Create New Page")
diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wiki_pages/history.html.haml
index d3a55c53649..d60a32750df 100644
--- a/app/views/projects/wikis/history.html.haml
+++ b/app/views/projects/wiki_pages/history.html.haml
@@ -1,3 +1,4 @@
+- @content_class = 'wiki-history'
- page_title _("History"), @page.human_title, _("Wiki")
.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
@@ -6,10 +7,7 @@
.nav-text
%h2.wiki-page-title
- = link_to @page.human_title, project_wiki_path(@project, @page)
- %span.light
- ·
- = _("History")
+ = render partial: 'page_title', locals: { subtitle: _("History") }
.table-holder
%table.table
@@ -39,4 +37,4 @@
= version.format
= paginate @page_versions, theme: 'gitlab'
-= render 'sidebar'
+= render 'shared/wiki/sidebar'
diff --git a/app/views/projects/wikis/empty.html.haml b/app/views/projects/wiki_pages/missing_page.html.haml
index 62fa6e1907b..62fa6e1907b 100644
--- a/app/views/projects/wikis/empty.html.haml
+++ b/app/views/projects/wiki_pages/missing_page.html.haml
diff --git a/app/views/projects/wiki_pages/show.html.haml b/app/views/projects/wiki_pages/show.html.haml
new file mode 100644
index 00000000000..879ddfb03c8
--- /dev/null
+++ b/app/views/projects/wiki_pages/show.html.haml
@@ -0,0 +1,34 @@
+- @content_class = 'wiki-page' + (fluid_layout ? '' : ' limit-container-width')
+- breadcrumb_title @page.human_title
+- page_title @page.human_title, _("Wiki")
+- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, :home)
+- add_to_breadcrumbs s_("Wiki|Pages"), project_wikis_pages_path(@project)
+- if @page_dir.present?
+ - add_to_breadcrumbs _(@page_dir.slug), project_wiki_dir_path(@project, @page_dir)
+
+.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
+ %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
+ = icon('angle-double-left')
+
+ .nav-text.flex-fill
+ %h2.wiki-page-title= @page.human_title
+ %span.wiki-last-edit-by
+ - if @page.last_version
+ = (_("Last edited by %{name}") % { name: "<strong>#{@page.last_version.author_name}</strong>" }).html_safe
+ #{time_ago_with_tooltip(@page.last_version.authored_date)}
+
+ .nav-controls.pb-md-3.pb-lg-0
+ = render 'main_links'
+
+- if @page.historical?
+ .warning_message
+ = s_("WikiHistoricalPage|This is an old version of this page.")
+ - most_recent_link = link_to s_("WikiHistoricalPage|most recent version"), project_wiki_path(@project, @page)
+ - history_link = link_to s_("WikiHistoricalPage|history"), project_wiki_history_path(@project, @page)
+ = (s_("WikiHistoricalPage|You can view the %{most_recent_link} or browse the %{history_link}.") % { most_recent_link: most_recent_link, history_link: history_link }).html_safe
+
+.prepend-top-default.append-bottom-default
+ .md.md-file.qa-wiki-page-content
+ = render_wiki_content(@page)
+
+= render 'sidebar'
diff --git a/app/views/projects/wikis/_pages_wiki_page.html.haml b/app/views/projects/wikis/_pages_wiki_page.html.haml
deleted file mode 100644
index c156f8cbf50..00000000000
--- a/app/views/projects/wikis/_pages_wiki_page.html.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-%li
- = link_to wiki_page.title, project_wiki_path(@project, wiki_page)
- %small (#{wiki_page.format})
- .float-right
- - if wiki_page.last_version
- %small= (s_("Last edited %{date}") % { date: time_ago_with_tooltip(wiki_page.last_version.authored_date) }).html_safe
diff --git a/app/views/projects/wikis/_sidebar_wiki_page.html.haml b/app/views/projects/wikis/_sidebar_wiki_page.html.haml
deleted file mode 100644
index 769d869bd53..00000000000
--- a/app/views/projects/wikis/_sidebar_wiki_page.html.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-%li{ class: active_when(params[:id] == wiki_page.slug) }
- = link_to project_wiki_path(@project, wiki_page) do
- = wiki_page.human_title
diff --git a/app/views/projects/wikis/_wiki_directory.html.haml b/app/views/projects/wikis/_wiki_directory.html.haml
deleted file mode 100644
index 0e5f32ed859..00000000000
--- a/app/views/projects/wikis/_wiki_directory.html.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%li
- = wiki_directory.slug
- %ul
- = render wiki_directory.pages, context: context
diff --git a/app/views/projects/wikis/_wiki_page.html.haml b/app/views/projects/wikis/_wiki_page.html.haml
deleted file mode 100644
index c84d06dad02..00000000000
--- a/app/views/projects/wikis/_wiki_page.html.haml
+++ /dev/null
@@ -1 +0,0 @@
-= render "#{context}_wiki_page", wiki_page: wiki_page
diff --git a/app/views/projects/wikis/pages.html.haml b/app/views/projects/wikis/pages.html.haml
deleted file mode 100644
index d9dcd8f9acd..00000000000
--- a/app/views/projects/wikis/pages.html.haml
+++ /dev/null
@@ -1,32 +0,0 @@
-- add_to_breadcrumbs "Wiki", project_wiki_path(@project, :home)
-- breadcrumb_title s_("Wiki|Pages")
-- page_title s_("Wiki|Pages"), _("Wiki")
-- sort_title = wiki_sort_title(params[:sort])
-
-.wiki-page-header.top-area.flex-column.flex-lg-row
-
- .nav-text.flex-fill
- %h2.wiki-page-title
- = s_("Wiki|Wiki Pages")
-
- .nav-controls.pb-md-3.pb-lg-0
- = link_to project_wikis_git_access_path(@project), class: 'btn' do
- = icon('cloud-download')
- = _("Clone repository")
-
- .dropdown.inline.wiki-sort-dropdown
- .btn-group{ role: 'group' }
- .btn-group{ role: 'group' }
- %button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' }
- = sort_title
- = icon('chevron-down')
- %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
- %li
- = sortable_item(s_("Wiki|Title"), project_wikis_pages_path(@project, sort: ProjectWiki::TITLE_ORDER), sort_title)
- = sortable_item(s_("Wiki|Created date"), project_wikis_pages_path(@project, sort: ProjectWiki::CREATED_AT_ORDER), sort_title)
- = wiki_sort_controls(@project, params[:sort], params[:direction])
-
-%ul.wiki-pages-list.content-list
- = render @wiki_entries, context: 'pages'
-
-= paginate @wiki_pages, theme: 'gitlab'
diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml
index ebd99cf8605..9c732a933cf 100644
--- a/app/views/projects/wikis/show.html.haml
+++ b/app/views/projects/wikis/show.html.haml
@@ -1,32 +1,5 @@
-- @content_class = "limit-container-width" unless fluid_layout
-- breadcrumb_title @page.human_title
-- wiki_breadcrumb_dropdown_links(@page.slug)
-- page_title @page.human_title, _("Wiki")
-- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, :home)
+- add_to_breadcrumbs "Wiki", project_wiki_path(@project, :home)
+- breadcrumb_title s_("Wiki|Pages")
+- page_title s_("Wiki|Contents"), _("Wiki")
-.wiki-page-header.top-area.has-sidebar-toggle.flex-column.flex-lg-row
- %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
- = icon('angle-double-left')
-
- .nav-text.flex-fill
- %h2.wiki-page-title= @page.human_title
- %span.wiki-last-edit-by
- - if @page.last_version
- = (_("Last edited by %{name}") % { name: "<strong>#{@page.last_version.author_name}</strong>" }).html_safe
- #{time_ago_with_tooltip(@page.last_version.authored_date)}
-
- .nav-controls.pb-md-3.pb-lg-0
- = render 'main_links'
-
-- if @page.historical?
- .warning_message
- = s_("WikiHistoricalPage|This is an old version of this page.")
- - most_recent_link = link_to s_("WikiHistoricalPage|most recent version"), project_wiki_path(@project, @page)
- - history_link = link_to s_("WikiHistoricalPage|history"), project_wiki_history_path(@project, @page)
- = (s_("WikiHistoricalPage|You can view the %{most_recent_link} or browse the %{history_link}.") % { most_recent_link: most_recent_link, history_link: history_link }).html_safe
-
-.prepend-top-default.append-bottom-default
- .md.md-file{ data: { qa_selector: 'wiki_page_content' } }
- = render_wiki_content(@page)
-
-= render 'sidebar'
+= render 'page_listing', { allow_change_nesting: ::Feature.enabled?(:wikis_allow_change_nesting), wiki_page_title: page_title, page_path: ->(opts) { project_wikis_pages_path(@project, opts) } }
diff --git a/app/views/shared/empty_states/_wikis.html.haml b/app/views/shared/empty_states/_wikis.html.haml
index 73eedcc1dc9..e05230de457 100644
--- a/app/views/shared/empty_states/_wikis.html.haml
+++ b/app/views/shared/empty_states/_wikis.html.haml
@@ -1,8 +1,11 @@
- layout_path = 'shared/empty_states/wikis_layout'
+- wiki_is_empty = @project_wiki.empty?
+- empty_msg = wiki_is_empty ? s_('WikiEmpty|This project has no wiki pages') : s_('WikiEmpty|This page does not exist')
+- create_msg = wiki_is_empty ? s_('WikiEmpty|Create your first page') : s_('WikiEmpty|Create this page')
- if can?(current_user, :create_wiki, @project)
- create_path = project_wiki_path(@project, params[:id], { view: 'create' })
- - create_link = link_to s_('WikiEmpty|Create your first page'), create_path, class: 'btn btn-success qa-create-first-page-link', title: s_('WikiEmpty|Create your first page')
+ - create_link = link_to create_msg, create_path, class: 'btn btn-success qa-create-first-page-link', title: create_msg
= render layout: layout_path, locals: { image_path: 'illustrations/wiki_login_empty.svg' } do
%h4.text-left
@@ -17,7 +20,7 @@
= render layout: layout_path, locals: { image_path: 'illustrations/wiki_logout_empty.svg' } do
%h4
- = s_('WikiEmpty|This project has no wiki pages')
+ = empty_msg
%p.text-left
= s_('WikiEmptyIssueMessage|You must be a project member in order to add wiki pages. If you have suggestions for how to improve the wiki for this project, consider opening an issue in the %{issues_link}.').html_safe % { issues_link: issues_link }
= new_issue_link
@@ -25,6 +28,6 @@
- else
= render layout: layout_path, locals: { image_path: 'illustrations/wiki_logout_empty.svg' } do
%h4
- = s_('WikiEmpty|This project has no wiki pages')
+ = empty_msg
%p
= s_('WikiEmpty|You must be a project member in order to add wiki pages.')
diff --git a/app/views/projects/wikis/_main_links.html.haml b/app/views/shared/wiki/_main_links.html.haml
index 2e1e176c42a..5e41bb6a9cd 100644
--- a/app/views/projects/wikis/_main_links.html.haml
+++ b/app/views/shared/wiki/_main_links.html.haml
@@ -1,6 +1,6 @@
- if (@page && @page.persisted?)
- if can?(current_user, :create_wiki, @project)
- = link_to project_wikis_new_path(@project), class: "add-new-wiki btn btn-success", role: "button" do
+ = link_to project_wiki_pages_new_path(@project), class: "add-new-wiki btn btn-success", role: "button" do
= s_("Wiki|New page")
= link_to project_wiki_history_path(@project, @page), class: "btn", role: "button" do
= s_("Wiki|Page history")
diff --git a/app/views/shared/wiki/_page_listing.html.haml b/app/views/shared/wiki/_page_listing.html.haml
new file mode 100644
index 00000000000..80f3071a8b2
--- /dev/null
+++ b/app/views/shared/wiki/_page_listing.html.haml
@@ -0,0 +1,45 @@
+- @no_container = true
+- current_sorting = params.permit(:sort, :direction)
+- sort_title = wiki_sort_title(params[:sort])
+
+%div{ class: container_class }
+ .wiki-page-header.top-area.flex-column.flex-lg-row
+
+ .nav-text.flex-fill
+ %h2.wiki-page-title
+ = wiki_page_title
+
+ .nav-controls.pb-md-3.pb-lg-0
+ - if can?(current_user, :create_wiki, @project)
+ = link_to project_wiki_pages_new_path(@project), class: "add-new-wiki btn btn-success" do
+ = s_("Wiki|New page")
+
+ = link_to project_wikis_git_access_path(@project), class: 'btn qa-clone-repository-link' do
+ = sprite_icon('download', size: 16)
+ = _("Clone repository")
+
+ - if @nesting.present? && allow_change_nesting
+ .dropdown.inline.wiki-nesting-dropdown
+ .btn-group{ role: 'group' }
+ %button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' }
+ = wiki_show_children_icon(@nesting)
+ = sprite_icon('chevron-down', size: 16)
+ %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
+ - ProjectWiki::NESTINGS.each do |choice|
+ %li= link_to wiki_show_children_icon(choice), page_path.call(current_sorting.merge(show_children: choice)), class: @nesting == choice ? 'is-active' : ''
+
+ .dropdown.inline.wiki-sort-dropdown
+ .btn-group{ role: 'group' }
+ %button.dropdown-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' }
+ = sort_title
+ = sprite_icon('chevron-down', size: 16)
+ %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
+ %li
+ = sortable_item(s_("Wiki|Title"), page_path.call(sort: ProjectWiki::TITLE_ORDER), sort_title)
+ = sortable_item(s_("Wiki|Created date"), page_path.call(sort: ProjectWiki::CREATED_AT_ORDER), sort_title)
+ = wiki_sort_controls(current_sorting.merge(show_children: @nesting), &page_path)
+
+ %ul.wiki-pages-list.content-list
+ = render @wiki_entries, context: 'pages'
+
+ = paginate @wiki_pages, theme: 'gitlab'
diff --git a/app/views/projects/wikis/_sidebar.html.haml b/app/views/shared/wiki/_sidebar.html.haml
index 83d145444d8..83d145444d8 100644
--- a/app/views/projects/wikis/_sidebar.html.haml
+++ b/app/views/shared/wiki/_sidebar.html.haml