From adbea53935329e7c6a7aaa9fddded61b7181ecd1 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Wed, 26 Sep 2007 13:45:04 +0000 Subject: [PATCH] ActionItem6: moved registration of enterprises to the membership controller --- app/controllers/profile_admin/membership_editor_controller.rb | 7 +++---- app/views/membership_editor/_form.rhtml | 32 ++++++++++++++++++++++++++++++++ app/views/membership_editor/index.rhtml | 2 ++ app/views/membership_editor/new_enterprise.rhtml | 14 ++++++++++++++ app/views/membership_editor/search.rhtml | 3 +++ 5 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 app/views/membership_editor/_form.rhtml create mode 100644 app/views/membership_editor/new_enterprise.rhtml create mode 100644 app/views/membership_editor/search.rhtml diff --git a/app/controllers/profile_admin/membership_editor_controller.rb b/app/controllers/profile_admin/membership_editor_controller.rb index db10062..3683a1e 100644 --- a/app/controllers/profile_admin/membership_editor_controller.rb +++ b/app/controllers/profile_admin/membership_editor_controller.rb @@ -4,17 +4,17 @@ class MembershipEditorController < ProfileAdminController @memberships = current_user.person.memberships end - def new_enteprise + def new_enterprise @enterprise = Enterprise.new() @vitual_communities = Environment.find(:all) @validation_entities = Organization.find(:all) end - def create_enteprise + def create_enterprise @enterprise = Enterprise.new(params[:enterprise]) @enterprise.organization_info = OrganizationInfo.new(params[:organization]) if @enterprise.save - @enterprise.people << @person + @enterprise.affiliate(@person, Role.find_by_name('owner')) 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 @@ -29,5 +29,4 @@ class MembershipEditorController < ProfileAdminController def search @tagged_enterprises = Enterprise.search(params[:query]) end - end diff --git a/app/views/membership_editor/_form.rhtml b/app/views/membership_editor/_form.rhtml new file mode 100644 index 0000000..c435e07 --- /dev/null +++ b/app/views/membership_editor/_form.rhtml @@ -0,0 +1,32 @@ +


+<%= 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/membership_editor/index.rhtml b/app/views/membership_editor/index.rhtml index b57b6c9..eaae374 100644 --- a/app/views/membership_editor/index.rhtml +++ b/app/views/membership_editor/index.rhtml @@ -5,3 +5,5 @@
  • <%= link_to m.name, '/' + m.identifier %>
  • <% end %> + +<%= link_to _('New enterprise'), :action => 'new_enterprise' %> diff --git a/app/views/membership_editor/new_enterprise.rhtml b/app/views/membership_editor/new_enterprise.rhtml new file mode 100644 index 0000000..f09a505 --- /dev/null +++ b/app/views/membership_editor/new_enterprise.rhtml @@ -0,0 +1,14 @@ +<%= error_messages_for 'enterprise' %> + +

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

    + +

    <%= _('How to proceed') %>

    +

    <%= _('Fill the form and hit the Register button then the enterprise will be submitted for evaluation at the validation entitiy of your choice (within your state), when the enterprise is aproved you will be able to activate its profile') %>

    + +<% form_tag :action => 'create_enterprise' do %> +


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

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

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

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

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

    + +<%= render :partial => 'enterprise', :collection => @tagged_enterprises %> -- libgit2 0.21.2