summaryrefslogtreecommitdiffstats
path: root/app/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-22 11:44:07 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-22 11:44:07 +0000
commit06266c8fecd78d620b7eb55c7d9df1b65340b5b1 (patch)
tree1c6938e22bf0b3fe52c7f2f4c2d9ade991224339 /app/helpers
parentaf7e586b063398fe75104837b1d11d0886139b7e (diff)
downloadredmine-06266c8fecd78d620b7eb55c7d9df1b65340b5b1.tar.gz
redmine-06266c8fecd78d620b7eb55c7d9df1b65340b5b1.zip
Extends child_pages macro to display child pages based on page parameter (#1975).
It can also be called from anywhere now (not only from wiki pages). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2053 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb16
-rw-r--r--app/helpers/wiki_helper.rb16
2 files changed, 16 insertions, 16 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4a72b022b..248704609 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -119,6 +119,22 @@ module ApplicationHelper
end
end
+ def render_page_hierarchy(pages, node=nil)
+ content = ''
+ if pages[node]
+ content << "<ul class=\"pages-hierarchy\">\n"
+ pages[node].each do |page|
+ content << "<li>"
+ content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title},
+ :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
+ content << "</ul>\n"
+ end
+ content
+ end
+
# Truncates and returns the string as a single line
def truncate_single_line(string, *args)
truncate(string, *args).gsub(%r{[\r\n]+}m, ' ')
diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb
index 0a6b810de..c692c748b 100644
--- a/app/helpers/wiki_helper.rb
+++ b/app/helpers/wiki_helper.rb
@@ -16,22 +16,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module WikiHelper
-
- def render_page_hierarchy(pages, node=nil)
- content = ''
- if pages[node]
- content << "<ul class=\"pages-hierarchy\">\n"
- pages[node].each do |page|
- content << "<li>"
- content << link_to(h(page.pretty_title), {:action => 'index', :page => page.title},
- :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
- content << "</ul>\n"
- end
- content
- end
def html_diff(wdiff)
words = wdiff.words.collect{|word| h(word)}