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 | 53 | valid_software_info = request.post? && @software_info.valid? |
54 | 54 | valid_license = (request.post? && @license_info.valid?) |
55 | 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 | 56 | @software_info = SoftwareInfo.create_after_moderation(user,params[:software_info].merge({:environment => environment,:name => params[:community][:name]})) |
58 | 57 | unless params[:q].nil? |
59 | 58 | admins = params[:q].split(/,/).map{|n| environment.people.find n.to_i} |
... | ... | @@ -63,13 +62,8 @@ class MpogSoftwarePluginMyprofileController < MyProfileController |
63 | 62 | @community.add_admin(admin) |
64 | 63 | end |
65 | 64 | end |
66 | - | |
67 | - if environment.enabled?("admin_must_approve_new_communities") and !environment.admins.include?(current_user.person) | |
68 | 65 | session[:notice] = _('Your new software request will be evaluated by an administrator. You will be notified.') |
69 | 66 | redirect_to user.admin_url |
70 | - else | |
71 | - redirect_to :controller => 'profile_editor', :action => 'edit', :profile => @community.identifier | |
72 | - end | |
73 | 67 | else |
74 | 68 | |
75 | 69 | @errors |= @community.errors.full_messages | ... | ... |
lib/create_software.rb
... | ... | @@ -3,12 +3,12 @@ class CreateSoftware < Task |
3 | 3 | validates_presence_of :requestor_id, :target_id |
4 | 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 | 8 | alias :environment :target |
9 | 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 | 12 | DATA_FIELDS.each do |field| |
13 | 13 | settings_items field.to_sym |
14 | 14 | end |
... | ... | @@ -19,8 +19,8 @@ class CreateSoftware < Task |
19 | 19 | community.environment = self.environment |
20 | 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 | 24 | :license_info_id => self.license_info_id) |
25 | 25 | end |
26 | 26 | |
... | ... | @@ -82,4 +82,6 @@ class CreateSoftware < Task |
82 | 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 | 83 | end |
84 | 84 | |
85 | + private | |
86 | + | |
85 | 87 | end | ... | ... |
lib/software_info.rb
1 | 1 | class SoftwareInfo < ActiveRecord::Base |
2 | 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 | 4 | attr_accessible :community_id, :finality, :repository_link, :public_software, :first_edit |
5 | 5 | |
6 | 6 | has_many :libraries, :dependent => :destroy | ... | ... |