Commit 008118fb28e1eaf2f50a3f3dba3f5efc41d4da79
1 parent
55952f37
Exists in
master
and in
29 other branches
ActionItem36: displaying list of pending requests so the user can act on them
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1514 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
8 changed files
with
40 additions
and
0 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
| @@ -2,6 +2,10 @@ class ProfileEditorController < MyProfileController | @@ -2,6 +2,10 @@ class ProfileEditorController < MyProfileController | ||
| 2 | 2 | ||
| 3 | # protect 'edit_profile', :profile, :only => [:index, :edit] | 3 | # protect 'edit_profile', :profile, :only => [:index, :edit] |
| 4 | 4 | ||
| 5 | + def index | ||
| 6 | + @pending_tasks = profile.tasks.pending | ||
| 7 | + end | ||
| 8 | + | ||
| 5 | helper :profile | 9 | helper :profile |
| 6 | 10 | ||
| 7 | # edits the profile info (posts back) | 11 | # edits the profile info (posts back) |
| @@ -0,0 +1,9 @@ | @@ -0,0 +1,9 @@ | ||
| 1 | +<% unless @pending_tasks.empty? %> | ||
| 2 | + <div class='pending-tasks'> | ||
| 3 | + <h2><%= _('You have pending requests') %></h2> | ||
| 4 | + <ul> | ||
| 5 | + <%= @pending_tasks.map {|item| content_tag('li', item.description)} %> | ||
| 6 | + </ul> | ||
| 7 | + <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> | ||
| 8 | + </div> | ||
| 9 | +<% end %> |
app/views/profile_editor/index.rhtml
| 1 | <h1 class="block-title"><%= _('My profile') %></h1> | 1 | <h1 class="block-title"><%= _('My profile') %></h1> |
| 2 | 2 | ||
| 3 | +<%= render :partial => 'pending_tasks' %> | ||
| 4 | + | ||
| 3 | <%= link_to (@profile.image ? image_tag( @profile.image.public_filename) : _('Put image')), :action => 'change_image' %> | 5 | <%= link_to (@profile.image ? image_tag( @profile.image.public_filename) : _('Put image')), :action => 'change_image' %> |
| 4 | 6 | ||
| 5 | <%= display_profile_info(profile) %> | 7 | <%= display_profile_info(profile) %> |
public/designs/icons/default/README
| @@ -39,6 +39,7 @@ gtk-go-down.png Nuovo stock/ | @@ -39,6 +39,7 @@ gtk-go-down.png Nuovo stock/ | ||
| 39 | gnome-search.png Nuovo apps/ | 39 | gnome-search.png Nuovo apps/ |
| 40 | gtk-ok.png Nuovo stock/ | 40 | gtk-ok.png Nuovo stock/ |
| 41 | password.png Nuovo apps/ | 41 | password.png Nuovo apps/ |
| 42 | +stock_todo.png Nuovo stock/ | ||
| 42 | ### END OF ICONS LISTING ### | 43 | ### END OF ICONS LISTING ### |
| 43 | 44 | ||
| 44 | Icons made for Noosfero, by The Noosfero Team: | 45 | Icons made for Noosfero, by The Noosfero Team: |
821 Bytes
public/designs/icons/default/style.css
| @@ -36,3 +36,4 @@ | @@ -36,3 +36,4 @@ | ||
| 36 | .icon-menu-logout { background-image: url(exit-HC.gif) } | 36 | .icon-menu-logout { background-image: url(exit-HC.gif) } |
| 37 | .icon-menu-search { background-image: url(search-HC.gif) } | 37 | .icon-menu-search { background-image: url(search-HC.gif) } |
| 38 | .icon-menu-ed-design { background-image: url(edit-design-HC.gif) } | 38 | .icon-menu-ed-design { background-image: url(edit-design-HC.gif) } |
| 39 | +.icon-todo { background-image: url(stock_todo.png); } |
public/stylesheets/common.css
| @@ -444,3 +444,13 @@ div.auto-complete li.selected { | @@ -444,3 +444,13 @@ div.auto-complete li.selected { | ||
| 444 | background: #B8CFE7; | 444 | background: #B8CFE7; |
| 445 | color: #204A87; | 445 | color: #204A87; |
| 446 | } | 446 | } |
| 447 | + | ||
| 448 | +/* pending tasks list */ | ||
| 449 | + | ||
| 450 | +div.pending-tasks { | ||
| 451 | + background: #B8CFE7; | ||
| 452 | + color: #204A87; | ||
| 453 | + border: 2px solid #204A87; | ||
| 454 | + padding: 2px; | ||
| 455 | + margin: 1em; | ||
| 456 | +} |
test/functional/profile_editor_controller_test.rb
| @@ -31,6 +31,19 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -31,6 +31,19 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
| 31 | assert_tag :tag => 'td', :content => 'my contact information' | 31 | assert_tag :tag => 'td', :content => 'my contact information' |
| 32 | end | 32 | end |
| 33 | 33 | ||
| 34 | + def test_should_present_pending_tasks_in_index | ||
| 35 | + ze = Profile['ze'] # a fixture >:-( | ||
| 36 | + @controller.expects(:profile).returns(ze).at_least_once | ||
| 37 | + tasks = mock | ||
| 38 | + pending = [] | ||
| 39 | + pending.expects(:empty?).returns(false) # force the display of the pending tasks list | ||
| 40 | + tasks.expects(:pending).returns(pending) | ||
| 41 | + ze.expects(:tasks).returns(tasks) | ||
| 42 | + get :index, :profile => ze.identifier | ||
| 43 | + assert_same pending, assigns(:pending_tasks) | ||
| 44 | + assert_tag :tag => 'div', :attributes => { :class => 'pending-tasks' }, :descendant => { :tag => 'a', :attributes => { :href => '/myprofile/ze/tasks' } } | ||
| 45 | + end | ||
| 46 | + | ||
| 34 | def test_edit_person_info | 47 | def test_edit_person_info |
| 35 | person = User.create(:login => 'test_profile', :email => 'test@noosfero.org', :password => 'test', :password_confirmation => 'test').person | 48 | person = User.create(:login => 'test_profile', :email => 'test@noosfero.org', :password => 'test', :password_confirmation => 'test').person |
| 36 | 49 |