From a9a6cb4e14079c7fae88593f3fbb1bb5edfb0e99 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Thu, 16 Aug 2007 22:30:47 +0000 Subject: [PATCH] ActionItem2: added an activate action to the enterprise controller --- app/controllers/enterprise_controller.rb | 12 +++++++++++- app/views/enterprise/_search_box.rhtml | 6 ++++++ app/views/enterprise/list.rhtml | 8 ++------ app/views/enterprise/register_form.rhtml | 2 ++ app/views/enterprise/show.rhtml | 5 ++++- config/environment.rb | 2 +- db/migrate/010_create_organization_infos.rb | 1 + test/functional/enterprise_controller_test.rb | 8 ++++++++ 8 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 app/views/enterprise/_search_box.rhtml 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 @@ + diff --git a/app/views/enterprise/list.rhtml b/app/views/enterprise/list.rhtml index 47b5dd1..d6e468e 100644 --- a/app/views/enterprise/list.rhtml +++ b/app/views/enterprise/list.rhtml @@ -1,11 +1,7 @@ - +<%= render :partial => 'search_box' %>

<%= link_to _('Register new enterprise'), :action => 'register_form' %>

+

<%= _('Listing my enterprises') %>