summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/link_helper.rb26
1 files changed, 12 insertions, 14 deletions
diff --git a/app/helpers/link_helper.rb b/app/helpers/link_helper.rb
index 29c58f0..85d8fbe 100644
--- a/app/helpers/link_helper.rb
+++ b/app/helpers/link_helper.rb
@@ -14,28 +14,26 @@ module LinkHelper
14 end 14 end
15 15
16 def link_to_path title, path, html_options = {} 16 def link_to_path title, path, html_options = {}
17 return "" if path.nil?
18
17 if params[:page_path] 19 if params[:page_path]
18 page_path = params[:page_path].is_a?(Array) ? params[:page_path].join("/") : params[:page_path] 20 page_path = params[:page_path].is_a?(Array) ? params[:page_path].join("/") : params[:page_path]
19 active = (page_path == path.sub(/^\//, "")) 21 active = (page_path == path.sub(/^\//, ""))
20 end 22 end
21 23
22 active_class = active ? {:class => 'active'} : {:class => 'inactive'} 24 active_class = active ? {:class => 'active'} : {:class => 'inactive'}
23 25
24 html_options = html_options.merge(active_class) 26 html_options = html_options.merge(active_class)
25 27
26 params[:locale] ||= I18n.locale 28 locale = params[:locale] || I18n.locale
27 29
28 link_to( 30 link_to(
29 title, { 31 title,
30 :controller => :content, 32 content_path(path.sub(/^\//, ""), :locale => locale),
31 :action => :render_page,
32 :locale => params[:locale],
33 :page_path => (path.sub(/^\//, "") rescue "")
34 },
35 html_options 33 html_options
36 ) 34 )
37 end 35 end
38 36
39 def selected? controller_name 37 def selected? controller_name
40 if params[:controller] == controller_name 38 if params[:controller] == controller_name
41 return :class => "selected" 39 return :class => "selected"
@@ -48,7 +46,7 @@ module LinkHelper
48 "Last modified #{@page.updated_at.to_s(:db)}" 46 "Last modified #{@page.updated_at.to_s(:db)}"
49 47
50 link_to( 48 link_to(
51 'Unlock', unlock_node_path(@node), :method => :put, :confirm => message 49 'Unlock', unlock_node_path(@node), :method => :put, :data => { :confirm => message }
52 ) 50 )
53 end 51 end
54 52