diff --git a/app/controllers/wiki_menu_items_controller.rb b/app/controllers/wiki_menu_items_controller.rb
index eb32ed80ae..c7d09b5693 100644
--- a/app/controllers/wiki_menu_items_controller.rb
+++ b/app/controllers/wiki_menu_items_controller.rb
@@ -62,8 +62,8 @@ class WikiMenuItemsController < ApplicationController
end
else
@wiki_menu_item.navigatable_id = @page.wiki.id
- @wiki_menu_item.name = wiki_menu_item_params[:name]
- @wiki_menu_item.title = @page_title
+ @wiki_menu_item.name = @page.slug
+ @wiki_menu_item.title = wiki_menu_item_params[:title] || @page_title
if wiki_menu_setting == 'sub_item'
@wiki_menu_item.parent_id = parent_wiki_menu_item
diff --git a/app/views/wiki_menu_items/edit.html.erb b/app/views/wiki_menu_items/edit.html.erb
index 40f9a301a3..3dcba78c19 100644
--- a/app/views/wiki_menu_items/edit.html.erb
+++ b/app/views/wiki_menu_items/edit.html.erb
@@ -33,11 +33,11 @@ See doc/COPYRIGHT.rdoc for more details.
<%= toolbar title: l(:wiki_menu_item_for, title: @page_title) %>
<%= form_for @wiki_menu_item, html: {id: 'wiki_menu_item_form', class: 'menu-item-form', method: :put}, url: wiki_menu_item_path(@project, @page) do |form| %>
- <%= form.label :name, l(:label_menu_item_name), {id: 'item-name'} %>
- <% if @wiki_menu_item.name.nil? %>
- <%= form.text_field :name, size: 20, value: @page_title %>
+ <%= form.label :title, l(:label_menu_item_name), {id: 'item-name'} %>
+ <% if @wiki_menu_item.title.nil? %>
+ <%= form.text_field :title, size: 20, value: @page_title %>
<% else %>
- <%= form.text_field :name, size: 20 %>
+ <%= form.text_field :title, size: 20 %>
<% end %>
diff --git a/features/menu_items/wiki_menu_items.feature b/features/menu_items/wiki_menu_items.feature
index bfc58100f4..fde3b153cb 100644
--- a/features/menu_items/wiki_menu_items.feature
+++ b/features/menu_items/wiki_menu_items.feature
@@ -51,7 +51,7 @@ Feature: Wiki menu items
When I go to the wiki page "AwesomePage" for the project called "Awesome Project"
And I click on "More"
And I click on "Configure menu item"
- And I fill in "Avocado Wuaärst" for "menu_items_wiki_menu_item_name"
+ And I fill in "Avocado Wuaärst" for "menu_items_wiki_menu_item_title"
And I choose "Show as menu item in project navigation"
And I press "Save"
And I should see "Avocado Wuaärst" within "#main-menu"
@@ -61,7 +61,7 @@ Feature: Wiki menu items
When I go to the wiki page "AwesomePage" for the project called "Awesome Project"
And I click on "More"
And I click on "Configure menu item"
- And I fill in "Avocado Wuaärst" for "menu_items_wiki_menu_item_name"
+ And I fill in "Avocado Wuaärst" for "menu_items_wiki_menu_item_title"
And I choose "Show as menu item in project navigation"
And I press "Save"
When I go to the wiki page "AwesomePage" for the project called "Awesome Project"
@@ -72,7 +72,7 @@ Feature: Wiki menu items
When I go to the wiki page "Wiki" for the project called "Awesome Project"
When I click on "More"
And I click on "Configure menu item"
- And I fill in "Wikikiki" for "menu_items_wiki_menu_item_name"
+ And I fill in "Wikikiki" for "menu_items_wiki_menu_item_title"
And I press "Save"
When I go to the wiki page "Wiki" for the project called "Awesome Project"
Then I should see "Wikikiki" within "#main-menu"
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb
index 6795f98bc0..f17494b8bb 100644
--- a/spec/controllers/projects_controller_spec.rb
+++ b/spec/controllers/projects_controller_spec.rb
@@ -98,14 +98,14 @@ describe ProjectsController, type: :controller do
it 'renders main menu with wiki menu item' do
get 'show', @params
- assert_select '#main-menu a.wiki-menu-item', 'wiki'
+ assert_select '#main-menu a.wiki-menu-item', 'Wiki'
end
end
describe 'with custom wiki menu item' do
before do
- main_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'example', title: 'Example')
- sub_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'sub', title: 'Sub', parent_id: main_item.id)
+ main_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'example', title: 'Example Title')
+ sub_item = FactoryGirl.create(:wiki_menu_item, navigatable_id: @project.wiki.id, name: 'sub', title: 'Sub Title', parent_id: main_item.id)
end
it 'renders show' do
@@ -117,13 +117,13 @@ describe ProjectsController, type: :controller do
it 'renders main menu with wiki menu item' do
get 'show', @params
- assert_select '#main-menu a.example-menu-item', 'example'
+ assert_select '#main-menu a.example-menu-item', 'Example Title'
end
it 'renders main menu with sub wiki menu item' do
get 'show', @params
- assert_select '#main-menu a.sub-menu-item', 'sub'
+ assert_select '#main-menu a.sub-menu-item', 'Sub Title'
end
end
end
diff --git a/spec/features/wiki/wiki_menu_item_migration_spec.rb b/spec/features/wiki/wiki_menu_item_migration_spec.rb
index 87523fd501..358b96eb0f 100644
--- a/spec/features/wiki/wiki_menu_item_migration_spec.rb
+++ b/spec/features/wiki/wiki_menu_item_migration_spec.rb
@@ -68,7 +68,7 @@ describe 'Wiki menu_items migration', type: :feature do
it 'shows the menu item' do
visit project_wiki_path(project, project.wiki)
- link = page.find('#menu-sidebar a.icon-wiki', text: menu_item.name)
+ link = page.find('#menu-sidebar a.icon-wiki', text: menu_item.title)
link.click
expect(page).to have_selector('.wiki-title', text: wiki_page.title)