##// END OF EJS Templates
Return to section anchor after wiki section edit (#15182)....
Jean-Philippe Lang -
r12009:ba083225b740
parent child
Show More
@@ -144,7 +144,7 class WikiController < ApplicationController
144 144 if params[:section].present? && Redmine::WikiFormatting.supports_section_edit?
145 145 @section = params[:section].to_i
146 146 @section_hash = params[:section_hash]
147 @content.text = Redmine::WikiFormatting.formatter.new(@content.text).update_section(params[:section].to_i, @text, @section_hash)
147 @content.text = Redmine::WikiFormatting.formatter.new(@content.text).update_section(@section, @text, @section_hash)
148 148 else
149 149 @content.version = content_params[:version] if content_params[:version]
150 150 @content.text = @text
@@ -157,7 +157,10 class WikiController < ApplicationController
157 157 call_hook(:controller_wiki_edit_after_save, { :params => params, :page => @page})
158 158
159 159 respond_to do |format|
160 format.html { redirect_to project_wiki_page_path(@project, @page.title) }
160 format.html {
161 anchor = @section ? "section-#{@section}" : nil
162 redirect_to project_wiki_page_path(@project, @page.title, :anchor => anchor)
163 }
161 164 format.api {
162 165 if was_new_page
163 166 render :action => 'show', :status => :created, :location => project_wiki_page_path(@project, @page.title)
@@ -831,7 +831,8 module ApplicationHelper
831 831 content_tag('div',
832 832 link_to(image_tag('edit.png'), options[:edit_section_links].merge(:section => @current_section)),
833 833 :class => 'contextual',
834 :title => l(:button_edit_section)) + heading.html_safe
834 :title => l(:button_edit_section),
835 :id => "section-#{@current_section}") + heading.html_safe
835 836 else
836 837 heading
837 838 end
@@ -454,7 +454,7 class WikiControllerTest < ActionController::TestCase
454 454 end
455 455 end
456 456 end
457 assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections'
457 assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections#section-2'
458 458 assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.reload.content.text
459 459 end
460 460
@@ -477,7 +477,7 class WikiControllerTest < ActionController::TestCase
477 477 end
478 478 end
479 479 end
480 assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections'
480 assert_redirected_to '/projects/ecookbook/wiki/Page_with_sections#section-2'
481 481 page.reload
482 482 assert_equal Redmine::WikiFormatting::Textile::Formatter.new(text).update_section(2, "New section content"), page.content.text
483 483 assert_equal 4, page.content.version
General Comments 0
You need to be logged in to leave comments. Login now