diff --git a/app/assets/javascripts/pages/projects/wikis/wikis.js b/app/assets/javascripts/pages/projects/wikis/wikis.js index d3e8dbf40008ab0ecedf2cbeba6715ebe650eb70..9b58d42b47dc41edef85f6e3263eed3f7583822e 100644 --- a/app/assets/javascripts/pages/projects/wikis/wikis.js +++ b/app/assets/javascripts/pages/projects/wikis/wikis.js @@ -1,5 +1,4 @@ import bp from '../../../breakpoints'; -import { slugify } from '../../../lib/utils/text_utility'; import { parseQueryStringIntoObject } from '../../../lib/utils/common_utils'; import { mergeUrlParams, redirectTo } from '../../../lib/utils/url_utility'; @@ -26,7 +25,8 @@ export default class Wikis { if (!this.newWikiForm) return; const slugInput = this.newWikiForm.querySelector('#new_wiki_path'); - const slug = slugify(slugInput.value); + + const slug = slugInput.value; if (slug.length > 0) { const wikisPath = slugInput.getAttribute('data-wikis-path'); diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index 7769c3d71c0f19d525353a40854b5b378985fbda..b1d6d461928fa196c8a1eda57e3b1805b958f9c8 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -85,6 +85,12 @@ class WikiPage alias_method :to_param, :slug + def human_title + return 'Home' if title == 'home' + + title + end + # The formatted title of this page. def title if @attributes[:title] diff --git a/app/views/projects/wikis/_sidebar_wiki_page.html.haml b/app/views/projects/wikis/_sidebar_wiki_page.html.haml index daf01634c42c278476541886d3fd59340bc054d6..769d869bd537998762f575f58830b902cdcd0edd 100644 --- a/app/views/projects/wikis/_sidebar_wiki_page.html.haml +++ b/app/views/projects/wikis/_sidebar_wiki_page.html.haml @@ -1,3 +1,3 @@ %li{ class: active_when(params[:id] == wiki_page.slug) } = link_to project_wiki_path(@project, wiki_page) do - = wiki_page.title + = wiki_page.human_title diff --git a/app/views/projects/wikis/edit.html.haml b/app/views/projects/wikis/edit.html.haml index eaceb457420813e645f6b9e8a4d559ec8ac4798f..26671a7b7d2e3b5fdaee302ea94b421219bdde91 100644 --- a/app/views/projects/wikis/edit.html.haml +++ b/app/views/projects/wikis/edit.html.haml @@ -1,5 +1,7 @@ - @content_class = "limit-container-width" unless fluid_layout -- page_title _("Edit"), @page.title, _("Wiki") +- add_to_breadcrumbs _("Wiki"), project_wiki_path(@project, @page) +- breadcrumb_title @page.persisted? ? _("Edit") : _("New") +- page_title @page.persisted? ? _("Edit") : _("New"), @page.human_title, _("Wiki") = wiki_page_errors(@error) @@ -10,9 +12,9 @@ .nav-text %h2.wiki-page-title - if @page.persisted? - = link_to @page.title, project_wiki_path(@project, @page) + = link_to @page.human_title, project_wiki_path(@project, @page) - else - = @page.title + = @page.human_title %span.light · - if @page.persisted? @@ -28,7 +30,7 @@ = link_to project_wiki_history_path(@project, @page), class: "btn" do = s_("Wiki|Page history") - if can?(current_user, :admin_wiki, @project) - #delete-wiki-modal-wrapper{ data: { delete_wiki_url: project_wiki_path(@project, @page), page_title: @page.title } } + #delete-wiki-modal-wrapper{ data: { delete_wiki_url: project_wiki_path(@project, @page), page_title: @page.human_title } } = render 'form', uploads_path: wiki_attachment_upload_url diff --git a/app/views/projects/wikis/history.html.haml b/app/views/projects/wikis/history.html.haml index 622c644ccbd06712748cc3ad41e649866b0cd23a..c5fbeeafa5458c29ccc3e6fc62760a474e9bbeba 100644 --- a/app/views/projects/wikis/history.html.haml +++ b/app/views/projects/wikis/history.html.haml @@ -1,4 +1,4 @@ -- page_title _("History"), @page.title, _("Wiki") +- page_title _("History"), @page.human_title, _("Wiki") .wiki-page-header.has-sidebar-toggle %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" } @@ -6,7 +6,7 @@ .nav-text %h2.wiki-page-title - = link_to @page.title, project_wiki_path(@project, @page) + = link_to @page.human_title, project_wiki_path(@project, @page) %span.light · = _("History") diff --git a/app/views/projects/wikis/show.html.haml b/app/views/projects/wikis/show.html.haml index ca15dfb7f716e7de4839247f4c96b9de2c0efb47..cc38ec12fd86ec02d9392d01d09c06609cd4f424 100644 --- a/app/views/projects/wikis/show.html.haml +++ b/app/views/projects/wikis/show.html.haml @@ -1,7 +1,7 @@ - @content_class = "limit-container-width" unless fluid_layout -- breadcrumb_title @page.title +- breadcrumb_title @page.human_title - wiki_breadcrumb_dropdown_links(@page.slug) -- page_title @page.title, _("Wiki") +- page_title @page.human_title, _("Wiki") - add_to_breadcrumbs _("Wiki"), get_project_wiki_path(@project) .wiki-page-header.has-sidebar-toggle @@ -9,7 +9,7 @@ = icon('angle-double-left') .nav-text - %h2.wiki-page-title= @page.title + %h2.wiki-page-title= @page.human_title %span.wiki-last-edit-by - if @page.last_version = (_("Last edited by %{name}") % { name: "#{@page.last_version.author_name}" }).html_safe diff --git a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb index f65d8ada424f1e9a0ad769dcde5ac399c5671328..48a0d675f2d1465cbb70bb59879d0ef101cd56e3 100644 --- a/spec/features/projects/wiki/user_creates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_creates_wiki_page_spec.rb @@ -215,7 +215,7 @@ describe "User creates wiki page" do end # Commit message field should have correct value. - expect(page).to have_field("wiki[message]", with: "Create spaces in the name") + expect(page).to have_field("wiki[message]", with: "Create Spaces in the name") page.within(".wiki-form") do fill_in(:wiki_content, with: "My awesome wiki!") @@ -246,7 +246,7 @@ describe "User creates wiki page" do click_button("Create page") end - expect(page).to have_content("Create hyphens in the name") + expect(page).to have_content("hyphens in the name") .and have_content("Last edited by #{user.name}") .and have_content("My awesome wiki!") end diff --git a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb index 18903ded357f234f9201e4382a0748f02f1f132b..f76e577b0d67d1353736d3142cb84fb925d5dad1 100644 --- a/spec/features/projects/wiki/user_updates_wiki_page_spec.rb +++ b/spec/features/projects/wiki/user_updates_wiki_page_spec.rb @@ -41,9 +41,9 @@ describe 'User updates wiki page' do expect(current_path).to include('one/two/three-test') expect(find('.wiki-pages')).to have_content('three') - first(:link, text: 'Three').click + first(:link, text: 'three').click - expect(find('.nav-text')).to have_content('Three') + expect(find('.nav-text')).to have_content('three') click_on('Edit')