diff --git a/db/migrate/20150209170529_add_settings_field_to_software_info.rb b/db/migrate/20150209170529_add_settings_field_to_software_info.rb new file mode 100644 index 0000000..c75c536 --- /dev/null +++ b/db/migrate/20150209170529_add_settings_field_to_software_info.rb @@ -0,0 +1,9 @@ +class AddSettingsFieldToSoftwareInfo < ActiveRecord::Migration + def up + add_column :software_infos, :settings, :text + end + + def down + remove_column :software_info, :settings + end +end diff --git a/lib/software_info.rb b/lib/software_info.rb index b810629..b4a69f3 100644 --- a/lib/software_info.rb +++ b/lib/software_info.rb @@ -1,4 +1,6 @@ class SoftwareInfo < ActiveRecord::Base + acts_as_having_settings :field => :setting + SEARCH_FILTERS = [] SEARCH_DISPLAYS = %w[full] @@ -34,6 +36,8 @@ class SoftwareInfo < ActiveRecord::Base validate :validate_acronym + settings_items :another_license_version, :another_license_link + # used on find_by_contents scope :like_search, lambda{ |name| joins(:community).where( @@ -62,6 +66,25 @@ class SoftwareInfo < ActiveRecord::Base } } + def license_info + license = LicenseInfo.find_by_id self.license_info_id + + if license == LicenseInfo.find_by_version("Another") + LicenseInfo.new( + :version => self.another_license_version, + :link => self.another_license_link + ) + else + license + end + end + + def another_license(version, link) + self.another_license_version = version + self.another_license_link = link + self.license_info = LicenseInfo.find_by_version("Another") + end + def validate_name_lenght if self.community.name.size > 100 self.errors.add( diff --git a/public/static/licences.txt b/public/static/licences.txt index ca1d5b0..14e83c2 100644 --- a/public/static/licences.txt +++ b/public/static/licences.txt @@ -207,3 +207,6 @@ http://opensource.org/licenses/ZPL-2.0 zlib/libpng license (Zlib) http://www.openfoundry.org/en/licenses/36-zliblibpng-license-zliblibpng + +Another +# \ No newline at end of file -- libgit2 0.21.2