Commit fde597849bded051b90f5d026e9e22a06cb05e9d

Authored by Rodrigo Souto
2 parents 6be0e715 c51c60ec

Merge commit 'refs/merge-requests/312' of git://gitorious.org/noosfero/noosfero …

…into merge-requests/312
plugins/work_assignment/lib/work_assignment_plugin.rb
... ... @@ -32,7 +32,9 @@ class WorkAssignmentPlugin < Noosfero::Plugin
32 32 end
33 33  
34 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 38 end
37 39  
38 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 10 @controller = ContentViewerController.new
11 11 @request = ActionController::TestRequest.new
12 12 @response = ActionController::TestResponse.new
  13 + @profile = create_user('testinguser').person
13 14  
14 15 @organization = fast_create(Organization)
15 16 @work_assignment = WorkAssignmentPlugin::WorkAssignment.create!(:name => 'Work Assignment', :profile => @organization)
... ... @@ -19,7 +20,7 @@ class ContentViewerControllerTest < ActionController::TestCase
19 20 @environment.save!
20 21 login_as(:test_user)
21 22 end
22   - attr_reader :organization, :person, :work_assignment
  23 + attr_reader :organization, :person, :profile, :work_assignment
23 24  
24 25 should 'can download work_assignment' do
25 26 random_member = fast_create(Person)
... ... @@ -38,4 +39,11 @@ class ContentViewerControllerTest < ActionController::TestCase
38 39 assert_response :success
39 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 49 end
... ...