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 @@ -
-<%= 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 %>
<%= 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') %> -
- - -
- <%= text_field 'enterprise', 'identifier', 'size' => 20 %>
<%= 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 @@ -<%= _('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