Commit 693f200171eda6f2fc3ab36c264795bf1d4a6f50
1 parent
0075cead
Exists in
master
and in
29 other branches
rails3: fix profile_controller
Showing
4 changed files
with
16 additions
and
24 deletions
Show diff stats
app/controllers/public/profile_controller.rb
... | ... | @@ -304,14 +304,6 @@ class ProfileController < PublicController |
304 | 304 | end |
305 | 305 | end |
306 | 306 | |
307 | - def profile_info | |
308 | - begin | |
309 | - @block = profile.blocks.find(params[:block_id]) | |
310 | - rescue | |
311 | - render :text => _('Profile information could not be loaded') | |
312 | - end | |
313 | - end | |
314 | - | |
315 | 307 | def report_abuse |
316 | 308 | @abuse_report = AbuseReport.new |
317 | 309 | render :layout => false | ... | ... |
app/views/blocks/profile_image.html.erb
... | ... | @@ -16,7 +16,7 @@ |
16 | 16 | |
17 | 17 | <% if !user.nil? and user.has_permission?('edit_profile', profile) %> |
18 | 18 | <div class='admin-link'> |
19 | - <%= link_to _('Control panel'), :controller => 'profile_editor' %> | |
19 | + <%= link_to _('Control panel'), block.owner.admin_url %> | |
20 | 20 | </div> |
21 | 21 | <% end %> |
22 | 22 | ... | ... |
app/views/blocks/profile_info.html.erb
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | <li><%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %></li> |
22 | 22 | <% end %> |
23 | 23 | <% if !user.nil? and user.has_permission?('edit_profile', profile) %> |
24 | - <li><%= link_to _('Control panel'), :controller => 'profile_editor' %></li> | |
24 | + <li><%= link_to _('Control panel'), block.owner.admin_url %></li> | |
25 | 25 | <% end %> |
26 | 26 | <% if profile.person? %> |
27 | 27 | <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> |
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | <% end %> |
41 | 41 | |
42 | 42 | <div class="profile-info-options"> |
43 | - <%= render :file => view_for_profile_actions(@block.owner.class) %> | |
43 | + <%= render :file => view_for_profile_actions(block.owner.class) %> | |
44 | 44 | </div> |
45 | 45 | |
46 | 46 | </div><!-- end class="vcard" --> | ... | ... |
test/functional/profile_controller_test.rb
... | ... | @@ -173,7 +173,7 @@ class ProfileControllerTest < ActionController::TestCase |
173 | 173 | should 'not show Leave This Community button for non-registered users' do |
174 | 174 | community = Community.create!(:name => 'my test community') |
175 | 175 | community.boxes.first.blocks << block = ProfileInfoBlock.create! |
176 | - get :profile_info, :profile => community.identifier, :block_id => block.id | |
176 | + get :index, :profile => community.identifier | |
177 | 177 | assert_no_match /\/profile\/#{@profile.identifier}\/leave/, @response.body |
178 | 178 | end |
179 | 179 | |
... | ... | @@ -203,7 +203,7 @@ class ProfileControllerTest < ActionController::TestCase |
203 | 203 | friend = create_user_full('friendtestuser').person |
204 | 204 | friend.user.activate |
205 | 205 | friend.boxes.first.blocks << block = ProfileInfoBlock.create! |
206 | - get :profile_info, :profile => friend.identifier, :block_id => block.id | |
206 | + get :index, :profile => friend.identifier | |
207 | 207 | assert_match /Add friend/, @response.body |
208 | 208 | end |
209 | 209 | |
... | ... | @@ -212,7 +212,7 @@ class ProfileControllerTest < ActionController::TestCase |
212 | 212 | friend = create_user_full('friendtestuser').person |
213 | 213 | friend.boxes.first.blocks << block = ProfileInfoBlock.create! |
214 | 214 | AddFriend.create!(:person => @profile, :friend => friend) |
215 | - get :profile_info, :profile => friend.identifier, :block_id => block.id | |
215 | + get :index, :profile => friend.identifier | |
216 | 216 | assert_no_match /Add friend/, @response.body |
217 | 217 | end |
218 | 218 | |
... | ... | @@ -223,7 +223,7 @@ class ProfileControllerTest < ActionController::TestCase |
223 | 223 | @profile.add_friend(friend) |
224 | 224 | @profile.friends.reload |
225 | 225 | assert @profile.is_a_friend?(friend) |
226 | - get :profile_info, :profile => friend.identifier, :block_id => block.id | |
226 | + get :index, :profile => friend.identifier | |
227 | 227 | assert_no_match /Add friend/, @response.body |
228 | 228 | end |
229 | 229 | |
... | ... | @@ -298,13 +298,13 @@ class ProfileControllerTest < ActionController::TestCase |
298 | 298 | should 'display contact us for enterprises' do |
299 | 299 | ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise') |
300 | 300 | ent.boxes.first.blocks << block = ProfileInfoBlock.create! |
301 | - get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id | |
301 | + get :index, :profile => 'my-test-enterprise' | |
302 | 302 | assert_match /\/contact\/my-test-enterprise\/new/, @response.body |
303 | 303 | end |
304 | 304 | |
305 | 305 | should 'not display contact us for non-enterprises' do |
306 | 306 | @profile.boxes.first.blocks << block = ProfileInfoBlock.create! |
307 | - get :profile_info, :profile => @profile.identifier, :block_id => block.id | |
307 | + get :index, :profile => @profile.identifier | |
308 | 308 | assert_no_match /\/contact\/#{@profile.identifier}\/new/, @response.body |
309 | 309 | end |
310 | 310 | |
... | ... | @@ -312,7 +312,7 @@ class ProfileControllerTest < ActionController::TestCase |
312 | 312 | ent = Enterprise.create! :name => 'my test enterprise', :identifier => 'my-test-enterprise' |
313 | 313 | ent.boxes.first.blocks << block = ProfileInfoBlock.create! |
314 | 314 | ent.update_attribute(:enable_contact_us, false) |
315 | - get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id | |
315 | + get :index, :profile => 'my-test-enterprise' | |
316 | 316 | assert_no_match /\/contact\/my-test-enterprise\/new/, @response.body |
317 | 317 | end |
318 | 318 | |
... | ... | @@ -325,7 +325,7 @@ class ProfileControllerTest < ActionController::TestCase |
325 | 325 | env.disable('disable_contact_person') |
326 | 326 | env.save! |
327 | 327 | login_as(@profile.identifier) |
328 | - get :profile_info, :profile => friend.identifier, :block_id => block.id | |
328 | + get :index, :profile => friend.identifier | |
329 | 329 | assert_match /\/contact\/#{friend.identifier}\/new/, @response.body |
330 | 330 | end |
331 | 331 | |
... | ... | @@ -333,7 +333,7 @@ class ProfileControllerTest < ActionController::TestCase |
333 | 333 | nofriend = create_user_full('no_friend').person |
334 | 334 | nofriend.boxes.first.blocks << block = ProfileInfoBlock.create! |
335 | 335 | login_as(@profile.identifier) |
336 | - get :profile_info, :profile => nofriend.identifier, :block_id => block.id | |
336 | + get :index, :profile => nofriend.identifier | |
337 | 337 | assert_no_match /\/contact\/#{nofriend.identifier}\/new/, @response.body |
338 | 338 | end |
339 | 339 | |
... | ... | @@ -346,7 +346,7 @@ class ProfileControllerTest < ActionController::TestCase |
346 | 346 | env.save! |
347 | 347 | @profile.add_friend(friend) |
348 | 348 | login_as(@profile.identifier) |
349 | - get :profile_info, :profile => friend.identifier, :block_id => block.id | |
349 | + get :index, :profile => friend.identifier | |
350 | 350 | assert_match /\/contact\/#{friend.identifier}\/new/, @response.body |
351 | 351 | end |
352 | 352 | |
... | ... | @@ -358,7 +358,7 @@ class ProfileControllerTest < ActionController::TestCase |
358 | 358 | env.save! |
359 | 359 | @profile.add_friend(friend) |
360 | 360 | login_as(@profile.identifier) |
361 | - get :profile_info, :profile => friend.identifier, :block_id => block.id | |
361 | + get :index, :profile => friend.identifier | |
362 | 362 | assert_no_match /\/contact\/#{friend.identifier}\/new/, @response.body |
363 | 363 | end |
364 | 364 | |
... | ... | @@ -370,7 +370,7 @@ class ProfileControllerTest < ActionController::TestCase |
370 | 370 | env.save! |
371 | 371 | community.add_member(@profile) |
372 | 372 | login_as(@profile.identifier) |
373 | - get :profile_info, :profile => community.identifier, :block_id => block.id | |
373 | + get :index, :profile => community.identifier | |
374 | 374 | assert_match /\/contact\/#{community.identifier}\/new/, @response.body |
375 | 375 | end |
376 | 376 | |
... | ... | @@ -382,7 +382,7 @@ class ProfileControllerTest < ActionController::TestCase |
382 | 382 | env.save! |
383 | 383 | community.add_member(@profile) |
384 | 384 | login_as(@profile.identifier) |
385 | - get :profile_info, :profile => community.identifier, :block_id => block.id | |
385 | + get :index, :profile => community.identifier | |
386 | 386 | assert_no_match /\/contact\/#{community.identifier}\/new/, @response.body |
387 | 387 | end |
388 | 388 | ... | ... |