Commit 52e81c77e9c1c466faf5ecbd250d67e869373c57

Authored by Braulio Bhavamitra
Committed by Rodrigo Souto
1 parent 95cc44e0

navigation: Use environment host

For profiles with specific domains registered, the navigation should use
the URL for the environment, which are right the context of the navigation
links

Closes !484
Showing 1 changed file with 12 additions and 9 deletions   Show diff stats
app/helpers/application_helper.rb
... ... @@ -1049,10 +1049,11 @@ module ApplicationHelper
1049 1049 end
1050 1050  
1051 1051 def search_contents_menu
  1052 + host = environment.default_hostname
1052 1053 links = [
1053   - {s_('contents|More recent') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_recent'})}},
1054   - {s_('contents|More viewed') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_popular'})}},
1055   - {s_('contents|Most commented') => {:href => url_for({:controller => 'search', :action => 'contents', :filter => 'more_comments'})}}
  1054 + {s_('contents|More recent') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_recent'})}},
  1055 + {s_('contents|More viewed') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_popular'})}},
  1056 + {s_('contents|Most commented') => {href: url_for({host: host, controller: 'search', action: 'contents', filter: 'more_comments'})}}
1056 1057 ]
1057 1058 if logged_in?
1058 1059 links.push(_('New content') => modal_options({:href => url_for({:controller => 'cms', :action => 'new', :profile => current_user.login, :cms => true})}))
... ... @@ -1064,10 +1065,11 @@ module ApplicationHelper
1064 1065 alias :browse_contents_menu :search_contents_menu
1065 1066  
1066 1067 def search_people_menu
  1068 + host = environment.default_hostname
1067 1069 links = [
1068   - {s_('people|More recent') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_recent'})}},
1069   - {s_('people|More active') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_active'})}},
1070   - {s_('people|More popular') => {:href => url_for({:controller => 'search', :action => 'people', :filter => 'more_popular'})}}
  1070 + {s_('people|More recent') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_recent'})}},
  1071 + {s_('people|More active') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_active'})}},
  1072 + {s_('people|More popular') => {href: url_for({host: host, controller: 'search', action: 'people', filter: 'more_popular'})}}
1071 1073 ]
1072 1074 if logged_in?
1073 1075 links.push(_('My friends') => {:href => url_for({:profile => current_user.login, :controller => 'friends'})})
... ... @@ -1080,10 +1082,11 @@ module ApplicationHelper
1080 1082 alias :browse_people_menu :search_people_menu
1081 1083  
1082 1084 def search_communities_menu
  1085 + host = environment.default_hostname
1083 1086 links = [
1084   - {s_('communities|More recent') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_recent'})}},
1085   - {s_('communities|More active') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_active'})}},
1086   - {s_('communities|More popular') => {:href => url_for({:controller => 'search', :action => 'communities', :filter => 'more_popular'})}}
  1087 + {s_('communities|More recent') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_recent'})}},
  1088 + {s_('communities|More active') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_active'})}},
  1089 + {s_('communities|More popular') => {href: url_for({host: host, controller: 'search', action: 'communities', filter: 'more_popular'})}}
1087 1090 ]
1088 1091 if logged_in?
1089 1092 links.push(_('My communities') => {:href => url_for({:profile => current_user.login, :controller => 'memberships'})})
... ...