diff --git a/app/controllers/enterprise_controller.rb b/app/controllers/enterprise_controller.rb index 7e8bc0f..e43d17b 100644 --- a/app/controllers/enterprise_controller.rb +++ b/app/controllers/enterprise_controller.rb @@ -30,7 +30,7 @@ class EnterpriseController < ApplicationController @enterprise.organization_info = OrganizationInfo.new(params[:organization]) if @enterprise.save @enterprise.people << @person - flash[:notice] = _('Enterprise was succesfully created') + flash[:notice] = _('The enterprise was succesfully created, the validation entity will cotact you as soon as your enterprise is approved') redirect_to :action => 'index' else flash[:notice] = _('Enterprise was not created') @@ -72,6 +72,16 @@ class EnterpriseController < ApplicationController @tagged_enterprises = Enterprise.find_tagged_with(params[:query]) end + def activate + @enterprise = Enterprise.find(params[:id]) + if @enterprise.update_attribute('active', true) + flash[:notice] = 'Enterprise successfuly activacted' + render :action => 'show' + else + redirect_to :action => 'show', :id => @enterprise + end + end + protected def logon diff --git a/app/views/enterprise/_search_box.rhtml b/app/views/enterprise/_search_box.rhtml new file mode 100644 index 0000000..895590d --- /dev/null +++ b/app/views/enterprise/_search_box.rhtml @@ -0,0 +1,6 @@ +
<%= link_to _('Register new enterprise'), :action => 'register_form' %>
+
<%= text_field 'enterprise', 'identifier', 'size' => 20 %>
<%= _('Identifier: ') %> <%= @enterprise.identifier %>
@@ -13,5 +17,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' unless @my_enterprises.include?(@enterprise) %> diff --git a/config/environment.rb b/config/environment.rb index 6d153ad..dcef1fa 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -53,7 +53,7 @@ end # Include your application configuration below require 'gettext/rails' -require 'extended_tag' +#require 'extended_tag' Tag.hierarchical = true Comatose.configure do |config| diff --git a/db/migrate/010_create_organization_infos.rb b/db/migrate/010_create_organization_infos.rb index 8ffe65f..20419da 100644 --- a/db/migrate/010_create_organization_infos.rb +++ b/db/migrate/010_create_organization_infos.rb @@ -8,6 +8,7 @@ class CreateOrganizationInfos < ActiveRecord::Migration t.column :legal_form, :string t.column :economic_activity, :string t.column :management_information, :string + t.column :validated, :boolean, :default => false end end diff --git a/test/functional/enterprise_controller_test.rb b/test/functional/enterprise_controller_test.rb index 70d0e39..4133dd5 100644 --- a/test/functional/enterprise_controller_test.rb +++ b/test/functional/enterprise_controller_test.rb @@ -129,4 +129,12 @@ class EnterpriseControllerTest < Test::Unit::TestCase assert assigns(:tagged_enterprises) assert_kind_of Array, assigns(:tagged_enterprises) end + + def test_activate + login_as 'ze' + post :activate, :id => 5 + assert assigns(:enterprise) + assert_kind_of Enterprise, assigns(:enterprise) + assert assigns(:enterprise).active + end end -- libgit2 0.21.2