From 012be24d770e8a7480ddfaf444548883d2b6928c Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Thu, 2 Aug 2007 18:23:53 +0000 Subject: [PATCH] ActionItem6: added the choice of a validation entity for the enterprise --- app/controllers/enterprise_controller.rb | 1 + app/models/enterprise.rb | 3 ++- app/models/organization.rb | 1 + app/views/enterprise/_form.rhtml | 3 +++ app/views/enterprise/show.rhtml | 1 + db/migrate/003_create_profiles.rb | 7 +++++-- 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/controllers/enterprise_controller.rb b/app/controllers/enterprise_controller.rb index d90082d..6900150 100644 --- a/app/controllers/enterprise_controller.rb +++ b/app/controllers/enterprise_controller.rb @@ -22,6 +22,7 @@ class EnterpriseController < ApplicationController def register_form @enterprise = Enterprise.new() @vitual_communities = VirtualCommunity.find(:all) + @validation_entities = Organization.find(:all) end def register diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 1a46e1e..25f0875 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -1,3 +1,4 @@ -#An enterprise is a kind of profile. According to the system concept, only enterprises can offer products/services +#An enterprise is a kind of organization. According to the system concept, only enterprises can offer products/services and ahave to be validated by an validation entity class Enterprise < Organization + belongs_to :validation_entity, :class_name => 'organization' end diff --git a/app/models/organization.rb b/app/models/organization.rb index 5d6bd69..273cbf2 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -2,4 +2,5 @@ class Organization < Profile has_one :organization_info has_many :affiliations has_many :people, :through => :affiliations + has_many :validated_enterprises, :class_name => 'enterprise' end diff --git a/app/views/enterprise/_form.rhtml b/app/views/enterprise/_form.rhtml index e0d104c..4d0b659 100644 --- a/app/views/enterprise/_form.rhtml +++ b/app/views/enterprise/_form.rhtml @@ -24,3 +24,6 @@


<%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %>

+ +


+<%= select 'validation_entity', 'id', @validation_entities.map{|v| [v.name, v.id] } %>

diff --git a/app/views/enterprise/show.rhtml b/app/views/enterprise/show.rhtml index 9127e1e..9fa7531 100644 --- a/app/views/enterprise/show.rhtml +++ b/app/views/enterprise/show.rhtml @@ -13,3 +13,4 @@ <%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> <%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> <%= link_to _('Register new enterprise'), :action => 'register_form' %> +<%= link_to _('Affiliate'), :action => 'affiliate' %> diff --git a/db/migrate/003_create_profiles.rb b/db/migrate/003_create_profiles.rb index 0c88063..8f979bf 100644 --- a/db/migrate/003_create_profiles.rb +++ b/db/migrate/003_create_profiles.rb @@ -9,11 +9,14 @@ class CreateProfiles < ActiveRecord::Migration t.column :flexible_template_theme, :string, :default => "default" t.column :flexible_template_icon_theme, :string, :default => "default" t.column :active, :boolean, :default => false - t.column :address, :string - t.column :contact_phone, :string + t.column :address, :string + t.column :contact_phone, :string #person fields t.column :user_id, :integer + + #enterprise fields + t.column :validation_entity_id, :integer end end -- libgit2 0.21.2