Commit 2183feb5251fcf18f3a70ebda05f10df89fdc6fa
1 parent
db6b43ef
Exists in
master
and in
5 other branches
Remove unecessary code and fix library edition
Signed-off-by: David Carlos <ddavidcarlos1392@gmail.com>
Showing
2 changed files
with
3 additions
and
36 deletions
Show diff stats
controllers/mpog_software_plugin_myprofile_controller.rb
| ... | ... | @@ -42,7 +42,7 @@ class MpogSoftwarePluginMyprofileController < MyProfileController |
| 42 | 42 | |
| 43 | 43 | return unless request.post? |
| 44 | 44 | @software_info = constroy_software |
| 45 | - software_info_insert_models.call(@list_library, 'libraries') | |
| 45 | + software_info_insert_models.call(@list_libraries, 'libraries') | |
| 46 | 46 | software_info_insert_models.call(@list_languages, 'software_languages') |
| 47 | 47 | software_info_insert_models.call(@list_databases, 'software_databases') |
| 48 | 48 | software_info_insert_models.call(@list_operating_systems, 'operating_systems') | ... | ... |
lib/mpog_software_plugin.rb
| ... | ... | @@ -35,13 +35,8 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 35 | 35 | |
| 36 | 36 | def profile_editor_transaction_extras |
| 37 | 37 | single_hash_transactions = { :user => 'user', |
| 38 | - :software_info => 'software_info', | |
| 39 | - :version => 'license', :language => 'generic_model', | |
| 40 | - :operating_system => 'generic_model', | |
| 41 | - :software_categories => 'software_categories', | |
| 42 | - :instituton => 'instituton', | |
| 43 | - :library => 'generic_model', | |
| 44 | - :database => 'generic_model' } | |
| 38 | + :instituton => 'instituton' | |
| 39 | + } | |
| 45 | 40 | |
| 46 | 41 | single_hash_transactions.each do |model, transaction| |
| 47 | 42 | call_model_transaction(model, transaction) |
| ... | ... | @@ -300,34 +295,6 @@ class MpogSoftwarePlugin < Noosfero::Plugin |
| 300 | 295 | context.profile.institution.save! |
| 301 | 296 | end |
| 302 | 297 | |
| 303 | - def generic_model_transaction | |
| 304 | - models_list = [ | |
| 305 | - [SoftwareLanguage, SoftwareLanguageHelper, 'language'], | |
| 306 | - [SoftwareDatabase, DatabaseHelper, 'database'], | |
| 307 | - [OperatingSystem, OperatingSystemHelper, 'operating_system'], | |
| 308 | - [Library, LibraryHelper, 'library'] | |
| 309 | - ] | |
| 310 | - models_list.each do |model| | |
| 311 | - list_of_model = 'list_'+model[2].to_s | |
| 312 | - model[0].transaction do | |
| 313 | - list = model[1].send(list_of_model, context.params[model[2].to_sym]) | |
| 314 | - | |
| 315 | - if model[2].send('valid_'+list_of_model+'?', list_of_model) | |
| 316 | - model[0].where( | |
| 317 | - :software_info_id => context.profile.software_info.id | |
| 318 | - ).destroy_all | |
| 319 | - | |
| 320 | - list.each do |model| | |
| 321 | - model.software_info = context.profile.software_info | |
| 322 | - model.save! | |
| 323 | - end | |
| 324 | - else | |
| 325 | - raise 'Invalid Software #{model[2]} fields' | |
| 326 | - end | |
| 327 | - end | |
| 328 | - end | |
| 329 | - end | |
| 330 | - | |
| 331 | 298 | def software_info_button |
| 332 | 299 | { |
| 333 | 300 | :title => _('Software Info'), | ... | ... |