Commit 8936e3025797352dc3ead1f44936b0b5f2aae30e
Committed by
Fabio Teixeira
1 parent
0ffedd2d
Exists in
master
and in
5 other branches
Save Software info fields, fix plugin controller
-Fix MpogSoftwarePluginMyprofileController actions Signed-off-by: Gabriela Navarro <navarro1703@gmail.com> Signed-off-by: Gustavo Jaruga Cruz <darksshades@gmail.com> Signed-off-by: Rodrigo Medeiros <rodrigo.mss01@gmail.com>
Showing
3 changed files
with
50 additions
and
41 deletions
Show diff stats
controllers/mpog_software_plugin_myprofile_controller.rb
... | ... | @@ -56,7 +56,7 @@ class MpogSoftwarePluginMyprofileController < MyProfileController |
56 | 56 | @errors |= @software_info.errors.full_messages |
57 | 57 | @errors |= @license_info.errors.full_messages |
58 | 58 | # @errors |= @software_categories.errors.full_messages |
59 | - #end | |
59 | + end | |
60 | 60 | end |
61 | 61 | |
62 | 62 | def search_offerers |
... | ... | @@ -66,44 +66,48 @@ class MpogSoftwarePluginMyprofileController < MyProfileController |
66 | 66 | end |
67 | 67 | |
68 | 68 | def edit_software |
69 | - @list_libraries = LibraryHelper.list_libraries(params[:library]) | |
70 | - @list_languages = SoftwareLanguageHelper.list_language(params[:language]) | |
71 | - @list_databases = DatabaseHelper.list_database(params[:database]) | |
72 | - @software_categories = SoftwareCategories::new params[:software_categories] | |
73 | - @list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system]) | |
74 | - | |
75 | - | |
76 | - if not @list_libraries.nil? | |
77 | - @list_libraries.each do |library| | |
78 | - @software_info.libraries << library | |
79 | - end | |
80 | - end | |
81 | - | |
82 | - if not @list_languages.nil? | |
83 | - @list_languages.each do |language| | |
84 | - @software_info.software_languages << language | |
85 | - end | |
86 | - end | |
87 | - | |
88 | - if not @list_databases.nil? | |
89 | - @list_databases.each do |database| | |
90 | - @software_info.software_databases << database | |
91 | - end | |
92 | - end | |
93 | - | |
94 | - if not @list_operating_systems.nil? | |
95 | - @list_operating_systems.each do |operating_system| | |
96 | - @software_info.operating_systems << operating_system | |
97 | - end | |
98 | - end | |
99 | - | |
100 | - valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries) | |
101 | - valid_database = DatabaseHelper.valid_list_database?(@list_databases) | |
102 | - valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages) | |
103 | - valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems) | |
104 | - valid_software_categories = request.post? && @software_categories.valid? | |
105 | 69 | |
70 | + @list_libraries = LibraryHelper.list_libraries(params[:library]) | |
71 | + @list_languages = SoftwareLanguageHelper.list_language(params[:language]) | |
72 | + @list_databases = DatabaseHelper.list_database(params[:database]) | |
73 | + @software_categories = SoftwareCategories::new params[:software_categories] | |
74 | + @list_operating_systems = OperatingSystemHelper.list_operating_system(params[:operating_system]) | |
75 | + | |
76 | + | |
77 | + if not @list_libraries.nil? | |
78 | + @list_libraries.each do |library| | |
79 | + @software_info.libraries << library | |
80 | + end | |
81 | + end | |
82 | + | |
83 | + if not @list_languages.nil? | |
84 | + @list_languages.each do |language| | |
85 | + @software_info.software_languages << language | |
86 | + end | |
87 | + end | |
88 | + | |
89 | + if not @list_databases.nil? | |
90 | + @list_databases.each do |database| | |
91 | + @software_info.software_databases << database | |
92 | + end | |
93 | + end | |
94 | + | |
95 | + if not @list_operating_systems.nil? | |
96 | + @list_operating_systems.each do |operating_system| | |
97 | + @software_info.operating_systems << operating_system | |
98 | + end | |
99 | + end | |
100 | + | |
101 | + valid_libraries = @list_libraries.empty? || LibraryHelper.valid_list_libraries?(@list_libraries) | |
102 | + valid_database = DatabaseHelper.valid_list_database?(@list_databases) | |
103 | + valid_language = SoftwareLanguageHelper.valid_list_language?(@list_languages) | |
104 | + valid_operating_system = OperatingSystemHelper.valid_list_operating_system?(@list_operating_systems) | |
105 | + valid_software_categories = request.post? && @software_categories.valid? | |
106 | + | |
107 | + if request.post? | |
108 | + #@software_info.update_attributes(params[:software]) | |
109 | + #@software_info.save! | |
110 | + end | |
106 | 111 | end |
107 | 112 | |
108 | -end | |
109 | -end | |
113 | +end | |
110 | 114 | \ No newline at end of file | ... | ... |
views/mpog_software_plugin_myprofile/_main_software_editor_extras.html.erb
... | ... | @@ -8,8 +8,8 @@ |
8 | 8 | </div> |
9 | 9 | |
10 | 10 | <h3> <%= _("Finality") %> </h3> |
11 | -<div id="finality"> | |
12 | - <%= text_field_tag(:finality, @profile.software_info.finality) %> | |
11 | +<div id="finality"> | |
12 | + <%= text_field_tag("software[finality]", @profile.software_info.finality) %> | |
13 | 13 | </div> |
14 | 14 | |
15 | 15 | <h3> <%= _("Licenses") %> </h3> | ... | ... |
views/mpog_software_plugin_myprofile/edit_software.html.erb
1 | 1 | <% tabs = [] %> |
2 | 2 | |
3 | +<%= labelled_form_for :mpog_software_plugin_myprofile, :html => { :multipart => true, :id => 'edit-form' } do |f| %> | |
4 | + | |
3 | 5 | <% tabs << {:title => _("Basic"), :id => 'basic-info', |
4 | 6 | :content => (render :partial => 'main_software_editor_extras')} %> |
5 | 7 | |
... | ... | @@ -7,3 +9,6 @@ |
7 | 9 | :content => (render :partial => 'public_software_info')} %> |
8 | 10 | |
9 | 11 | <%= render_tabs(tabs) %> |
12 | + | |
13 | +<%= submit_button(:save, _('Save')) %> | |
14 | +<% end %> | |
10 | 15 | \ No newline at end of file | ... | ... |