diff --git a/app/controllers/concerns/wiki_actions.rb b/app/controllers/concerns/wiki_actions.rb index 0face94d24cc6019628a61fca33391594c4bfd56..5d45bbd255870b5fd4b7431bde6d20e6ae869295 100644 --- a/app/controllers/concerns/wiki_actions.rb +++ b/app/controllers/concerns/wiki_actions.rb @@ -157,6 +157,8 @@ def handle_redirection ) elsif show_create_form? handle_create_form + elsif wiki.exists? + render 'shared/wikis/404', status: :not_found else render 'shared/wikis/empty' end diff --git a/app/views/shared/wikis/404.html.haml b/app/views/shared/wikis/404.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..2ebfc1be440fbbb9856747c590933fb3398b03ce --- /dev/null +++ b/app/views/shared/wikis/404.html.haml @@ -0,0 +1,20 @@ +- page_title _("Wiki") +- @right_sidebar = true +- add_page_specific_style 'page_bundles/wiki' + +- if @error.present? + = render Pajamas::AlertComponent.new(alert_options: { id: 'error_explanation', class: 'gl-mb-3'}, + dismissible: false, + variant: :danger) do |c| + - c.with_body do + %ul.gl-pl-4 + = @error + += render Pajamas::EmptyStateComponent.new(svg_path: 'illustrations/empty-state/empty-wiki-md.svg', + title: _('Sorry, this page doesn\'t exist'), + empty_state_options: { data: { testid: 'wiki-404' } }) do |c| + + - c.with_description do + = s_('Wiki|Use the sidebar to find a different page.') + += render 'shared/wikis/sidebar' diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 9b247e697af2a1a2eec8603047cd2147ab88d43e..908e2264d86cb40ad807910874faff391d8cef01 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -50591,6 +50591,9 @@ msgstr "" msgid "Sorry, no projects matched your search" msgstr "" +msgid "Sorry, this page doesn't exist" +msgstr "" + msgid "Sorry, you have exceeded the maximum browsable page number. Please use the API to explore further." msgstr "" @@ -59607,6 +59610,9 @@ msgstr "" msgid "Wiki|There are no pages in this wiki yet" msgstr "" +msgid "Wiki|Use the sidebar to find a different page." +msgstr "" + msgid "Wiki|View all pages" msgstr "" diff --git a/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb b/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb index 8381679078914f68b6b3791271464dc54a21b580..5c492da4bdc38c246a91868460ca9ac602716ecd 100644 --- a/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb +++ b/spec/support/shared_examples/controllers/wiki_actions_shared_examples.rb @@ -255,8 +255,8 @@ it 'shows the empty state' do request - expect(response).to have_gitlab_http_status(:ok) - expect(response).to render_template('shared/wikis/empty') + expect(response).to have_gitlab_http_status(:not_found) + expect(response).to render_template('shared/wikis/404') end end end