From b4853226f5a8fcd87c6848118926fc3b70651145 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Wed, 26 Sep 2007 13:09:04 +0000 Subject: [PATCH] ActionItem5: removing the old enterprise controller --- app/controllers/profile_admin/membership_editor_controller.rb | 27 +++++++++++++++++++++++++++ app/helpers/enterprise_helper.rb | 2 -- app/views/enterprise/_enterprise.rhtml | 17 ----------------- app/views/enterprise/_form.rhtml | 32 -------------------------------- app/views/enterprise/_search_box.rhtml | 7 ------- app/views/enterprise/edit.rhtml | 9 --------- app/views/enterprise/list.rhtml | 28 ---------------------------- app/views/enterprise/register_form.rhtml | 13 ------------- app/views/enterprise/search.rhtml | 3 --- app/views/enterprise/show.rhtml | 31 ------------------------------- 10 files changed, 27 insertions(+), 142 deletions(-) delete mode 100644 app/helpers/enterprise_helper.rb delete mode 100644 app/views/enterprise/_enterprise.rhtml delete mode 100644 app/views/enterprise/_form.rhtml delete mode 100644 app/views/enterprise/_search_box.rhtml delete mode 100644 app/views/enterprise/edit.rhtml delete mode 100644 app/views/enterprise/list.rhtml delete mode 100644 app/views/enterprise/register_form.rhtml delete mode 100644 app/views/enterprise/search.rhtml delete mode 100644 app/views/enterprise/show.rhtml diff --git a/app/controllers/profile_admin/membership_editor_controller.rb b/app/controllers/profile_admin/membership_editor_controller.rb index aea6732..db10062 100644 --- a/app/controllers/profile_admin/membership_editor_controller.rb +++ b/app/controllers/profile_admin/membership_editor_controller.rb @@ -3,4 +3,31 @@ class MembershipEditorController < ProfileAdminController def index @memberships = current_user.person.memberships end + + def new_enteprise + @enterprise = Enterprise.new() + @vitual_communities = Environment.find(:all) + @validation_entities = Organization.find(:all) + end + + def create_enteprise + @enterprise = Enterprise.new(params[:enterprise]) + @enterprise.organization_info = OrganizationInfo.new(params[:organization]) + if @enterprise.save + @enterprise.people << @person + 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') + @vitual_communities = Environment.find(:all) + @validation_entities = Organization.find(:all) + render :action => 'register_form' + end + end + + # Search enterprises by name or tags + def search + @tagged_enterprises = Enterprise.search(params[:query]) + end + end diff --git a/app/helpers/enterprise_helper.rb b/app/helpers/enterprise_helper.rb deleted file mode 100644 index 3dcbee5..0000000 --- a/app/helpers/enterprise_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module EnterpriseHelper -end diff --git a/app/views/enterprise/_enterprise.rhtml b/app/views/enterprise/_enterprise.rhtml deleted file mode 100644 index f2f72ec..0000000 --- a/app/views/enterprise/_enterprise.rhtml +++ /dev/null @@ -1,17 +0,0 @@ -
  • -<%= link_to enterprise.name, :action => 'show', :id => enterprise %> -<%= link_to _('Edit'), :action => 'edit', :id => enterprise %> -<%= help _('Change the infomation about the enterprise') %> -<%= link_to _('Delete'), :action => 'destroy', :id => enterprise %> -<%= help _('Remove the enterprise from the system') %> -<%= link_to _('Affiliate'), :action => 'affiliate', :id => enterprise unless @my_enterprises.include?(enterprise) %> -<%= help _('Be a member of the enterprise') unless @my_enterprises.include?(enterprise) %> -<%= link_to _('Activate'), :action => 'activate', :id => enterprise unless enterprise.active %> -<%= help _('Activate the profile of an approved enterprise') unless enterprise.active %> -<% unless enterprise.approved? %> - <%= link_to _('Approve'), :action => 'approve', :id => enterprise %> - <%= help _('Approve a submitted enterprise profile') %> - <%= link_to _('Reject'), :action => 'reject', :id => enterprise %> - <%= help _('Reject a submitted enterprise profile') %> -<% end %> -
  • diff --git a/app/views/enterprise/_form.rhtml b/app/views/enterprise/_form.rhtml deleted file mode 100644 index c435e07..0000000 --- a/app/views/enterprise/_form.rhtml +++ /dev/null @@ -1,32 +0,0 @@ -


    -<%= text_field 'enterprise', 'name', 'size' => 20 %>

    - -


    -<%= text_field 'enterprise', 'address', 'size' => 50 %>

    - -


    -<%= text_field 'enterprise', 'contact_phone', 'size' => 20 %>

    - -


    -<%= text_field 'organization_info', 'contact_person', 'size' => 20 %>

    - -


    -<%= text_field 'organization_info', 'acronym', 'size' => 20 %>

    - -


    -<%= text_field 'organization_info', 'foundation_year', 'size' => 20 %>

    - -


    -<%= text_field 'organization_info', 'legal_form', 'size' => 20 %>

    - -


    -<%= text_field 'organization_info', 'economic_activity', 'size' => 20 %>

    - -


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

    - -


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

    - -


    -<%= text_field 'enterprise', 'tag_list', 'size' => 20 %>

    diff --git a/app/views/enterprise/_search_box.rhtml b/app/views/enterprise/_search_box.rhtml deleted file mode 100644 index a4f1582..0000000 --- a/app/views/enterprise/_search_box.rhtml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/app/views/enterprise/edit.rhtml b/app/views/enterprise/edit.rhtml deleted file mode 100644 index b238d4a..0000000 --- a/app/views/enterprise/edit.rhtml +++ /dev/null @@ -1,9 +0,0 @@ -<%= error_messages_for 'enterprise' %> - -

    <%= _('Edit enterprise informations') %>

    - -<% form_tag :action => 'update', :id => @enterprise do %> - <%= render :partial => 'form' %> -

    <%= submit_tag _('Update') %> -<%= link_to _('Cancel'), :action => 'index' %>

    -<% end %> diff --git a/app/views/enterprise/list.rhtml b/app/views/enterprise/list.rhtml deleted file mode 100644 index 0ca3692..0000000 --- a/app/views/enterprise/list.rhtml +++ /dev/null @@ -1,28 +0,0 @@ -<%= render :partial => 'search_box' %> - -<%= error_messages_for 'enterprise' %> -<%= error_messages_for 'enterprise_info' %> - -

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

    - - -

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

    - - -<% unless @my_pending_enterprises.blank? %> -

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

    - -<% end %> - -<% unless @enterprises.blank? %> -

    <%= _('Other Enterprises') %>

    - -<% end %> diff --git a/app/views/enterprise/register_form.rhtml b/app/views/enterprise/register_form.rhtml deleted file mode 100644 index fc38f45..0000000 --- a/app/views/enterprise/register_form.rhtml +++ /dev/null @@ -1,13 +0,0 @@ -<%= error_messages_for 'enterprise' %> - -

    <%= _('Register enterprise') %>

    - -<%= _('How to proceed') %> - -<% form_tag :action => 'register' do %> -


    - <%= text_field 'enterprise', 'identifier', 'size' => 20 %>

    - <%= render :partial => 'form' %> -

    <%= submit_tag _('Register') %> -<%= link_to _('Cancel'), :action => 'index' %>

    -<% end %> diff --git a/app/views/enterprise/search.rhtml b/app/views/enterprise/search.rhtml deleted file mode 100644 index 0387a8e..0000000 --- a/app/views/enterprise/search.rhtml +++ /dev/null @@ -1,3 +0,0 @@ -

    <%= @tagged_enterprises.size.to_s + _(' enterprises found') %>

    - -<%= render :partial => 'enterprise', :collection => @tagged_enterprises %> diff --git a/app/views/enterprise/show.rhtml b/app/views/enterprise/show.rhtml deleted file mode 100644 index 8b7f0be..0000000 --- a/app/views/enterprise/show.rhtml +++ /dev/null @@ -1,31 +0,0 @@ -<%= render :partial => 'search_box' %> - -<%= link_to _('Register new enterprise'), :action => 'register_form' %> - -

    <%= @enterprise.name %>

    - -

    <%= _('Identifier: ') %> <%= @enterprise.identifier %>

    -

    <%= _('Address: ') %> <%= @enterprise.address %>

    -

    <%= _('Contact phone: ') %> <%= @enterprise.contact_phone %>

    -

    <%= _('Contact person: ') %> <%= @enterprise.organization_info.contact_person %>

    -

    <%= _('Acronym: ') %> <%= @enterprise.organization_info.acronym %>

    -

    <%= _('Foundation year: ') %> <%= @enterprise.organization_info.foundation_year %>

    -

    <%= _('Legal Form: ') %> <%= @enterprise.organization_info.legal_form %>

    -

    <%= _('Economic activity: ') %> <%= @enterprise.organization_info.economic_activity %>

    -

    <%= _('Management infomation: ') %> <%= @enterprise.organization_info.management_information %>

    -

    <%= _('Tags:') %> <%= @enterprise.tag_list %>

    - -<%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> -<%= help _('Change the information about the enterprise') %> -<%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> -<%= help _('Remove the enterprise from the system') %> -<%= link_to _('Affiliate'), :action => 'affiliate' unless @my_enterprises.include?(@enterprise) %> -<%= help _('Be a member of the enterprise') %> -<%= link_to _('Activate'), :action => 'activate', :id => @enterprise if @my_pending_enterprises.include?(@enterprise) %> -<%= help _('Activate an approved enterprise') if @my_pending_enterprises.include?(@enterprise) %> -<% unless @enterprise.approved? %> - <%= link_to _('Approve'), :action => 'approve', :id => @enterprise %> - <%= help _('Approve a submitted enterprise profile') %> - <%= link_to _('Reject'), :action => 'reject', :id => @enterprise %> - <%= help _('Reject a submitted enterprise profile') %> -<% end %> -- libgit2 0.21.2