[Git][noosfero/noosfero][master] 2 commits: Fix work assignment plugin issues on rails 4

Bráulio Bhavamitra gitlab at mg.gitlab.com
Wed Jun 22 07:59:15 BRT 2016


Bráulio Bhavamitra pushed to branch master at Noosfero / noosfero


Commits:
ff2e07fc by Tallys Martins at 2016-06-17T15:36:46-03:00
Fix work assignment plugin issues on rails 4

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>
Signed-off-by: Luan Guimarães <guimaraesluan at me.com>
Signed-off-by: Marcos Ronaldo <marcos.rpj2 at gmail.com>
Signed-off-by: Omar Junior <omarroinuj at gmail.com>
Signed-off-by: Tallys Martins <tallysmartins at gmail.com>

- - - - -
ba577a75 by Bráulio Bhavamitra at 2016-06-22T10:58:49+00:00
Merge branch 'fix_work_assignment' into 'master'

Fix work assignment plugin issues on rails 4

- Fixed submissions not being displayed on work assignment page
- Fixed email notifications not being sent

See merge request !967
- - - - -


3 changed files:

- plugins/work_assignment/lib/work_assignment_plugin/email_contact.rb
- plugins/work_assignment/lib/work_assignment_plugin/helper.rb
- plugins/work_assignment/test/functional/content_viewer_controller_test.rb


Changes:

=====================================
plugins/work_assignment/lib/work_assignment_plugin/email_contact.rb
=====================================
--- a/plugins/work_assignment/lib/work_assignment_plugin/email_contact.rb
+++ b/plugins/work_assignment/lib/work_assignment_plugin/email_contact.rb
@@ -50,13 +50,13 @@ class WorkAssignmentPlugin::EmailContact
       mail(options)
     end
 
-    def build_mail_message(email_contact, uploaded_files)
+    def self.build_mail_message(email_contact, uploaded_files)
       message = ""
       if uploaded_files && uploaded_files.first && uploaded_files.first.parent && uploaded_files.first.parent.parent
         article = uploaded_files.first.parent.parent
         message = article.default_email + "<br>"
         uploaded_files.each do |file|
-          url = url_for(file.url)
+          url = Rails.application.routes.url_helpers.url_for(file.url)
           message += "<br><a href='#{url}'>#{url}</a>"
         end
       end


=====================================
plugins/work_assignment/lib/work_assignment_plugin/helper.rb
=====================================
--- a/plugins/work_assignment/lib/work_assignment_plugin/helper.rb
+++ b/plugins/work_assignment/lib/work_assignment_plugin/helper.rb
@@ -16,7 +16,7 @@ module WorkAssignmentPlugin::Helper
   end
 
   def display_author_folder(author_folder, user)
-    return if author_folder.children.empty?
+    return if author_folder.children(true).empty?
     content_tag('tr',
       content_tag('td', link_to_last_submission(author_folder, user)) +
       content_tag('td', time_format(author_folder.children.last.created_at)) +


=====================================
plugins/work_assignment/test/functional/content_viewer_controller_test.rb
=====================================
--- a/plugins/work_assignment/test/functional/content_viewer_controller_test.rb
+++ b/plugins/work_assignment/test/functional/content_viewer_controller_test.rb
@@ -35,6 +35,14 @@ class ContentViewerControllerTest < ActionController::TestCase
     assert_response :success
   end
 
+  should 'display users submissions' do
+    folder = work_assignment.find_or_create_author_folder(@person)
+    submission = UploadedFile.create!(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png'), :profile => organization, :parent => folder)
+    get :view_page, :profile => @organization.identifier, :page => work_assignment.path
+    assert_response :success
+    assert_match /rails.png/, @response.body
+  end
+
   should "display 'Upload files' when create children of image gallery" do
     login_as(profile.identifier)
     f = Gallery.create!(:name => 'gallery', :profile => profile)



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/7c0e23cb0fbef49c0c4960ddf2029bc48d105530...ba577a75a0db1486e3e7a38291e5da4303510e4e
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160622/5c17cbf9/attachment-0001.html>


More information about the Noosfero-dev mailing list