@@ -5,18 +5,18 | |||||
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 |
# |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 |
# |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
14 | # You should have received a copy of the GNU General Public License | |
15 | # along with this program; if not, write to the Free Software |
|
15 | # along with this program; if not, write to the Free Software | |
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | module WikiHelper |
|
18 | module WikiHelper | |
19 |
|
19 | |||
20 | def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) |
|
20 | def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) | |
21 | pages = pages.group_by(&:parent) unless pages.is_a?(Hash) |
|
21 | pages = pages.group_by(&:parent) unless pages.is_a?(Hash) | |
22 | s = '' |
|
22 | s = '' | |
@@ -25,14 +25,14 module WikiHelper | |||||
25 | attrs = "value='#{page.id}'" |
|
25 | attrs = "value='#{page.id}'" | |
26 | attrs << " selected='selected'" if selected == page |
|
26 | attrs << " selected='selected'" if selected == page | |
27 | indent = (level > 0) ? (' ' * level * 2 + '» ') : nil |
|
27 | indent = (level > 0) ? (' ' * level * 2 + '» ') : nil | |
28 |
|
28 | |||
29 |
s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" + |
|
29 | s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" + | |
30 | wiki_page_options_for_select(pages, selected, page, level + 1) |
|
30 | wiki_page_options_for_select(pages, selected, page, level + 1) | |
31 | end |
|
31 | end | |
32 | end |
|
32 | end | |
33 | s |
|
33 | s | |
34 | end |
|
34 | end | |
35 |
|
35 | |||
36 | def wiki_page_breadcrumb(page) |
|
36 | def wiki_page_breadcrumb(page) | |
37 | breadcrumb(page.ancestors.reverse.collect {|parent| |
|
37 | breadcrumb(page.ancestors.reverse.collect {|parent| | |
38 | link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project}) |
|
38 | link_to(h(parent.pretty_title), {:controller => 'wiki', :action => 'show', :id => parent.title, :project_id => parent.project}) |
General Comments 0
You need to be logged in to leave comments.
Login now