Commit d5187ff597356d24fcc4570aa421da506c59ab12
1 parent
e1db85b6
Exists in
refactor_software_info_to_software
and in
1 other branch
Refactor software_communities.
Signed-off-by: Thiago Ribeiro <thiagitosouza@gmail.com> Signed-off-by: Marcos Ronaldo <marcos.rpj2@gmail.com>
Showing
5 changed files
with
29 additions
and
3 deletions
Show diff stats
src/noosfero-spb/software_communities/controllers/software_communities_plugin_myprofile_controller.rb
... | ... | @@ -20,7 +20,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
20 | 20 | @software_info.license_info = @license_info |
21 | 21 | |
22 | 22 | control_software_creation |
23 | - update_new_software_errors | |
23 | + update_software_highlight_errors | |
24 | 24 | end |
25 | 25 | |
26 | 26 | def edit_software |
... | ... | @@ -204,6 +204,7 @@ class SoftwareCommunitiesPluginMyprofileController < MyProfileController |
204 | 204 | add_software_erros |
205 | 205 | end |
206 | 206 | |
207 | + def update_software_highlight_errors | |
207 | 208 | @error_community_name = @community.errors.include?(:name) ? "highlight-error" : "" if @community |
208 | 209 | @error_software_acronym = @software_info.errors.include?(:acronym) ? "highlight-error" : "" if @software_info |
209 | 210 | @error_software_domain = @community.errors.include?(:identifier) ? "highlight-error" : "" if @community | ... | ... |
src/noosfero-spb/software_communities/lib/license_helper.rb
1 | 1 | module LicenseHelper |
2 | 2 | def self.find_licenses query |
3 | 3 | licenses = LicenseInfo.where("version ILIKE ?", "%#{query}%").select("id, version") |
4 | - licenses = licenses.reject{|license| license.version == "Another"} | |
4 | + licenses.reject!{|license| license.version == "Another"} | |
5 | 5 | license_another = LicenseInfo.find_by_version("Another") |
6 | 6 | licenses << license_another if license_another |
7 | 7 | licenses | ... | ... |
src/noosfero-spb/software_communities/lib/software_communities_plugin.rb
... | ... | @@ -131,7 +131,6 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin |
131 | 131 | is_admin = user.is_admin? || user_rating.organization.is_admin?(user) |
132 | 132 | |
133 | 133 | if is_admin and profile.software? |
134 | - | |
135 | 134 | render :file => 'organization_ratings_task_extra_fields_show_statistics', |
136 | 135 | :locals => {:user_rating => user_rating} |
137 | 136 | end | ... | ... |
src/noosfero-spb/software_communities/lib/software_info.rb
... | ... | @@ -181,16 +181,24 @@ class SoftwareInfo < ActiveRecord::Base |
181 | 181 | another_license_link = attributes.delete(:another_license_link) |
182 | 182 | |
183 | 183 | software_info = SoftwareInfo.new(attributes) |
184 | +<<<<<<< HEAD | |
184 | 185 | if !requestor.is_admin? |
186 | +======= | |
187 | + unless environment.admins.include? requestor | |
188 | +>>>>>>> Refactor software_communities. | |
185 | 189 | CreateSoftware.create!( |
186 | 190 | attributes.merge( |
187 | 191 | :requestor => requestor, |
188 | 192 | :environment => environment, |
189 | 193 | :name => name, |
190 | 194 | :identifier => identifier, |
195 | +<<<<<<< HEAD | |
191 | 196 | :license_info => license_info, |
192 | 197 | :another_license_version => another_license_version, |
193 | 198 | :another_license_link => another_license_link |
199 | +======= | |
200 | + :license_info => license_info | |
201 | +>>>>>>> Refactor software_communities. | |
194 | 202 | ) |
195 | 203 | ) |
196 | 204 | else |
... | ... | @@ -212,10 +220,18 @@ class SoftwareInfo < ActiveRecord::Base |
212 | 220 | |
213 | 221 | software_info.community = community |
214 | 222 | software_info.license_info = license_info |
223 | +<<<<<<< HEAD | |
215 | 224 | software_info.verify_license_info(another_license_version, another_license_link) |
216 | 225 | software_info.save! |
217 | 226 | end |
218 | 227 | |
228 | +======= | |
229 | + software_info.save! | |
230 | + end | |
231 | + | |
232 | + software_info.verify_license_info(another_license_version, another_license_link) | |
233 | + software_info.save | |
234 | +>>>>>>> Refactor software_communities. | |
219 | 235 | software_info |
220 | 236 | end |
221 | 237 | ... | ... |
src/noosfero-spb/software_communities/test/unit/software_info_validation_test.rb
... | ... | @@ -55,6 +55,16 @@ class SoftwareInfoValidationTest < ActiveSupport::TestCase |
55 | 55 | @software_info.community = @community |
56 | 56 | end |
57 | 57 | |
58 | + def teardown | |
59 | + ProgrammingLanguage.destroy_all | |
60 | + SoftwareLanguage.destroy_all | |
61 | + DatabaseDescription.destroy_all | |
62 | + SoftwareDatabase.destroy_all | |
63 | + OperatingSystem.destroy_all | |
64 | + OperatingSystemName.destroy_all | |
65 | + SoftwareInfo.destroy_all | |
66 | + end | |
67 | + | |
58 | 68 | should 'Save SoftwareInfo if all fields are filled' do |
59 | 69 | assert_equal true, @software_info.save |
60 | 70 | end | ... | ... |