Commit 0595bfe6ea1d1753cb4155a1ca4526635ccd664f
1 parent
7faaddca
Exists in
fix_sign_up_form
Limit task list in profile editor
Showing
2 changed files
with
20 additions
and
2 deletions
Show diff stats
app/views/profile_editor/_pending_tasks.html.erb
| @@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
| 2 | 2 | ||
| 3 | <% unless @pending_tasks.empty? %> | 3 | <% unless @pending_tasks.empty? %> |
| 4 | <div class='pending-tasks'> | 4 | <div class='pending-tasks'> |
| 5 | - <h2><%= _('You have pending requests') %></h2> | 5 | + <h2><%= _('You have %s pending requests' % @pending_tasks.count) %></h2> |
| 6 | <ul> | 6 | <ul> |
| 7 | - <%= safe_join(@pending_tasks.map {|task| content_tag('li', task_information(task).html_safe)}) %> | 7 | + <%= safe_join(@pending_tasks.limit(5).map {|task| content_tag('li', task_information(task).html_safe)}) %> |
| 8 | </ul> | 8 | </ul> |
| 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> | 9 | <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> |
| 10 | </div> | 10 | </div> |
test/functional/profile_editor_controller_test.rb
| @@ -408,6 +408,24 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -408,6 +408,24 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
| 408 | assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } | 408 | assert_no_tag :tag => 'div', :attributes => { :class => 'pending-tasks' } |
| 409 | end | 409 | end |
| 410 | 410 | ||
| 411 | + should 'limit task list' do | ||
| 412 | + user2 = create_user('usertwo').person | ||
| 413 | + 6.times { AddFriend.create!(:person => create_user.person, :friend => user2) } | ||
| 414 | + login_as('usertwo') | ||
| 415 | + get :index, :profile => 'usertwo' | ||
| 416 | + assert_select '.pending-tasks > ul > li', 5 | ||
| 417 | + end | ||
| 418 | + | ||
| 419 | + should 'display task count in task list' do | ||
| 420 | + user2 = create_user('usertwo').person | ||
| 421 | + 6.times { AddFriend.create!(:person => create_user.person, :friend => user2) } | ||
| 422 | + login_as('usertwo') | ||
| 423 | + get :index, :profile => 'usertwo' | ||
| 424 | + assert_select '.pending-tasks h2' do |elements| | ||
| 425 | + assert_match /6/, elements.first.content | ||
| 426 | + end | ||
| 427 | + end | ||
| 428 | + | ||
| 411 | should 'show favorite enterprises button for person' do | 429 | should 'show favorite enterprises button for person' do |
| 412 | get :index, :profile => profile.identifier | 430 | get :index, :profile => profile.identifier |
| 413 | assert_tag :tag => 'a', :content => 'Favorite Enterprises' | 431 | assert_tag :tag => 'a', :content => 'Favorite Enterprises' |