mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Set the parent page when creating a new wiki page from the "Add page" link (#26043).
git-svn-id: http://svn.redmine.org/redmine/trunk@16774 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
2bc719e2c8
commit
5de545fd79
@ -70,7 +70,7 @@ class WikiController < ApplicationController
|
|||||||
@page.title = '' unless editable?
|
@page.title = '' unless editable?
|
||||||
@page.validate
|
@page.validate
|
||||||
if @page.errors[:title].blank?
|
if @page.errors[:title].blank?
|
||||||
path = project_wiki_page_path(@project, @page.title)
|
path = project_wiki_page_path(:project_id => @project, :id => @page.title, :parent => params[:parent])
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to path }
|
format.html { redirect_to path }
|
||||||
format.js { render :js => "window.location = #{path.to_json}" }
|
format.js { render :js => "window.location = #{path.to_json}" }
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<h3 class="title"><%=l(:label_wiki_page_new)%></h3>
|
<h3 class="title"><%=l(:label_wiki_page_new)%></h3>
|
||||||
|
|
||||||
<%= labelled_form_for :page, @page,
|
<%= labelled_form_for :page, @page,
|
||||||
:url => new_project_wiki_page_path(@project),
|
:url => new_project_wiki_page_path(:project_id => @project, :parent => params[:parent]),
|
||||||
:method => 'post',
|
:method => 'post',
|
||||||
:remote => true do |f| %>
|
:remote => true do |f| %>
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
|
<% if User.current.allowed_to?(:edit_wiki_pages, @project) %>
|
||||||
<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project), :remote => true, :class => 'icon icon-add' %>
|
<%= link_to l(:label_wiki_page_new), new_project_wiki_page_path(:project_id => @project, :parent => @page.title), :remote => true, :class => 'icon icon-add' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @editable %>
|
<% if @editable %>
|
||||||
<% if @content.current_version? %>
|
<% if @content.current_version? %>
|
||||||
|
|||||||
@ -208,6 +208,13 @@ class WikiControllerTest < Redmine::ControllerTest
|
|||||||
assert_equal 'window.location = "/projects/ecookbook/wiki/New_Page"', response.body
|
assert_equal 'window.location = "/projects/ecookbook/wiki/New_Page"', response.body
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_post_new_should_redirect_to_edit_with_parent
|
||||||
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
post :new, :params => {:project_id => 'ecookbook', :title => 'New_Page', :parent => 'Child_1'}
|
||||||
|
assert_redirected_to '/projects/ecookbook/wiki/New_Page?parent=Child_1'
|
||||||
|
end
|
||||||
|
|
||||||
def test_post_new_with_invalid_title_should_display_errors
|
def test_post_new_with_invalid_title_should_display_errors
|
||||||
@request.session[:user_id] = 2
|
@request.session[:user_id] = 2
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user