Commit fd3d68cec637efda68fde48fd62de764a8b3bb57

Authored by David Silva
1 parent f8614ab7

Creates constroy_software method in mpog_software_plugin_myprofile_controller.

  - Create private methods to use it in
    mpog_software_plugin_myprofile_controller actions.

Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
controllers/mpog_software_plugin_myprofile_controller.rb
@@ -25,14 +25,7 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController @@ -25,14 +25,7 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
25 else 25 else
26 LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"]) 26 LicenseInfo.find(:first, :conditions =>["version = ?","#{params[:license_info][:version]}"])
27 end 27 end
28 -  
29 - valid_models = request.post? && (@community.valid? && @software_info.valid? && @license_info.valid?)  
30 -  
31 - if valid_models  
32 - send_software_to_moderation  
33 - else  
34 - add_software_erros  
35 - end 28 + control_software_creation
36 end 29 end
37 30
38 def search_offerers 31 def search_offerers
@@ -77,6 +70,15 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController @@ -77,6 +70,15 @@ class MpogSoftwarePluginMyprofileController &lt; MyProfileController
77 @errors |= @license_info.errors.full_messages 70 @errors |= @license_info.errors.full_messages
78 end 71 end
79 72
  73 + def control_software_creation
  74 + valid_models = request.post? && (@community.valid? && @software_info.valid? && @license_info.valid?)
  75 + if valid_models
  76 + send_software_to_moderation
  77 + else
  78 + add_software_erros
  79 + end
  80 + end
  81 +
80 def update_institution 82 def update_institution
81 @institution.community.update_attributes(params[:community]) 83 @institution.community.update_attributes(params[:community])
82 @institution.update_attributes(params[:institutions].except(:governmental_power, :governmental_sphere, :juridical_nature)) 84 @institution.update_attributes(params[:institutions].except(:governmental_power, :governmental_sphere, :juridical_nature))