Mercurial > hg > soundsoftware-site
comparison app/helpers/wiki_helper.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # encoding: utf-8 | 1 # encoding: utf-8 |
2 # | 2 # |
3 # Redmine - project management software | 3 # Redmine - project management software |
4 # Copyright (C) 2006-2011 Jean-Philippe Lang | 4 # Copyright (C) 2006-2012 Jean-Philippe Lang |
5 # | 5 # |
6 # This program is free software; you can redistribute it and/or | 6 # This program is free software; you can redistribute it and/or |
7 # modify it under the terms of the GNU General Public License | 7 # modify it under the terms of the GNU General Public License |
8 # as published by the Free Software Foundation; either version 2 | 8 # as published by the Free Software Foundation; either version 2 |
9 # of the License, or (at your option) any later version. | 9 # of the License, or (at your option) any later version. |
19 | 19 |
20 module WikiHelper | 20 module WikiHelper |
21 | 21 |
22 def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) | 22 def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) |
23 pages = pages.group_by(&:parent) unless pages.is_a?(Hash) | 23 pages = pages.group_by(&:parent) unless pages.is_a?(Hash) |
24 s = '' | 24 s = ''.html_safe |
25 if pages.has_key?(parent) | 25 if pages.has_key?(parent) |
26 pages[parent].each do |page| | 26 pages[parent].each do |page| |
27 attrs = "value='#{page.id}'" | 27 attrs = "value='#{page.id}'" |
28 attrs << " selected='selected'" if selected == page | 28 attrs << " selected='selected'" if selected == page |
29 indent = (level > 0) ? (' ' * level * 2 + '» ') : nil | 29 indent = (level > 0) ? (' ' * level * 2 + '» ') : '' |
30 | 30 |
31 s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" + | 31 s << content_tag('option', (indent + h(page.pretty_title)).html_safe, :value => page.id.to_s, :selected => selected == page) + |
32 wiki_page_options_for_select(pages, selected, page, level + 1) | 32 wiki_page_options_for_select(pages, selected, page, level + 1) |
33 end | 33 end |
34 end | 34 end |
35 s | 35 s |
36 end | 36 end |
37 | 37 |
38 def wiki_page_breadcrumb(page) | 38 def wiki_page_breadcrumb(page) |
39 breadcrumb(page.ancestors.reverse.collect {|parent| | 39 breadcrumb(page.ancestors.reverse.collect {|parent| |
40 link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project}) | 40 link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project, :version => nil}) |
41 }) | 41 }) |
42 end | 42 end |
43 end | 43 end |