Feature #2028 » patch_for_feature_2028.diff
| app/helpers/application_helper.rb (cópia de trabalho) | ||
|---|---|---|
| 260 | 260 |
text = (Setting.text_formatting == 'textile') ? |
| 261 | 261 |
Redmine::WikiFormatting.to_html(text) { |macro, args| exec_macro(macro, obj, args) } :
|
| 262 | 262 |
simple_format(auto_link(h(text))) |
| 263 | ||
| 264 | 263 |
# different methods for formatting wiki links |
| 265 | 264 |
case options[:wiki_links] |
| 266 | 265 |
when :local |
| ... | ... | |
| 270 | 269 |
# used for single-file wiki export |
| 271 | 270 |
format_wiki_link = Proc.new {|project, title, anchor| "##{title}" }
|
| 272 | 271 |
else |
| 273 |
format_wiki_link = Proc.new {|project, title, anchor| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor) }
|
|
| 272 |
format_wiki_link = Proc.new {|project, title, anchor, parent| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor, :parent => parent.title) }
|
|
| 274 | 273 |
end |
| 275 | 274 |
|
| 276 | 275 |
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil) |
| ... | ... | |
| 303 | 302 |
end |
| 304 | 303 |
# check if page exists |
| 305 | 304 |
wiki_page = link_project.wiki.find_page(page) |
| 306 |
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor), |
|
| 305 |
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor, obj.page),
|
|
| 307 | 306 |
:class => ('wiki-page' + (wiki_page ? '' : ' new')))
|
| 308 | 307 |
else |
| 309 | 308 |
# project or wiki doesn't exist |
| app/controllers/wiki_controller.rb (cópia de trabalho) | ||
|---|---|---|
| 52 | 52 |
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
|
| 53 | 53 |
return |
| 54 | 54 |
end |
| 55 |
@editable = editable?
|
|
| 55 |
@editable = editable?
|
|
| 56 | 56 |
render :action => 'show' |
| 57 | 57 |
end |
| 58 | 58 |
|
| ... | ... | |
| 60 | 60 |
def edit |
| 61 | 61 |
@page = @wiki.find_or_new_page(params[:page]) |
| 62 | 62 |
return render_403 unless editable? |
| 63 |
@page.content = WikiContent.new(:page => @page) if @page.new_record? |
|
| 63 | ||
| 64 |
if @page.new_record? |
|
| 65 |
@page.content = WikiContent.new(:page => @page) |
|
| 66 |
@page.parent_title = params[:parent] |
|
| 67 |
end |
|
| 64 | 68 |
|
| 65 | 69 |
@content = @page.content_for_version(params[:version]) |
| 66 | 70 |
@content.text = "h1. #{@page.pretty_title}" if @content.text.blank?
|
| app/views/wiki/edit.rhtml (cópia de trabalho) | ||
|---|---|---|
| 2 | 2 | |
| 3 | 3 |
<% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %>
|
| 4 | 4 |
<%= f.hidden_field :version %> |
| 5 |
<%= hidden_field_tag 'parent', @page.parent_title %> |
|
| 5 | 6 |
<%= error_messages_for 'content' %> |
| 6 | 7 | |
| 7 | 8 |
<p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %></p> |