Commit 012be24d770e8a7480ddfaf444548883d2b6928c
1 parent
b4bacb9e
Exists in
master
and in
22 other branches
ActionItem6: added the choice of a validation entity for the enterprise
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@315 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
6 changed files
with
13 additions
and
3 deletions
Show diff stats
app/controllers/enterprise_controller.rb
| @@ -22,6 +22,7 @@ class EnterpriseController < ApplicationController | @@ -22,6 +22,7 @@ class EnterpriseController < ApplicationController | ||
| 22 | def register_form | 22 | def register_form |
| 23 | @enterprise = Enterprise.new() | 23 | @enterprise = Enterprise.new() |
| 24 | @vitual_communities = VirtualCommunity.find(:all) | 24 | @vitual_communities = VirtualCommunity.find(:all) |
| 25 | + @validation_entities = Organization.find(:all) | ||
| 25 | end | 26 | end |
| 26 | 27 | ||
| 27 | def register | 28 | def register |
app/models/enterprise.rb
| 1 | -#An enterprise is a kind of profile. According to the system concept, only enterprises can offer products/services | 1 | +#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 |
| 2 | class Enterprise < Organization | 2 | class Enterprise < Organization |
| 3 | + belongs_to :validation_entity, :class_name => 'organization' | ||
| 3 | end | 4 | end |
app/models/organization.rb
| @@ -2,4 +2,5 @@ class Organization < Profile | @@ -2,4 +2,5 @@ class Organization < Profile | ||
| 2 | has_one :organization_info | 2 | has_one :organization_info |
| 3 | has_many :affiliations | 3 | has_many :affiliations |
| 4 | has_many :people, :through => :affiliations | 4 | has_many :people, :through => :affiliations |
| 5 | + has_many :validated_enterprises, :class_name => 'enterprise' | ||
| 5 | end | 6 | end |
app/views/enterprise/_form.rhtml
| @@ -24,3 +24,6 @@ | @@ -24,3 +24,6 @@ | ||
| 24 | 24 | ||
| 25 | <p><label for="management_information"><%= _('Management Information') %></label><br/> | 25 | <p><label for="management_information"><%= _('Management Information') %></label><br/> |
| 26 | <%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %></p> | 26 | <%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %></p> |
| 27 | + | ||
| 28 | +<p><label for="validation_entity"><%= _('Validation Entity') %></label><br/> | ||
| 29 | +<%= select 'validation_entity', 'id', @validation_entities.map{|v| [v.name, v.id] } %></p> |
app/views/enterprise/show.rhtml
| @@ -13,3 +13,4 @@ | @@ -13,3 +13,4 @@ | ||
| 13 | <%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> | 13 | <%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> |
| 14 | <%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> | 14 | <%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> |
| 15 | <%= link_to _('Register new enterprise'), :action => 'register_form' %> | 15 | <%= link_to _('Register new enterprise'), :action => 'register_form' %> |
| 16 | +<%= link_to _('Affiliate'), :action => 'affiliate' %> |
db/migrate/003_create_profiles.rb
| @@ -9,11 +9,14 @@ class CreateProfiles < ActiveRecord::Migration | @@ -9,11 +9,14 @@ class CreateProfiles < ActiveRecord::Migration | ||
| 9 | t.column :flexible_template_theme, :string, :default => "default" | 9 | t.column :flexible_template_theme, :string, :default => "default" |
| 10 | t.column :flexible_template_icon_theme, :string, :default => "default" | 10 | t.column :flexible_template_icon_theme, :string, :default => "default" |
| 11 | t.column :active, :boolean, :default => false | 11 | t.column :active, :boolean, :default => false |
| 12 | - t.column :address, :string | ||
| 13 | - t.column :contact_phone, :string | 12 | + t.column :address, :string |
| 13 | + t.column :contact_phone, :string | ||
| 14 | 14 | ||
| 15 | #person fields | 15 | #person fields |
| 16 | t.column :user_id, :integer | 16 | t.column :user_id, :integer |
| 17 | + | ||
| 18 | + #enterprise fields | ||
| 19 | + t.column :validation_entity_id, :integer | ||
| 17 | end | 20 | end |
| 18 | end | 21 | end |
| 19 | 22 |