Commit 79f2972ae1b82dda9344e40c75c4b99a8ec3c0da
1 parent
bd6ecd61
Exists in
software_as_organization
overall adjusts on lib files
Showing
8 changed files
with
44 additions
and
44 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/create_software.rb
@@ -18,7 +18,7 @@ class CreateSoftware < Task | @@ -18,7 +18,7 @@ class CreateSoftware < Task | ||
18 | end | 18 | end |
19 | 19 | ||
20 | def perform | 20 | def perform |
21 | - software_template = Community["software"] | 21 | + software_template = Software["software-template"] |
22 | if (!software_template.blank? && software_template.is_template) | 22 | if (!software_template.blank? && software_template.is_template) |
23 | template_id = software_template.id | 23 | template_id = software_template.id |
24 | end | 24 | end |
@@ -116,7 +116,7 @@ class CreateSoftware < Task | @@ -116,7 +116,7 @@ class CreateSoftware < Task | ||
116 | private | 116 | private |
117 | 117 | ||
118 | def mount_url | 118 | def mount_url |
119 | - identifier = Community.where(:name => self.name).first.identifier | 119 | + identifier = Software.where(:name => self.name).first.identifier |
120 | # The use of url_for doesn't allow the /social within the Public Software | 120 | # The use of url_for doesn't allow the /social within the Public Software |
121 | # portal. That's why the url is mounted so 'hard coded' | 121 | # portal. That's why the url is mounted so 'hard coded' |
122 | url = "#{environment.top_url}/myprofile/#{identifier}/profile_editor/edit_software_community" | 122 | url = "#{environment.top_url}/myprofile/#{identifier}/profile_editor/edit_software_community" |
src/noosfero-spb/software_communities/lib/software_communities_plugin.rb
@@ -38,17 +38,17 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | @@ -38,17 +38,17 @@ class SoftwareCommunitiesPlugin < Noosfero::Plugin | ||
38 | def self.extra_blocks | 38 | def self.extra_blocks |
39 | { | 39 | { |
40 | SoftwaresBlock => { :type => [Environment, Person] }, | 40 | SoftwaresBlock => { :type => [Environment, Person] }, |
41 | - SoftwareInformationBlock => { :type => [Community] }, | ||
42 | - DownloadBlock => { :type => [Community] }, | ||
43 | - RepositoryBlock => { :type => [Community] }, | ||
44 | - CategoriesAndTagsBlock => { :type => [Community] }, | 41 | + SoftwareInformationBlock => { :type => [Software] }, |
42 | + DownloadBlock => { :type => [Software] }, | ||
43 | + RepositoryBlock => { :type => [Software] }, | ||
44 | + CategoriesAndTagsBlock => { :type => [Software] }, | ||
45 | CategoriesSoftwareBlock => { :type => [Environment] }, | 45 | CategoriesSoftwareBlock => { :type => [Environment] }, |
46 | SearchCatalogBlock => { :type => [Environment] }, | 46 | SearchCatalogBlock => { :type => [Environment] }, |
47 | SoftwareHighlightsBlock => { :type => [Environment] }, | 47 | SoftwareHighlightsBlock => { :type => [Environment] }, |
48 | - SoftwareTabDataBlock => {:type => [Community], :position => 1}, | ||
49 | - WikiBlock => {:type => [Community]}, | ||
50 | - StatisticBlock => { :type => [Community] }, | ||
51 | - SoftwareEventsBlock => { :type => [Community] } | 48 | + SoftwareTabDataBlock => {:type => [Software], :position => 1}, |
49 | + WikiBlock => {:type => [Software]}, | ||
50 | + StatisticBlock => { :type => [Software] }, | ||
51 | + SoftwareEventsBlock => { :type => [Software] } | ||
52 | } | 52 | } |
53 | end | 53 | end |
54 | 54 |
src/noosfero-spb/software_communities/lib/software_communities_plugin/api.rb
@@ -8,7 +8,7 @@ class SoftwareCommunitiesPlugin::API < Grape::API | @@ -8,7 +8,7 @@ class SoftwareCommunitiesPlugin::API < Grape::API | ||
8 | resource :software_communities do | 8 | resource :software_communities do |
9 | get do | 9 | get do |
10 | authenticate! | 10 | authenticate! |
11 | - softwares = select_filtered_collection_of(environment,'communities',params).joins(:software_info) | 11 | + softwares = select_filtered_collection_of(environment,'softwares',params).joins(:software_info) |
12 | present softwares.map{|o|o.software_info}, :with => Entities::SoftwareInfo | 12 | present softwares.map{|o|o.software_info}, :with => Entities::SoftwareInfo |
13 | end | 13 | end |
14 | 14 |
src/noosfero-spb/software_communities/lib/software_highlights_block.rb
@@ -7,7 +7,7 @@ class SoftwareHighlightsBlock < HighlightsBlock | @@ -7,7 +7,7 @@ class SoftwareHighlightsBlock < HighlightsBlock | ||
7 | def help | 7 | def help |
8 | _('This block displays the softwares icon into a highlight') | 8 | _('This block displays the softwares icon into a highlight') |
9 | end | 9 | end |
10 | - | 10 | + |
11 | def content(args={}) | 11 | def content(args={}) |
12 | softwares = self.settings[:images].collect {|h| h[:address].split('/').last} | 12 | softwares = self.settings[:images].collect {|h| h[:address].split('/').last} |
13 | block = self | 13 | block = self |
src/noosfero-spb/software_communities/lib/softwares_block.rb
src/noosfero-spb/software_communities/lib/tasks/create_sample_softwares.rake
@@ -44,23 +44,23 @@ namespace :software do | @@ -44,23 +44,23 @@ namespace :software do | ||
44 | end | 44 | end |
45 | end | 45 | end |
46 | 46 | ||
47 | -def create_community(name) | ||
48 | - community = Community.new | ||
49 | - community.name = name | ||
50 | - community.save | ||
51 | - community | 47 | +def create_software(name) |
48 | + software = Software.new | ||
49 | + software.name = name | ||
50 | + software.save | ||
51 | + software | ||
52 | end | 52 | end |
53 | 53 | ||
54 | def create_software_info(name, acronym = "", finality = "default") | 54 | def create_software_info(name, acronym = "", finality = "default") |
55 | - community = create_community(name) | 55 | + community = create_software(name) |
56 | software_info = SoftwareInfo.new | 56 | software_info = SoftwareInfo.new |
57 | - software_info.community = community | 57 | + software_info.software = software |
58 | software_info.public_software = true | 58 | software_info.public_software = true |
59 | software_info.acronym = acronym | 59 | software_info.acronym = acronym |
60 | software_info.finality = finality | 60 | software_info.finality = finality |
61 | software_info.license_info = LicenseInfo.first | 61 | software_info.license_info = LicenseInfo.first |
62 | 62 | ||
63 | - if software_info.community.valid? && software_info.valid? | 63 | + if software_info.softare.valid? && software_info.valid? |
64 | print "." | 64 | print "." |
65 | software_info.save | 65 | software_info.save |
66 | software_info | 66 | software_info |
src/noosfero-spb/software_communities/lib/tasks/export.rake
@@ -37,24 +37,24 @@ namespace :export do | @@ -37,24 +37,24 @@ namespace :export do | ||
37 | "home_page_published_at" | 37 | "home_page_published_at" |
38 | ] | 38 | ] |
39 | 39 | ||
40 | - SoftwareInfo.all.each do |software| | ||
41 | - if software.community | 40 | + SoftwareInfo.all.each do |software_info| |
41 | + if software_info.software | ||
42 | begin | 42 | begin |
43 | csv << [ | 43 | csv << [ |
44 | - software.id, | ||
45 | - software.community.id, | ||
46 | - software.community.identifier, | ||
47 | - software.community.name, | ||
48 | - software.finality, | ||
49 | - software.acronym, | ||
50 | - software.community.created_at, | ||
51 | - (software.community.image.nil? ? nil : software.community.image.filename), | ||
52 | - (software.community.home_page.nil? ? nil : software.community.home_page.name), | ||
53 | - (software.community.home_page.nil? ? nil : software.community.home_page.slug), | ||
54 | - (software.community.home_page.nil? ? nil : software.community.home_page.path), | ||
55 | - (software.community.home_page.nil? ? nil : software.community.home_page.body), | ||
56 | - (software.community.home_page.nil? ? nil : software.community.home_page.abstract), | ||
57 | - (software.community.home_page.nil? ? nil : software.community.home_page.published_at), | 44 | + software_info.id, |
45 | + software_info.software.id, | ||
46 | + software_info.software.identifier, | ||
47 | + software_info.software.name, | ||
48 | + software_info.finality, | ||
49 | + software_info.acronym, | ||
50 | + software_info.software.created_at, | ||
51 | + (software_info.software.image.nil? ? nil : software_info.software.image.filename), | ||
52 | + (software_info.software.home_page.nil? ? nil : software_info.software.home_page.name), | ||
53 | + (software_info.software.home_page.nil? ? nil : software_info.software.home_page.slug), | ||
54 | + (software_info.software.home_page.nil? ? nil : software_info.software.home_page.path), | ||
55 | + (software_info.software.home_page.nil? ? nil : software_info.software.home_page.body), | ||
56 | + (software_info.software.home_page.nil? ? nil : software_info.software.home_page.abstract), | ||
57 | + (software_info.software.home_page.nil? ? nil : software_info.software.home_page.published_at), | ||
58 | ] | 58 | ] |
59 | 59 | ||
60 | print '.' | 60 | print '.' |
@@ -104,12 +104,12 @@ namespace :export do | @@ -104,12 +104,12 @@ namespace :export do | ||
104 | "category_id" | 104 | "category_id" |
105 | ] | 105 | ] |
106 | 106 | ||
107 | - SoftwareInfo.all.each do |software| | ||
108 | - if software.community | ||
109 | - software.community.categories.each do |category| | 107 | + SoftwareInfo.all.each do |software_info| |
108 | + if software_info.software | ||
109 | + software_info.software.categories.each do |category| | ||
110 | begin | 110 | begin |
111 | csv << [ | 111 | csv << [ |
112 | - software.id, | 112 | + software_info.id, |
113 | category.id | 113 | category.id |
114 | ] | 114 | ] |
115 | 115 |
src/noosfero-spb/software_communities/lib/tasks/templates.rake
@@ -13,10 +13,10 @@ namespace :templates do | @@ -13,10 +13,10 @@ namespace :templates do | ||
13 | task :software => :environment do | 13 | task :software => :environment do |
14 | Environment.all.each do |env| | 14 | Environment.all.each do |env| |
15 | if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("SoftwareCommunitiesPlugin") | 15 | if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("SoftwareCommunitiesPlugin") |
16 | - software = Community["software"] | 16 | + software = Software["software_template"] |
17 | 17 | ||
18 | if software.nil? | 18 | if software.nil? |
19 | - software = Community.create!(:name => "Software", :identifier => "software") | 19 | + software = Software.new(:name => "Software Template", :identifier => "software-template") |
20 | end | 20 | end |
21 | 21 | ||
22 | software.layout_template = "default" | 22 | software.layout_template = "default" |
@@ -33,7 +33,7 @@ namespace :templates do | @@ -33,7 +33,7 @@ namespace :templates do | ||
33 | task :destroy => :environment do | 33 | task :destroy => :environment do |
34 | Environment.all.each do |env| | 34 | Environment.all.each do |env| |
35 | if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("SoftwareCommunitiesPlugin") | 35 | if env.plugin_enabled?("MpogSoftware") or env.plugin_enabled?("SoftwareCommunitiesPlugin") |
36 | - Community["software"].destroy unless Community["software"].nil? | 36 | + Software["software-template"].destroy unless Software["software-template"].nil? |
37 | puts "Software template destoyed with success!" | 37 | puts "Software template destoyed with success!" |
38 | end | 38 | end |
39 | end | 39 | end |