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