Commit 2338a300 authored by Stan Hu's avatar Stan Hu

Remove downcase of slug and present home as "Home"

parent 00209ed8
import bp from '../../../breakpoints'; import bp from '../../../breakpoints';
import { slugify } from '../../../lib/utils/text_utility';
import { parseQueryStringIntoObject } from '../../../lib/utils/common_utils'; import { parseQueryStringIntoObject } from '../../../lib/utils/common_utils';
import { mergeUrlParams, redirectTo } from '../../../lib/utils/url_utility'; import { mergeUrlParams, redirectTo } from '../../../lib/utils/url_utility';
...@@ -26,7 +25,8 @@ export default class Wikis { ...@@ -26,7 +25,8 @@ export default class Wikis {
if (!this.newWikiForm) return; if (!this.newWikiForm) return;
const slugInput = this.newWikiForm.querySelector('#new_wiki_path'); const slugInput = this.newWikiForm.querySelector('#new_wiki_path');
const slug = slugify(slugInput.value);
const slug = slugInput.value;
if (slug.length > 0) { if (slug.length > 0) {
const wikisPath = slugInput.getAttribute('data-wikis-path'); const wikisPath = slugInput.getAttribute('data-wikis-path');
......
...@@ -85,6 +85,12 @@ class WikiPage ...@@ -85,6 +85,12 @@ class WikiPage
alias_method :to_param, :slug alias_method :to_param, :slug
def human_title
return 'Home' if title == 'home'
title
end
# The formatted title of this page. # The formatted title of this page.
def title def title
if @attributes[:title] if @attributes[:title]
......
%li{ class: active_when(params[:id] == wiki_page.slug) } %li{ class: active_when(params[:id] == wiki_page.slug) }
= link_to project_wiki_path(@project, wiki_page) do = link_to project_wiki_path(@project, wiki_page) do
= wiki_page.title = wiki_page.human_title
- @content_class = "limit-container-width" unless fluid_layout - @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) = wiki_page_errors(@error)
...@@ -10,9 +12,9 @@ ...@@ -10,9 +12,9 @@
.nav-text .nav-text
%h2.wiki-page-title %h2.wiki-page-title
- if @page.persisted? - if @page.persisted?
= link_to @page.title, project_wiki_path(@project, @page) = link_to @page.human_title, project_wiki_path(@project, @page)
- else - else
= @page.title = @page.human_title
%span.light %span.light
· ·
- if @page.persisted? - if @page.persisted?
...@@ -28,7 +30,7 @@ ...@@ -28,7 +30,7 @@
= link_to project_wiki_history_path(@project, @page), class: "btn" do = link_to project_wiki_history_path(@project, @page), class: "btn" do
= s_("Wiki|Page history") = s_("Wiki|Page history")
- if can?(current_user, :admin_wiki, @project) - 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 = render 'form', uploads_path: wiki_attachment_upload_url
......
- page_title _("History"), @page.title, _("Wiki") - page_title _("History"), @page.human_title, _("Wiki")
.wiki-page-header.has-sidebar-toggle .wiki-page-header.has-sidebar-toggle
%button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" } %button.btn.btn-default.sidebar-toggle.js-sidebar-wiki-toggle{ role: "button", type: "button" }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
.nav-text .nav-text
%h2.wiki-page-title %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 %span.light
· ·
= _("History") = _("History")
......
- @content_class = "limit-container-width" unless fluid_layout - @content_class = "limit-container-width" unless fluid_layout
- breadcrumb_title @page.title - breadcrumb_title @page.human_title
- wiki_breadcrumb_dropdown_links(@page.slug) - 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) - add_to_breadcrumbs _("Wiki"), get_project_wiki_path(@project)
.wiki-page-header.has-sidebar-toggle .wiki-page-header.has-sidebar-toggle
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
= icon('angle-double-left') = icon('angle-double-left')
.nav-text .nav-text
%h2.wiki-page-title= @page.title %h2.wiki-page-title= @page.human_title
%span.wiki-last-edit-by %span.wiki-last-edit-by
- if @page.last_version - if @page.last_version
= (_("Last edited by %{name}") % { name: "<strong>#{@page.last_version.author_name}</strong>" }).html_safe = (_("Last edited by %{name}") % { name: "<strong>#{@page.last_version.author_name}</strong>" }).html_safe
......
...@@ -215,7 +215,7 @@ describe "User creates wiki page" do ...@@ -215,7 +215,7 @@ describe "User creates wiki page" do
end end
# Commit message field should have correct value. # 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 page.within(".wiki-form") do
fill_in(:wiki_content, with: "My awesome wiki!") fill_in(:wiki_content, with: "My awesome wiki!")
...@@ -246,7 +246,7 @@ describe "User creates wiki page" do ...@@ -246,7 +246,7 @@ describe "User creates wiki page" do
click_button("Create page") click_button("Create page")
end 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("Last edited by #{user.name}")
.and have_content("My awesome wiki!") .and have_content("My awesome wiki!")
end end
......
...@@ -41,9 +41,9 @@ describe 'User updates wiki page' do ...@@ -41,9 +41,9 @@ describe 'User updates wiki page' do
expect(current_path).to include('one/two/three-test') expect(current_path).to include('one/two/three-test')
expect(find('.wiki-pages')).to have_content('three') 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') click_on('Edit')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment