Commit 15dc1378fb299307799eb29b7cff73b96aef70e4

Authored by Luciano Prestes
Committed by David Silva
1 parent 30e39dd9
Exists in master and in 79 other branches add_sisp_to_chef, add_super_archives_plugin, api_for_colab, automates_core_packing, backup_not_prod, changes_in_buttons_on_content_panel, colab_automated_login, colab_spb_plugin_recipe, colab_widgets_settings, design_validation, dev_env_minimal, disable_email_dev, fix_breadcrumbs_position, fix_categories_software_link, fix_edit_institution, fix_edit_software_with_another_license, fix_get_license_info, fix_gitlab_assets_permission, fix_list_style_inside_article, fix_list_style_on_folder_elements, fix_members_pagination, fix_merge_request_url, fix_models_translations, fix_no_license, fix_software_api, fix_software_block_migration, fix_software_communities_translations, fix_software_communities_unit_test, fix_style_create_institution_admin_panel, fix_superarchives_imports, fix_sym_links_noosfero, focus_search_field_theme, gov-user-refactoring, gov-user-refactoring-rails4, header_fix, institution_modal_on_rating, kalibro-conf-refactoring, kalibro-processor-package, lxc_settings, margin_fix, mezuro_cookbook, prezento, refactor_download_block, refactor_software_communities, refactor_software_for_sisp, register_page, release-process, release-process-v2, remove-unused-images, remove_broken_theme, remove_secondary_email_from_user, remove_sisp_buttons, removing_super_archives_email, review_message, scope2method, signals_user_noosfero, sisp_catalog_header, sisp_colab_config, sisp_dev, sisp_dev_master, sisp_simple_version, software_as_organization, software_catalog_style_fix, software_communities_html_refactor, software_infos_api, spb_minimal_env, spb_to_rails4, spec_refactor, stable-4.1, stable-4.2, stable-4.x, temp_soft_comm_refactoring, theme_header, theme_javascript_refactory, thread_dropdown, thread_page, update_search_by_categories, update_software_api, update_softwares_boxes

Add another license_info as settings_itens

Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
db/migrate/20150209170529_add_settings_field_to_software_info.rb 0 → 100644
... ... @@ -0,0 +1,9 @@
  1 +class AddSettingsFieldToSoftwareInfo < ActiveRecord::Migration
  2 + def up
  3 + add_column :software_infos, :settings, :text
  4 + end
  5 +
  6 + def down
  7 + remove_column :software_info, :settings
  8 + end
  9 +end
... ...
lib/software_info.rb
1 1 class SoftwareInfo < ActiveRecord::Base
  2 + acts_as_having_settings :field => :setting
  3 +
2 4 SEARCH_FILTERS = []
3 5 SEARCH_DISPLAYS = %w[full]
4 6  
... ... @@ -34,6 +36,8 @@ class SoftwareInfo &lt; ActiveRecord::Base
34 36  
35 37 validate :validate_acronym
36 38  
  39 + settings_items :another_license_version, :another_license_link
  40 +
37 41 # used on find_by_contents
38 42 scope :like_search, lambda{ |name|
39 43 joins(:community).where(
... ... @@ -62,6 +66,25 @@ class SoftwareInfo &lt; ActiveRecord::Base
62 66 }
63 67 }
64 68  
  69 + def license_info
  70 + license = LicenseInfo.find_by_id self.license_info_id
  71 +
  72 + if license == LicenseInfo.find_by_version("Another")
  73 + LicenseInfo.new(
  74 + :version => self.another_license_version,
  75 + :link => self.another_license_link
  76 + )
  77 + else
  78 + license
  79 + end
  80 + end
  81 +
  82 + def another_license(version, link)
  83 + self.another_license_version = version
  84 + self.another_license_link = link
  85 + self.license_info = LicenseInfo.find_by_version("Another")
  86 + end
  87 +
65 88 def validate_name_lenght
66 89 if self.community.name.size > 100
67 90 self.errors.add(
... ...
public/static/licences.txt
... ... @@ -207,3 +207,6 @@ http://opensource.org/licenses/ZPL-2.0
207 207  
208 208 zlib/libpng license (Zlib)
209 209 http://www.openfoundry.org/en/licenses/36-zliblibpng-license-zliblibpng
  210 +
  211 +Another
  212 +#
210 213 \ No newline at end of file
... ...