Commit fde597849bded051b90f5d026e9e22a06cb05e9d
Exists in
master
and in
29 other branches
Merge commit 'refs/merge-requests/312' of git://gitorious.org/noosfero/noosfero …
…into merge-requests/312
Showing
2 changed files
with
12 additions
and
2 deletions
Show diff stats
plugins/work_assignment/lib/work_assignment_plugin.rb
| @@ -32,7 +32,9 @@ class WorkAssignmentPlugin < Noosfero::Plugin | @@ -32,7 +32,9 @@ class WorkAssignmentPlugin < Noosfero::Plugin | ||
| 32 | end | 32 | end |
| 33 | 33 | ||
| 34 | def content_remove_upload(content) | 34 | def content_remove_upload(content) |
| 35 | - !content.profile.members.include?(context.send(:user)) | 35 | + if content.kind_of?(WorkAssignmentPlugin::WorkAssignment) |
| 36 | + !content.profile.members.include?(context.send(:user)) | ||
| 37 | + end | ||
| 36 | end | 38 | end |
| 37 | 39 | ||
| 38 | def content_viewer_controller_filters | 40 | def content_viewer_controller_filters |
plugins/work_assignment/test/functional/content_viewer_controller_test.rb
| @@ -10,6 +10,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -10,6 +10,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 10 | @controller = ContentViewerController.new | 10 | @controller = ContentViewerController.new |
| 11 | @request = ActionController::TestRequest.new | 11 | @request = ActionController::TestRequest.new |
| 12 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
| 13 | + @profile = create_user('testinguser').person | ||
| 13 | 14 | ||
| 14 | @organization = fast_create(Organization) | 15 | @organization = fast_create(Organization) |
| 15 | @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => @organization) | 16 | @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => @organization) |
| @@ -19,7 +20,7 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -19,7 +20,7 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 19 | @environment.save! | 20 | @environment.save! |
| 20 | login_as(:test_user) | 21 | login_as(:test_user) |
| 21 | end | 22 | end |
| 22 | - attr_reader :organization, :person, :work_assignment | 23 | + attr_reader :organization, :person, :profile, :work_assignment |
| 23 | 24 | ||
| 24 | should 'can download work_assignment' do | 25 | should 'can download work_assignment' do |
| 25 | random_member = fast_create(Person) | 26 | random_member = fast_create(Person) |
| @@ -38,4 +39,11 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -38,4 +39,11 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
| 38 | assert_response :success | 39 | assert_response :success |
| 39 | end | 40 | end |
| 40 | 41 | ||
| 42 | + should "display 'Upload files' when create children of image gallery" do | ||
| 43 | + login_as(profile.identifier) | ||
| 44 | + f = Gallery.create!(:name => 'gallery', :profile => profile) | ||
| 45 | + xhr :get, :view_page, :profile => profile.identifier, :page => f.explode_path, :toolbar => true | ||
| 46 | + assert_tag :tag => 'a', :content => 'Upload files', :attributes => {:href => /parent_id=#{f.id}/} | ||
| 47 | + end | ||
| 48 | + | ||
| 41 | end | 49 | end |