summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-26 12:54:54 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-07-26 12:54:54 +0000
commitec7d1359301b28a506d3c9e9ad5785cf84d3fcd9 (patch)
tree3ebc58910568791073a3e955b996c8fd5313e193 /app
parent60d066f943c68a348fee3a8350dc5ba88878b69c (diff)
downloadredmine-ec7d1359301b28a506d3c9e9ad5785cf84d3fcd9.tar.gz
redmine-ec7d1359301b28a506d3c9e9ad5785cf84d3fcd9.zip
Adds child_pages macro for wiki pages (#528).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1699 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/wiki_controller.rb5
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/wiki_helper.rb2
-rw-r--r--app/views/common/_preview.rhtml2
4 files changed, 7 insertions, 4 deletions
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 2430205cf..5a5f3949f 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -165,7 +165,10 @@ class WikiController < ApplicationController
page = @wiki.find_page(params[:page])
# page is nil when previewing a new page
return render_403 unless page.nil? || editable?(page)
- @attachements = page.attachments if page
+ if page
+ @attachements = page.attachments
+ @previewed = page.content
+ end
@text = params[:content][:text]
render :partial => 'common/preview'
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f5ce7ecda..6d6eb9107 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -206,7 +206,7 @@ module ApplicationHelper
options = args.last.is_a?(Hash) ? args.pop : {}
case args.size
when 1
- obj = nil
+ obj = options[:object]
text = args.shift
when 2
obj = args.shift
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb
index d27ce3ea3..0a6b810de 100644
--- a/app/helpers/wiki_helper.rb
+++ b/app/helpers/wiki_helper.rb
@@ -24,7 +24,7 @@ module WikiHelper
pages[node].each do |page|
content << "<li>"
content << link_to(h(page.pretty_title), {:action => 'index', :page => page.title},
- :title => l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)))
+ :title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil))
content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id]
content << "</li>\n"
end
diff --git a/app/views/common/_preview.rhtml b/app/views/common/_preview.rhtml
index e3bfc3a25..fd95f1188 100644
--- a/app/views/common/_preview.rhtml
+++ b/app/views/common/_preview.rhtml
@@ -1,3 +1,3 @@
<fieldset class="preview"><legend><%= l(:label_preview) %></legend>
-<%= textilizable @text, :attachments => @attachements %>
+<%= textilizable @text, :attachments => @attachements, :object => @previewed %>
</fieldset>