Commit 4a74f898ec3b109e439548fa19ac33c00b872d31
1 parent
0174a4a8
Exists in
master
and in
29 other branches
ActionItem959: making it work for communities with their own domain
Showing
3 changed files
with
11 additions
and
1 deletions
Show diff stats
app/views/shared/join_community_popup.rhtml
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | <% else %> |
8 | 8 | <%= button(:ok, _('Yes'), :controller => 'profile', :action => 'join', :profile => profile.identifier) %> |
9 | 9 | <% end %> |
10 | - <%= button_to_remote(:cancel, _('Not now'), :url => {:controller => 'profile', :action => 'refuse_for_now', :profile => profile.identifier}, :loaded => '$("join-community-popup").hide()') %> | |
10 | + <%= button_to_remote(:cancel, _('Not now'), :url => profile.url.merge({:controller => 'profile', :action => 'refuse_for_now', :profile => profile.identifier}), :loaded => '$("join-community-popup").hide()') %> | |
11 | 11 | <%= button(:cancel, _('No and don\'t ask again'), :controller => 'profile', :action => 'refuse_join', :profile => profile.identifier) if logged_in? %> |
12 | 12 | <% end %> |
13 | 13 | </div> | ... | ... |
config/routes.rb
... | ... | @@ -20,6 +20,7 @@ ActionController::Routing::Routes.draw do |map| |
20 | 20 | domain = Domain.find_by_name(env[:host]) |
21 | 21 | domain && (domain.owner_type == 'Profile') |
22 | 22 | end |
23 | + map.connect 'profile/:profile/:action/:id', :controller => 'profile', :id => /.*/, :profile => /#{Noosfero.identifier_format}/, :conditions => { :if => hosted_domain_matcher } | |
23 | 24 | map.connect '*page', :controller => 'content_viewer', :action => 'view_page', :conditions => { :if => hosted_domain_matcher } |
24 | 25 | |
25 | 26 | map.connect 'test/:controller/:action/:id' , :controller => /.*test.*/ | ... | ... |
test/integration/routing_test.rb
... | ... | @@ -174,6 +174,15 @@ class RoutingTest < ActionController::IntegrationTest |
174 | 174 | assert_routing('/work/free-software', :controller => 'content_viewer', :action => 'view_page', :page => [ 'work', 'free-software'] ) |
175 | 175 | end |
176 | 176 | |
177 | + def test_profile_under_hosted_domain | |
178 | + community = Community.create!(:identifier => 'testcomm', :name => "test community") | |
179 | + domain = Domain.create!(:name => 'example.com', :owner => community) | |
180 | + | |
181 | + ActionController::TestRequest.any_instance.expects(:host).returns('www.example.com') | |
182 | + | |
183 | + assert_routing('/profile/testcomm/refuse_for_now', :controller => 'profile', :action => 'refuse_for_now', :profile => 'testcomm') | |
184 | + end | |
185 | + | |
177 | 186 | def test_must_not_route_as_profile_hosted_domain_for_domains_registered_for_environments |
178 | 187 | environment = Environment.default |
179 | 188 | domain = Domain.create!(:name => 'example.com', :owner => environment) | ... | ... |