Commit 15dc1378fb299307799eb29b7cff73b96aef70e4
Committed by
David Silva
1 parent
30e39dd9
Exists in
master
and in
5 other branches
Add another license_info as settings_itens
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com> Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Showing
3 changed files
with
35 additions
and
0 deletions
Show diff stats
db/migrate/20150209170529_add_settings_field_to_software_info.rb
0 → 100644
lib/software_info.rb
1 | class SoftwareInfo < ActiveRecord::Base | 1 | class SoftwareInfo < ActiveRecord::Base |
2 | + acts_as_having_settings :field => :setting | ||
3 | + | ||
2 | SEARCH_FILTERS = [] | 4 | SEARCH_FILTERS = [] |
3 | SEARCH_DISPLAYS = %w[full] | 5 | SEARCH_DISPLAYS = %w[full] |
4 | 6 | ||
@@ -34,6 +36,8 @@ class SoftwareInfo < ActiveRecord::Base | @@ -34,6 +36,8 @@ class SoftwareInfo < ActiveRecord::Base | ||
34 | 36 | ||
35 | validate :validate_acronym | 37 | validate :validate_acronym |
36 | 38 | ||
39 | + settings_items :another_license_version, :another_license_link | ||
40 | + | ||
37 | # used on find_by_contents | 41 | # used on find_by_contents |
38 | scope :like_search, lambda{ |name| | 42 | scope :like_search, lambda{ |name| |
39 | joins(:community).where( | 43 | joins(:community).where( |
@@ -62,6 +66,25 @@ class SoftwareInfo < ActiveRecord::Base | @@ -62,6 +66,25 @@ class SoftwareInfo < 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 | def validate_name_lenght | 88 | def validate_name_lenght |
66 | if self.community.name.size > 100 | 89 | if self.community.name.size > 100 |
67 | self.errors.add( | 90 | self.errors.add( |
public/static/licences.txt
@@ -207,3 +207,6 @@ http://opensource.org/licenses/ZPL-2.0 | @@ -207,3 +207,6 @@ http://opensource.org/licenses/ZPL-2.0 | ||
207 | 207 | ||
208 | zlib/libpng license (Zlib) | 208 | zlib/libpng license (Zlib) |
209 | http://www.openfoundry.org/en/licenses/36-zliblibpng-license-zliblibpng | 209 | http://www.openfoundry.org/en/licenses/36-zliblibpng-license-zliblibpng |
210 | + | ||
211 | +Another | ||
212 | +# | ||
210 | \ No newline at end of file | 213 | \ No newline at end of file |