Project

General

Profile

Feature #2028 » patch_for_feature_2028.diff

Leandro Nunes dos Santos Nunes, 2008-10-14 21:39

View differences:

app/helpers/application_helper.rb (cópia de trabalho)
text = (Setting.text_formatting == 'textile') ?
Redmine::WikiFormatting.to_html(text) { |macro, args| exec_macro(macro, obj, args) } :
simple_format(auto_link(h(text)))
# different methods for formatting wiki links
case options[:wiki_links]
when :local
......
# used for single-file wiki export
format_wiki_link = Proc.new {|project, title, anchor| "##{title}" }
else
format_wiki_link = Proc.new {|project, title, anchor| url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => project, :page => title, :anchor => anchor) }
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) }
end
project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil)
......
end
# check if page exists
wiki_page = link_project.wiki.find_page(page)
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor),
link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page), anchor, obj.page),
:class => ('wiki-page' + (wiki_page ? '' : ' new')))
else
# project or wiki doesn't exist
app/controllers/wiki_controller.rb (cópia de trabalho)
send_data(@content.text, :type => 'text/plain', :filename => "#{@page.title}.txt")
return
end
@editable = editable?
@editable = editable?
render :action => 'show'
end
......
def edit
@page = @wiki.find_or_new_page(params[:page])
return render_403 unless editable?
@page.content = WikiContent.new(:page => @page) if @page.new_record?
if @page.new_record?
@page.content = WikiContent.new(:page => @page)
@page.parent_title = params[:parent]
end
@content = @page.content_for_version(params[:version])
@content.text = "h1. #{@page.pretty_title}" if @content.text.blank?
app/views/wiki/edit.rhtml (cópia de trabalho)
<% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %>
<%= f.hidden_field :version %>
<%= hidden_field_tag 'parent', @page.parent_title %>
<%= error_messages_for 'content' %>
<p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %></p>
(1-1/2)