Compare View

switch
from
...
to
 
Commits (5)
src/noosfero-spb/software_communities/db/migrate/20140528193902_create_license_infos_table.rb
@@ -4,6 +4,9 @@ class CreateLicenseInfosTable < ActiveRecord::Migration @@ -4,6 +4,9 @@ class CreateLicenseInfosTable < ActiveRecord::Migration
4 t.string :version 4 t.string :version
5 t.string :link 5 t.string :link
6 end 6 end
  7 +
  8 + link = "http://creativecommons.org/licenses/GPL/2.0/legalcode.pt"
  9 + execute("INSERT INTO license_infos (version, link) VALUES ('CC-GPL-V2', '#{link}')")
7 end 10 end
8 11
9 def self.down 12 def self.down
src/noosfero-spb/software_communities/db/migrate/20140528193956_create_programming_languages_table.rb
@@ -3,6 +3,13 @@ class CreateProgrammingLanguagesTable < ActiveRecord::Migration @@ -3,6 +3,13 @@ class CreateProgrammingLanguagesTable < ActiveRecord::Migration
3 create_table :programming_languages do |t| 3 create_table :programming_languages do |t|
4 t.string :name 4 t.string :name
5 end 5 end
  6 +
  7 + file_name = "plugins/software_communities/public/static/languages.txt"
  8 + list_file = File.open file_name, "r"
  9 + list_file.each_line do |line|
  10 + execute("INSERT INTO programming_languages (name) VALUES ('#{line.strip}')")
  11 + end
  12 + list_file.close
6 end 13 end
7 14
8 def self.down 15 def self.down
src/noosfero-spb/software_communities/db/migrate/20140528194044_create_database_descriptions_table.rb
@@ -3,6 +3,13 @@ class CreateDatabaseDescriptionsTable < ActiveRecord::Migration @@ -3,6 +3,13 @@ class CreateDatabaseDescriptionsTable < ActiveRecord::Migration
3 create_table :database_descriptions do |t| 3 create_table :database_descriptions do |t|
4 t.string :name 4 t.string :name
5 end 5 end
  6 +
  7 + file_name = "plugins/software_communities/public/static/databases.txt"
  8 + list_file = File.open file_name, "r"
  9 + list_file.each_line do |line|
  10 + execute("INSERT INTO database_descriptions (name) VALUES ('#{line.strip}')")
  11 + end
  12 + list_file.close
6 end 13 end
7 14
8 def self.down 15 def self.down
src/noosfero-spb/software_communities/db/migrate/20140714133901_create_operating_name_table.rb
@@ -3,6 +3,13 @@ class CreateOperatingNameTable < ActiveRecord::Migration @@ -3,6 +3,13 @@ class CreateOperatingNameTable < ActiveRecord::Migration
3 create_table :operating_system_names do |t| 3 create_table :operating_system_names do |t|
4 t.string :name 4 t.string :name
5 end 5 end
  6 +
  7 + file_name = "plugins/software_communities/public/static/operating_systems.txt"
  8 + list_file = File.open file_name, "r"
  9 + list_file.each_line do |line|
  10 + execute("INSERT INTO operating_system_names (name) VALUES ('#{line.strip}')")
  11 + end
  12 + list_file.close
6 end 13 end
7 14
8 def down 15 def down
src/noosfero-spb/software_communities/db/migrate/20151124192503_update_namespace_types.rb
@@ -3,7 +3,7 @@ class UpdateNamespaceTypes < ActiveRecord::Migration @@ -3,7 +3,7 @@ class UpdateNamespaceTypes < ActiveRecord::Migration
3 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock' WHERE type = 'SoftwareHighlightsBlock'") 3 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock' WHERE type = 'SoftwareHighlightsBlock'")
4 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock' WHERE type = 'SearchCatalogBlock'") 4 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock' WHERE type = 'SearchCatalogBlock'")
5 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::DownloadBlock' WHERE type = 'DownloadBlock'") 5 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::DownloadBlock' WHERE type = 'DownloadBlock'")
6 - execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::StatisticsBlock' WHERE type = 'StatisticsBlock'") 6 + execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::StatisticBlock' WHERE type = 'StatisticBlock'")
7 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::RepositoryBlock' WHERE type = 'RepositoryBlock'") 7 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::RepositoryBlock' WHERE type = 'RepositoryBlock'")
8 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock' WHERE type = 'SoftwareTabDataBlock'") 8 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock' WHERE type = 'SoftwareTabDataBlock'")
9 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwaresBlock' WHERE type = 'SoftwaresBlock'") 9 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwaresBlock' WHERE type = 'SoftwaresBlock'")
@@ -18,7 +18,7 @@ class UpdateNamespaceTypes < ActiveRecord::Migration @@ -18,7 +18,7 @@ class UpdateNamespaceTypes < ActiveRecord::Migration
18 execute("UPDATE blocks SET type = 'SoftwareHighlightsBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock'") 18 execute("UPDATE blocks SET type = 'SoftwareHighlightsBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock'")
19 execute("UPDATE blocks SET type = 'SearchCatalogBlock' WHERE type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock'") 19 execute("UPDATE blocks SET type = 'SearchCatalogBlock' WHERE type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock'")
20 execute("UPDATE blocks SET type = 'DownloadBlock' WHERE type = 'SoftwareCommunitiesPlugin::DownloadBlock'") 20 execute("UPDATE blocks SET type = 'DownloadBlock' WHERE type = 'SoftwareCommunitiesPlugin::DownloadBlock'")
21 - execute("UPDATE blocks SET type = 'StatisticsBlock' WHERE type = 'SoftwareCommunitiesPlugin::StatisticsBlock'") 21 + execute("UPDATE blocks SET type = 'StatisticBlock' WHERE type = 'SoftwareCommunitiesPlugin::StatisticBlock'")
22 execute("UPDATE blocks SET type = 'RepositoryBlock' WHERE type = 'SoftwareCommunitiesPlugin::RepositoryBlock'") 22 execute("UPDATE blocks SET type = 'RepositoryBlock' WHERE type = 'SoftwareCommunitiesPlugin::RepositoryBlock'")
23 execute("UPDATE blocks SET type = 'SoftwareTabDataBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock'") 23 execute("UPDATE blocks SET type = 'SoftwareTabDataBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock'")
24 execute("UPDATE blocks SET type = 'SoftwaresBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwaresBlock'") 24 execute("UPDATE blocks SET type = 'SoftwaresBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwaresBlock'")
src/noosfero-spb/software_communities/db/migrate/20160104170028_changing_software_statistics_from_block_to_software_info.rb
@@ -12,13 +12,13 @@ class ChangingSoftwareStatisticsFromBlockToSoftwareInfo < ActiveRecord::Migratio @@ -12,13 +12,13 @@ class ChangingSoftwareStatisticsFromBlockToSoftwareInfo < ActiveRecord::Migratio
12 benefited_people += organization_rating["people_benefited"].to_i 12 benefited_people += organization_rating["people_benefited"].to_i
13 saved_resources += organization_rating["saved_value"].to_f 13 saved_resources += organization_rating["saved_value"].to_f
14 end 14 end
15 - execute("UPDATE software_infos SET benefited_people=#{benefited_people}, saved_resources=#{saved_resources} WHERE id=#{software['id']}") 15 + execute("UPDATE software_communities_plugin_software_infos SET benefited_people=#{benefited_people}, saved_resources=#{saved_resources} WHERE id=#{software['id']}")
16 end 16 end
17 end 17 end
18 18
19 end 19 end
20 20
21 def down 21 def down
22 - execute("UPDATE software_infos SET benefited_people=0,saved_resources=0") 22 + execute("UPDATE software_communities_plugin_software_infos SET benefited_people=0,saved_resources=0")
23 end 23 end
24 end 24 end
src/noosfero-spb/software_communities/lib/ext/community.rb
@@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
1 -require_dependency 'community'  
2 -  
3 -class Community  
4 -  
5 - SEARCHABLE_SOFTWARE_FIELDS = {  
6 - :name => 1,  
7 - :identifier => 2,  
8 - :nickname => 3  
9 - }  
10 -  
11 - attr_accessible :visible  
12 -  
13 - has_one :software_info, :dependent=>:destroy, :class_name => "SoftwareCommunitiesPlugin::SoftwareInfo"  
14 -  
15 - settings_items :hits, :type => :integer, :default => 0  
16 -  
17 - def self.create_after_moderation(requestor, attributes = {})  
18 - community = Community.new(attributes)  
19 -  
20 - if community.environment.enabled?('admin_must_approve_new_communities') &&  
21 - !community.is_admin?(requestor)  
22 -  
23 - cc = CreateCommunity.create(attributes.merge(:requestor => requestor))  
24 - else  
25 - community = Community.create(attributes)  
26 - community.add_admin(requestor)  
27 - end  
28 - community  
29 - end  
30 -  
31 - def self.get_valid_communities_string  
32 - remove_of_communities_methods = Community.instance_methods.select{|m| m =~ /remove_of_community_search/}  
33 - valid_communities_string = "!("  
34 - remove_of_communities_methods.each do |method|  
35 - valid_communities_string += "community.send('#{method}') || "  
36 - end  
37 - valid_communities_string = valid_communities_string[0..-5]  
38 - valid_communities_string += ")"  
39 -  
40 - valid_communities_string  
41 - end  
42 -  
43 - def software?  
44 - return !software_info.nil?  
45 - end  
46 -  
47 - def deactivate  
48 - self.visible = false  
49 - self.save!  
50 - end  
51 -  
52 - def activate  
53 - self.visible = true  
54 - self.save!  
55 - end  
56 -  
57 - def remove_of_community_search_software?  
58 - return software?  
59 - end  
60 -  
61 - def hit  
62 - self.hits += 1  
63 - self.save!  
64 - end  
65 -  
66 -end  
src/noosfero-spb/software_communities/lib/software_communities_plugin/software.rb 0 → 100644
@@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
  1 +class SoftwareCommunitiesPlugin::Software < Organization
  2 +
  3 + SEARCHABLE_SOFTWARE_FIELDS = {
  4 + :name => 1,
  5 + :identifier => 2,
  6 + :nickname => 3
  7 + }
  8 +
  9 + attr_accessible :visible
  10 +
  11 + has_one :software_info, :dependent=>:destroy, :class_name => "SoftwareCommunitiesPlugin::SoftwareInfo"
  12 +
  13 + settings_items :hits, :type => :integer, :default => 0
  14 +
  15 + def self.create_after_moderation(requestor, attributes = {})
  16 + community = SoftwareCommunitiesPlugin::Software.new(attributes)
  17 +
  18 + if community.environment.enabled?('admin_must_approve_new_communities') &&
  19 + !community.is_admin?(requestor)
  20 +
  21 + cc = SoftwareCommunitiesPlugin::CreateSoftware.create(attributes.merge(:requestor => requestor))
  22 + else
  23 + community = SoftwareCommunitiesPlugin::Software.create(attributes)
  24 + community.add_admin(requestor)
  25 + end
  26 + community
  27 + end
  28 +
  29 + def self.get_valid_communities_string
  30 + remove_of_communities_methods = SoftwareCommunitiesPlugin::Software.instance_methods.select{|m| m =~ /remove_of_community_search/}
  31 + valid_communities_string = "!("
  32 + remove_of_communities_methods.each do |method|
  33 + valid_communities_string += "community.send('#{method}') || "
  34 + end
  35 + valid_communities_string = valid_communities_string[0..-5]
  36 + valid_communities_string += ")"
  37 +
  38 + valid_communities_string
  39 + end
  40 +
  41 + def software?
  42 + return !software_info.nil?
  43 + end
  44 +
  45 + def deactivate
  46 + self.visible = false
  47 + self.save!
  48 + end
  49 +
  50 + def activate
  51 + self.visible = true
  52 + self.save!
  53 + end
  54 +
  55 + def remove_of_community_search_software?
  56 + return software?
  57 + end
  58 +
  59 + def hit
  60 + self.hits += 1
  61 + self.save!
  62 + end
  63 +
  64 +end
src/noosfero-spb/software_communities/lib/software_communities_plugin/statistic_block.rb
@@ -54,7 +54,7 @@ class SoftwareCommunitiesPlugin::StatisticBlock &lt; Block @@ -54,7 +54,7 @@ class SoftwareCommunitiesPlugin::StatisticBlock &lt; Block
54 54
55 def get_software_statistics 55 def get_software_statistics
56 statistics = {} 56 statistics = {}
57 - software = SoftwareInfo.find_by_community_id(self.owner.id) 57 + software = SoftwareCommunitiesPlugin::SoftwareInfo.find_by_community_id(self.owner.id)
58 if software.present? 58 if software.present?
59 statistics[:saved_resources] = software.saved_resources 59 statistics[:saved_resources] = software.saved_resources
60 statistics[:benefited_people] = software.benefited_people 60 statistics[:benefited_people] = software.benefited_people
src/noosfero-spb/software_communities/views/blocks/software_communities_plugin/software_highlights.html.erb 0 → 100644
@@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
  1 +<%= render :file => 'blocks/highlights.html.erb', :locals => { :block => block } %>
  2 +
  3 +<!-- popover html structure -->
  4 +<!-- <a> link to fire popover -->
  5 +<a class="toggle-popover">mais informações</a>
  6 +<!-- <span> to handle popover options -->
  7 +<span class="popover-span" data-toggle="popover" data-placement="top" data-class="highlights-popover">?</span>
  8 +<!-- <div> with html content of popover
  9 + MUST APPEAR AFTER THE SPAN -->
  10 +<div class="popover-content" style="display: none">
  11 + <div class="inner-content">
  12 + <p>Este software foi desenvolvido com recursos públicos, gerenciado por uma instituição
  13 + governamental. Sua inclusão neste portal atende aos requisitos do
  14 + <a href="https://softwarepublico.gov.br/social/articles/0000/3365/in_spb_01.pdf">art. 14 da IN 01/2011</a>.
  15 + </p>
  16 + </div>
  17 + <div class="see-all">
  18 + <%= link_to _('See all'), {:controller => :search, :action => :software_infos, :only_softwares => softwares} %>
  19 + </div>
  20 +</div>
src/noosfero-spb/spb_migrations/db/migrate/20160104182236_remove_softwares_with_nil_community.rb
1 class RemoveSoftwaresWithNilCommunity < ActiveRecord::Migration 1 class RemoveSoftwaresWithNilCommunity < ActiveRecord::Migration
2 def up 2 def up
3 - execute('DELETE FROM software_infos where community_id IS NULL;') 3 + execute('DELETE FROM software_communities_plugin_software_infos where community_id IS NULL;')
4 end 4 end
5 5
6 def down 6 def down