Commit 3f49f33eef69b4fd40d9cf530f9ef9d65e872b46
Committed by
Luciano Prestes
1 parent
00e189ae
Exists in
master
and in
5 other branches
Fix software task, to manage tasks properly.
Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com> Signed-off-by: Parley Martins <parley@outlook.com>
Showing
3 changed files
with
7 additions
and
11 deletions
Show diff stats
controllers/mpog_software_plugin_myprofile_controller.rb
@@ -53,7 +53,6 @@ class MpogSoftwarePluginMyprofileController < MyProfileController | @@ -53,7 +53,6 @@ class MpogSoftwarePluginMyprofileController < MyProfileController | ||
53 | valid_software_info = request.post? && @software_info.valid? | 53 | valid_software_info = request.post? && @software_info.valid? |
54 | valid_license = (request.post? && @license_info.valid?) | 54 | valid_license = (request.post? && @license_info.valid?) |
55 | if valid_software_info && valid_license && valid_community | 55 | if valid_software_info && valid_license && valid_community |
56 | - @community = Community.create_after_moderation(user, {:environment => environment}.merge(params[:community]), @software_info, @license_info ) | ||
57 | @software_info = SoftwareInfo.create_after_moderation(user,params[:software_info].merge({:environment => environment,:name => params[:community][:name]})) | 56 | @software_info = SoftwareInfo.create_after_moderation(user,params[:software_info].merge({:environment => environment,:name => params[:community][:name]})) |
58 | unless params[:q].nil? | 57 | unless params[:q].nil? |
59 | admins = params[:q].split(/,/).map{|n| environment.people.find n.to_i} | 58 | admins = params[:q].split(/,/).map{|n| environment.people.find n.to_i} |
@@ -63,13 +62,8 @@ class MpogSoftwarePluginMyprofileController < MyProfileController | @@ -63,13 +62,8 @@ class MpogSoftwarePluginMyprofileController < MyProfileController | ||
63 | @community.add_admin(admin) | 62 | @community.add_admin(admin) |
64 | end | 63 | end |
65 | end | 64 | end |
66 | - | ||
67 | - if environment.enabled?("admin_must_approve_new_communities") and !environment.admins.include?(current_user.person) | ||
68 | session[:notice] = _('Your new software request will be evaluated by an administrator. You will be notified.') | 65 | session[:notice] = _('Your new software request will be evaluated by an administrator. You will be notified.') |
69 | redirect_to user.admin_url | 66 | redirect_to user.admin_url |
70 | - else | ||
71 | - redirect_to :controller => 'profile_editor', :action => 'edit', :profile => @community.identifier | ||
72 | - end | ||
73 | else | 67 | else |
74 | 68 | ||
75 | @errors |= @community.errors.full_messages | 69 | @errors |= @community.errors.full_messages |
lib/create_software.rb
@@ -3,12 +3,12 @@ class CreateSoftware < Task | @@ -3,12 +3,12 @@ class CreateSoftware < Task | ||
3 | validates_presence_of :requestor_id, :target_id | 3 | validates_presence_of :requestor_id, :target_id |
4 | validates_presence_of :name | 4 | validates_presence_of :name |
5 | 5 | ||
6 | - attr_accessible :name, :finality, :repository_link, :requestor, :environment | 6 | + attr_accessible :name, :finality, :repository_link, :requestor, :environment, :reject_explanation |
7 | 7 | ||
8 | alias :environment :target | 8 | alias :environment :target |
9 | alias :environment= :target= | 9 | alias :environment= :target= |
10 | 10 | ||
11 | - DATA_FIELDS = ['name', 'finality', 'license_infos_id', 'repository_link'] | 11 | + DATA_FIELDS = ['name', 'finality', 'license_info_id', 'repository_link'] |
12 | DATA_FIELDS.each do |field| | 12 | DATA_FIELDS.each do |field| |
13 | settings_items field.to_sym | 13 | settings_items field.to_sym |
14 | end | 14 | end |
@@ -19,8 +19,8 @@ class CreateSoftware < Task | @@ -19,8 +19,8 @@ class CreateSoftware < Task | ||
19 | community.environment = self.environment | 19 | community.environment = self.environment |
20 | community.add_admin(self.requestor) | 20 | community.add_admin(self.requestor) |
21 | 21 | ||
22 | - software = SoftwareInfo.create!(:name => self.name, :finality => self.finality, | ||
23 | - :repository_link => self.repository_link, :community => community, | 22 | + software = SoftwareInfo.create!(:finality => self.finality, |
23 | + :repository_link => self.repository_link, :community_id => community.id, | ||
24 | :license_info_id => self.license_info_id) | 24 | :license_info_id => self.license_info_id) |
25 | end | 25 | end |
26 | 26 | ||
@@ -82,4 +82,6 @@ class CreateSoftware < Task | @@ -82,4 +82,6 @@ class CreateSoftware < Task | ||
82 | _('Your request for registering the software "%{software}" was approved. You can access %{environment} now and start using your new software.') % { :software => self.name, :environment => self.environment } | 82 | _('Your request for registering the software "%{software}" was approved. You can access %{environment} now and start using your new software.') % { :software => self.name, :environment => self.environment } |
83 | end | 83 | end |
84 | 84 | ||
85 | + private | ||
86 | + | ||
85 | end | 87 | end |
lib/software_info.rb
1 | class SoftwareInfo < ActiveRecord::Base | 1 | class SoftwareInfo < ActiveRecord::Base |
2 | attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform | 2 | attr_accessible :e_mag, :icp_brasil, :intern, :e_ping, :e_arq, :operating_platform |
3 | - attr_accessible :demonstration_url, :acronym, :objectives, :features, :license_infos_id | 3 | + attr_accessible :demonstration_url, :acronym, :objectives, :features, :license_info_id |
4 | attr_accessible :community_id, :finality, :repository_link, :public_software, :first_edit | 4 | attr_accessible :community_id, :finality, :repository_link, :public_software, :first_edit |
5 | 5 | ||
6 | has_many :libraries, :dependent => :destroy | 6 | has_many :libraries, :dependent => :destroy |