diff --git a/app/controllers/application.rb b/app/controllers/application.rb index 981b8ea..d56a750 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base helper :document - design :holder => 'virtual_community' + design :holder => 'environment' # Be sure to include AuthenticationSystem in Application Controller instead include AuthenticatedSystem @@ -12,7 +12,7 @@ class ApplicationController < ActionController::Base init_gettext 'noosfero' before_filter :detect_stuff_by_domain - attr_reader :virtual_community + attr_reader :environment protected @@ -20,9 +20,9 @@ class ApplicationController < ActionController::Base def detect_stuff_by_domain @domain = Domain.find_by_name(request.host) if @domain.nil? - @virtual_community = VirtualCommunity.default + @environment = Environment.default else - @virtual_community = @domain.virtual_community + @environment = @domain.environment @profile = @domain.profile end end @@ -38,7 +38,7 @@ class ApplicationController < ActionController::Base @profile end - def self.acts_as_virtual_community_admin_controller + def self.acts_as_environment_admin_controller before_filter :load_admin_controller end def load_admin_controller diff --git a/app/controllers/environment_admin/edit_template_controller.rb b/app/controllers/environment_admin/edit_template_controller.rb index 2bc233b..33a5c29 100644 --- a/app/controllers/environment_admin/edit_template_controller.rb +++ b/app/controllers/environment_admin/edit_template_controller.rb @@ -1,6 +1,6 @@ class EditTemplateController < EnvironmentAdminController - design_editor :holder => 'virtual_community', :autosave => true, :block_types => :block_types + design_editor :holder => 'environment', :autosave => true, :block_types => :block_types def block_types { diff --git a/app/controllers/environment_admin/features_controller.rb b/app/controllers/environment_admin/features_controller.rb index 26c8e59..1ca2db6 100644 --- a/app/controllers/environment_admin/features_controller.rb +++ b/app/controllers/environment_admin/features_controller.rb @@ -1,9 +1,9 @@ class FeaturesController < EnvironmentAdminController - acts_as_virtual_community_admin_controller + acts_as_environment_admin_controller def index - @features = VirtualCommunity.available_features + @features = Environment.available_features end post_only :update @@ -13,8 +13,8 @@ class FeaturesController < EnvironmentAdminController else params[:features].keys end - @virtual_community.enabled_features = features - @virtual_community.save! + @environment.enabled_features = features + @environment.save! flash[:notice] = _('Features updated successfully.') redirect_to :action => 'index' end diff --git a/app/controllers/profile_admin/enterprise_controller.rb b/app/controllers/profile_admin/enterprise_controller.rb index 0ddfebe..82aa0d4 100644 --- a/app/controllers/profile_admin/enterprise_controller.rb +++ b/app/controllers/profile_admin/enterprise_controller.rb @@ -11,7 +11,7 @@ class EnterpriseController < ProfileAdminController else redirect_to :action => 'list' end - @vitual_communities = VirtualCommunity.find(:all) + @vitual_communities = Environment.find(:all) @validation_entities = Organization.find(:all) end @@ -28,7 +28,7 @@ class EnterpriseController < ProfileAdminController # Make a form to the creation of an eterprise def register_form @enterprise = Enterprise.new() - @vitual_communities = VirtualCommunity.find(:all) + @vitual_communities = Environment.find(:all) @validation_entities = Organization.find(:all) end @@ -42,7 +42,7 @@ class EnterpriseController < ProfileAdminController redirect_to :action => 'index' else flash[:notice] = _('Enterprise was not created') - @vitual_communities = VirtualCommunity.find(:all) + @vitual_communities = Environment.find(:all) @validation_entities = Organization.find(:all) render :action => 'register_form' end diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index f855771..c2712e0 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -27,12 +27,12 @@ class AccountController < PublicController def signup begin @user = User.new(params[:user]) - @user.terms_of_use = virtual_community.terms_of_use - @terms_of_use = virtual_community.terms_of_use + @user.terms_of_use = environment.terms_of_use + @terms_of_use = environment.terms_of_use if request.post? @user.save! - @user.person.virtual_community = virtual_community + @user.person.environment = environment @user.person.save! self.current_user = @user redirect_back_or_default(:controller => 'account', :action => 'index') diff --git a/app/controllers/public/home_controller.rb b/app/controllers/public/home_controller.rb index ad7ca17..5f3a84b 100644 --- a/app/controllers/public/home_controller.rb +++ b/app/controllers/public/home_controller.rb @@ -1,5 +1,5 @@ class HomeController < PublicController - design :holder => 'virtual_community' + design :holder => 'environment' end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index adcfceb..2398c87 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -73,8 +73,8 @@ module ApplicationHelper # TODO: test this helper # TODO: add an icon? # TODO: the command rake test:rcov didn't works because of this method. See what it's the problem - def virtual_community_identification - content_tag('div', @virtual_community.name, :id => 'virtual_community_identification') + def environment_identification + content_tag('div', @environment.name, :id => 'environment_identification') end def link_to_cms(text, profile = nil, options = {}) diff --git a/app/models/domain.rb b/app/models/domain.rb index a39393b..8c257f2 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -40,15 +40,15 @@ class Domain < ActiveRecord::Base name.downcase.sub(/^www\./, '') end - # detects the VirtualCommunity to which this domain belongs, either if it's + # detects the Environment to which this domain belongs, either if it's # directly owned by one, or through a profile who owns the domain but belongs - # to a VirtualCommunity. - def virtual_community + # to a Environment. + def environment case owner - when VirtualCommunity + when Environment owner when Profile - owner.virtual_community + owner.environment end end @@ -56,7 +56,7 @@ class Domain < ActiveRecord::Base # not directly associated with a profile. def profile case owner - when VirtualCommunity + when Environment nil when Profile owner diff --git a/app/models/profile.rb b/app/models/profile.rb index cdaecf9..93dfe95 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -1,6 +1,6 @@ # A Profile is the representation and web-presence of an individual or an -# organization. Every Profile is attached to its VirtualCommunity of origin, -# which by default is the one returned by VirtualCommunity:default. +# organization. Every Profile is attached to its Environment of origin, +# which by default is the one returned by Environment:default. class Profile < ActiveRecord::Base after_create do |profile| @@ -32,7 +32,7 @@ class Profile < ActiveRecord::Base acts_as_taggable has_many :domains, :as => :owner - belongs_to :virtual_community + belongs_to :environment has_many :role_assignments, :as => :resource has_many :people, :through => :role_assignments @@ -56,11 +56,11 @@ class Profile < ActiveRecord::Base validates_uniqueness_of :user_id, :allow_nil =>true # creates a new Profile. By default, it is attached to the default - # VirtualCommunity (see VirtualCommunity#default), unless you tell it + # Environment (see Environment#default), unless you tell it # otherwise def initialize(*args) super(*args) - self.virtual_community ||= VirtualCommunity.default + self.environment ||= Environment.default end # Searches tags by tag or name diff --git a/app/models/virtual_community.rb b/app/models/virtual_community.rb index 82dfb11..73fe8b3 100644 --- a/app/models/virtual_community.rb +++ b/app/models/virtual_community.rb @@ -1,9 +1,9 @@ -# A VirtualCommunity is like a website to be hosted in the platform. It may +# A Environment is like a website to be hosted in the platform. It may # contain multiple Profile's and can be identified by several different # domains. -class VirtualCommunity < ActiveRecord::Base +class Environment < ActiveRecord::Base - # returns the available features for a VirtualCommunity, in the form of a + # returns the available features for a Environment, in the form of a # hash, with pairs in the form 'feature_name' => 'Feature name'. def self.available_features { @@ -18,7 +18,7 @@ class VirtualCommunity < ActiveRecord::Base acts_as_design - # One VirtualCommunity can be reached by many domains + # One Environment can be reached by many domains has_many :domains, :as => :owner has_many :profiles @@ -26,10 +26,10 @@ class VirtualCommunity < ActiveRecord::Base # Attributes # ################################################# - # store the VirtualCommunity settings as YAML-serialized Hash. + # store the Environment settings as YAML-serialized Hash. serialize :settings - # returns a Hash containing the VirtualCommunity configuration + # returns a Hash containing the Environment configuration def settings self[:settings] ||= {} end @@ -74,7 +74,7 @@ class VirtualCommunity < ActiveRecord::Base self.settings['terms_of_use'] = value end - # returns true if this VirtualCommunity has terms of use to be + # returns true if this Environment has terms of use to be # accepted by users before registration. def has_terms_of_use? ! self.settings['terms_of_use'].nil? @@ -118,13 +118,13 @@ class VirtualCommunity < ActiveRecord::Base validates_presence_of :name # only one virtual community can be the default one - validates_uniqueness_of :is_default, :if => (lambda do |virtual_community| virtual_community.is_default? end), :message => _('Only one Virtual Community can be the default one') + validates_uniqueness_of :is_default, :if => (lambda do |environment| environment.is_default? end), :message => _('Only one Virtual Community can be the default one') # ################################################# # Business logic in general # ################################################# - # the default VirtualCommunity. + # the default Environment. def self.default self.find(:first, :conditions => [ 'is_default = ?', true ] ) end diff --git a/app/views/features/_features_table.rhtml b/app/views/features/_features_table.rhtml index c6b0b0f..3e1175e 100644 --- a/app/views/features/_features_table.rhtml +++ b/app/views/features/_features_table.rhtml @@ -3,7 +3,7 @@ <% @features.each do |feature, text| %>