From 008118fb28e1eaf2f50a3f3dba3f5efc41d4da79 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Wed, 27 Feb 2008 15:18:37 +0000 Subject: [PATCH] ActionItem36: displaying list of pending requests so the user can act on them --- app/controllers/my_profile/profile_editor_controller.rb | 4 ++++ app/views/profile_editor/_pending_tasks.rhtml | 9 +++++++++ app/views/profile_editor/index.rhtml | 2 ++ public/designs/icons/default/README | 1 + public/designs/icons/default/stock_todo.png | Bin 0 -> 821 bytes public/designs/icons/default/style.css | 1 + public/stylesheets/common.css | 10 ++++++++++ test/functional/profile_editor_controller_test.rb | 13 +++++++++++++ 8 files changed, 40 insertions(+), 0 deletions(-) create mode 100644 app/views/profile_editor/_pending_tasks.rhtml create mode 100644 public/designs/icons/default/stock_todo.png diff --git a/app/controllers/my_profile/profile_editor_controller.rb b/app/controllers/my_profile/profile_editor_controller.rb index 3ff9af6..49dd661 100644 --- a/app/controllers/my_profile/profile_editor_controller.rb +++ b/app/controllers/my_profile/profile_editor_controller.rb @@ -2,6 +2,10 @@ class ProfileEditorController < MyProfileController # protect 'edit_profile', :profile, :only => [:index, :edit] + def index + @pending_tasks = profile.tasks.pending + end + helper :profile # edits the profile info (posts back) diff --git a/app/views/profile_editor/_pending_tasks.rhtml b/app/views/profile_editor/_pending_tasks.rhtml new file mode 100644 index 0000000..9ec05fd --- /dev/null +++ b/app/views/profile_editor/_pending_tasks.rhtml @@ -0,0 +1,9 @@ +<% unless @pending_tasks.empty? %> +
+

<%= _('You have pending requests') %>

+ + <%= button(:todo, _('Process requests'), :controller => 'tasks', :action => 'index') %> +
+<% end %> diff --git a/app/views/profile_editor/index.rhtml b/app/views/profile_editor/index.rhtml index dcbb72e..85ed8c0 100644 --- a/app/views/profile_editor/index.rhtml +++ b/app/views/profile_editor/index.rhtml @@ -1,5 +1,7 @@

<%= _('My profile') %>

+<%= render :partial => 'pending_tasks' %> + <%= link_to (@profile.image ? image_tag( @profile.image.public_filename) : _('Put image')), :action => 'change_image' %> <%= display_profile_info(profile) %> diff --git a/public/designs/icons/default/README b/public/designs/icons/default/README index bcc7476..b019698 100644 --- a/public/designs/icons/default/README +++ b/public/designs/icons/default/README @@ -39,6 +39,7 @@ gtk-go-down.png Nuovo stock/ gnome-search.png Nuovo apps/ gtk-ok.png Nuovo stock/ password.png Nuovo apps/ +stock_todo.png Nuovo stock/ ### END OF ICONS LISTING ### Icons made for Noosfero, by The Noosfero Team: diff --git a/public/designs/icons/default/stock_todo.png b/public/designs/icons/default/stock_todo.png new file mode 100644 index 0000000..4377423 Binary files /dev/null and b/public/designs/icons/default/stock_todo.png differ diff --git a/public/designs/icons/default/style.css b/public/designs/icons/default/style.css index 010b678..5de667d 100644 --- a/public/designs/icons/default/style.css +++ b/public/designs/icons/default/style.css @@ -36,3 +36,4 @@ .icon-menu-logout { background-image: url(exit-HC.gif) } .icon-menu-search { background-image: url(search-HC.gif) } .icon-menu-ed-design { background-image: url(edit-design-HC.gif) } +.icon-todo { background-image: url(stock_todo.png); } diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index 0df9642..861fff7 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -444,3 +444,13 @@ div.auto-complete li.selected { background: #B8CFE7; color: #204A87; } + +/* pending tasks list */ + +div.pending-tasks { + background: #B8CFE7; + color: #204A87; + border: 2px solid #204A87; + padding: 2px; + margin: 1em; +} diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index b4e8103..5a24dda 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -31,6 +31,19 @@ class ProfileEditorControllerTest < Test::Unit::TestCase assert_tag :tag => 'td', :content => 'my contact information' end + def test_should_present_pending_tasks_in_index + ze = Profile['ze'] # a fixture >:-( + @controller.expects(:profile).returns(ze).at_least_once + tasks = mock + pending = [] + pending.expects(:empty?).returns(false) # force the display of the pending tasks list + tasks.expects(:pending).returns(pending) + ze.expects(:tasks).returns(tasks) + get :index, :profile => ze.identifier + assert_same pending, assigns(:pending_tasks) + assert_tag :tag => 'div', :attributes => { :class => 'pending-tasks' }, :descendant => { :tag => 'a', :attributes => { :href => '/myprofile/ze/tasks' } } + end + def test_edit_person_info person = User.create(:login => 'test_profile', :email => 'test@noosfero.org', :password => 'test', :password_confirmation => 'test').person -- libgit2 0.21.2