Commit b4853226f5a8fcd87c6848118926fc3b70651145
1 parent
e713df48
Exists in
master
and in
22 other branches
ActionItem5: removing the old enterprise controller
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@559 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
10 changed files
with
27 additions
and
142 deletions
Show diff stats
app/controllers/profile_admin/membership_editor_controller.rb
... | ... | @@ -3,4 +3,31 @@ class MembershipEditorController < ProfileAdminController |
3 | 3 | def index |
4 | 4 | @memberships = current_user.person.memberships |
5 | 5 | end |
6 | + | |
7 | + def new_enteprise | |
8 | + @enterprise = Enterprise.new() | |
9 | + @vitual_communities = Environment.find(:all) | |
10 | + @validation_entities = Organization.find(:all) | |
11 | + end | |
12 | + | |
13 | + def create_enteprise | |
14 | + @enterprise = Enterprise.new(params[:enterprise]) | |
15 | + @enterprise.organization_info = OrganizationInfo.new(params[:organization]) | |
16 | + if @enterprise.save | |
17 | + @enterprise.people << @person | |
18 | + flash[:notice] = _('The enterprise was succesfully created, the validation entity will cotact you as soon as your enterprise is approved') | |
19 | + redirect_to :action => 'index' | |
20 | + else | |
21 | + flash[:notice] = _('Enterprise was not created') | |
22 | + @vitual_communities = Environment.find(:all) | |
23 | + @validation_entities = Organization.find(:all) | |
24 | + render :action => 'register_form' | |
25 | + end | |
26 | + end | |
27 | + | |
28 | + # Search enterprises by name or tags | |
29 | + def search | |
30 | + @tagged_enterprises = Enterprise.search(params[:query]) | |
31 | + end | |
32 | + | |
6 | 33 | end | ... | ... |
app/helpers/enterprise_helper.rb
app/views/enterprise/_enterprise.rhtml
... | ... | @@ -1,17 +0,0 @@ |
1 | -<li> | |
2 | -<%= link_to enterprise.name, :action => 'show', :id => enterprise %> | |
3 | -<%= link_to _('Edit'), :action => 'edit', :id => enterprise %> | |
4 | -<%= help _('Change the infomation about the enterprise') %> | |
5 | -<%= link_to _('Delete'), :action => 'destroy', :id => enterprise %> | |
6 | -<%= help _('Remove the enterprise from the system') %> | |
7 | -<%= link_to _('Affiliate'), :action => 'affiliate', :id => enterprise unless @my_enterprises.include?(enterprise) %> | |
8 | -<%= help _('Be a member of the enterprise') unless @my_enterprises.include?(enterprise) %> | |
9 | -<%= link_to _('Activate'), :action => 'activate', :id => enterprise unless enterprise.active %> | |
10 | -<%= help _('Activate the profile of an approved enterprise') unless enterprise.active %> | |
11 | -<% unless enterprise.approved? %> | |
12 | - <%= link_to _('Approve'), :action => 'approve', :id => enterprise %> | |
13 | - <%= help _('Approve a submitted enterprise profile') %> | |
14 | - <%= link_to _('Reject'), :action => 'reject', :id => enterprise %> | |
15 | - <%= help _('Reject a submitted enterprise profile') %> | |
16 | -<% end %> | |
17 | -</li> |
app/views/enterprise/_form.rhtml
... | ... | @@ -1,32 +0,0 @@ |
1 | -<p><label for="name"><%= _('Name') %></label><br/> | |
2 | -<%= text_field 'enterprise', 'name', 'size' => 20 %></p> | |
3 | - | |
4 | -<p><label for="address"><%= _('Address') %></label><br/> | |
5 | -<%= text_field 'enterprise', 'address', 'size' => 50 %></p> | |
6 | - | |
7 | -<p><label for="contact_phone"><%= _('Contact Phone') %></label><br/> | |
8 | -<%= text_field 'enterprise', 'contact_phone', 'size' => 20 %></p> | |
9 | - | |
10 | -<p><label for="contact_person"><%= _('Contact Person') %></label><br/> | |
11 | -<%= text_field 'organization_info', 'contact_person', 'size' => 20 %></p> | |
12 | - | |
13 | -<p><label for="acronym"><%= _('Acronym') %></label><br/> | |
14 | -<%= text_field 'organization_info', 'acronym', 'size' => 20 %></p> | |
15 | - | |
16 | -<p><label for="foundation_year"><%= _('Foundation Year') %></label><br/> | |
17 | -<%= text_field 'organization_info', 'foundation_year', 'size' => 20 %></p> | |
18 | - | |
19 | -<p><label for="legal_form"><%= _('Legal Form') %></label><br/> | |
20 | -<%= text_field 'organization_info', 'legal_form', 'size' => 20 %></p> | |
21 | - | |
22 | -<p><label for="economic_activity"><%= _('Economic Activity') %></label><br/> | |
23 | -<%= text_field 'organization_info', 'economic_activity', 'size' => 20 %></p> | |
24 | - | |
25 | -<p><label for="management_information"><%= _('Management Information') %></label><br/> | |
26 | -<%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %></p> | |
27 | - | |
28 | -<p><label for="validation_entity"><%= _('Validation Entity') %></label><br/> | |
29 | -<%= select 'validation_entity', 'id', @validation_entities.map{|v| [v.name, v.id]}, :include_blank => true %></p> | |
30 | - | |
31 | -<p><label for="tag_list"><%= _('Tags') %></label><br/> | |
32 | -<%= text_field 'enterprise', 'tag_list', 'size' => 20 %></p> |
app/views/enterprise/_search_box.rhtml
app/views/enterprise/edit.rhtml
... | ... | @@ -1,9 +0,0 @@ |
1 | -<%= error_messages_for 'enterprise' %> | |
2 | - | |
3 | -<h2><%= _('Edit enterprise informations') %></h2> | |
4 | - | |
5 | -<% form_tag :action => 'update', :id => @enterprise do %> | |
6 | - <%= render :partial => 'form' %> | |
7 | -<p><%= submit_tag _('Update') %> | |
8 | -<%= link_to _('Cancel'), :action => 'index' %></p> | |
9 | -<% end %> |
app/views/enterprise/list.rhtml
... | ... | @@ -1,28 +0,0 @@ |
1 | -<%= render :partial => 'search_box' %> | |
2 | - | |
3 | -<%= error_messages_for 'enterprise' %> | |
4 | -<%= error_messages_for 'enterprise_info' %> | |
5 | - | |
6 | -<p> <%= link_to _('Register new enterprise'), :action => 'register_form' %> | |
7 | -<%= help _('Creates a new enterprise') %> | |
8 | -</p> | |
9 | - | |
10 | - | |
11 | -<h2> <%= _('Listing my enterprises') %> </h2> | |
12 | -<ul> | |
13 | - <%= render :partial => 'enterprise', :collection => @my_active_enterprises %> | |
14 | -</ul> | |
15 | - | |
16 | -<% unless @my_pending_enterprises.blank? %> | |
17 | - <h2> <%= _('Listing pending enterprises') %> </h2> | |
18 | - <ul> | |
19 | - <%= render :partial => 'enterprise', :collection => @my_pending_enterprises %> | |
20 | - </ul> | |
21 | -<% end %> | |
22 | - | |
23 | -<% unless @enterprises.blank? %> | |
24 | -<h4> <%= _('Other Enterprises') %> </h4> | |
25 | -<ul> | |
26 | - <%= render :partial => 'enterprise', :collection => @enterprises %> | |
27 | -</ul> | |
28 | -<% end %> |
app/views/enterprise/register_form.rhtml
... | ... | @@ -1,13 +0,0 @@ |
1 | -<%= error_messages_for 'enterprise' %> | |
2 | - | |
3 | -<h2><%= _('Register enterprise') %></h2> | |
4 | - | |
5 | -<%= _('How to proceed') %> | |
6 | - | |
7 | -<% form_tag :action => 'register' do %> | |
8 | - <p><label for="identifier"><%= _('Identifier') %></label><br/> | |
9 | - <%= text_field 'enterprise', 'identifier', 'size' => 20 %></p> | |
10 | - <%= render :partial => 'form' %> | |
11 | -<p><%= submit_tag _('Register') %> | |
12 | -<%= link_to _('Cancel'), :action => 'index' %></p> | |
13 | -<% end %> |
app/views/enterprise/search.rhtml
app/views/enterprise/show.rhtml
... | ... | @@ -1,31 +0,0 @@ |
1 | -<%= render :partial => 'search_box' %> | |
2 | - | |
3 | -<%= link_to _('Register new enterprise'), :action => 'register_form' %> | |
4 | - | |
5 | -<h3> <%= @enterprise.name %> </h3> | |
6 | - | |
7 | -<p> <%= _('Identifier: ') %> <%= @enterprise.identifier %> </p> | |
8 | -<p> <%= _('Address: ') %> <%= @enterprise.address %> </p> | |
9 | -<p> <%= _('Contact phone: ') %> <%= @enterprise.contact_phone %> </p> | |
10 | -<p> <%= _('Contact person: ') %> <%= @enterprise.organization_info.contact_person %> </p> | |
11 | -<p> <%= _('Acronym: ') %> <%= @enterprise.organization_info.acronym %> </p> | |
12 | -<p> <%= _('Foundation year: ') %> <%= @enterprise.organization_info.foundation_year %> </p> | |
13 | -<p> <%= _('Legal Form: ') %> <%= @enterprise.organization_info.legal_form %> </p> | |
14 | -<p> <%= _('Economic activity: ') %> <%= @enterprise.organization_info.economic_activity %> </p> | |
15 | -<p> <%= _('Management infomation: ') %> <%= @enterprise.organization_info.management_information %> </p> | |
16 | -<p> <%= _('Tags:') %> <%= @enterprise.tag_list %> </p> | |
17 | - | |
18 | -<%= link_to _('Edit enterprise'), :action => 'edit', :id => @enterprise %> | |
19 | -<%= help _('Change the information about the enterprise') %> | |
20 | -<%= link_to _('Delete enterprise'), :action => 'destroy', :id => @enterprise %> | |
21 | -<%= help _('Remove the enterprise from the system') %> | |
22 | -<%= link_to _('Affiliate'), :action => 'affiliate' unless @my_enterprises.include?(@enterprise) %> | |
23 | -<%= help _('Be a member of the enterprise') %> | |
24 | -<%= link_to _('Activate'), :action => 'activate', :id => @enterprise if @my_pending_enterprises.include?(@enterprise) %> | |
25 | -<%= help _('Activate an approved enterprise') if @my_pending_enterprises.include?(@enterprise) %> | |
26 | -<% unless @enterprise.approved? %> | |
27 | - <%= link_to _('Approve'), :action => 'approve', :id => @enterprise %> | |
28 | - <%= help _('Approve a submitted enterprise profile') %> | |
29 | - <%= link_to _('Reject'), :action => 'reject', :id => @enterprise %> | |
30 | - <%= help _('Reject a submitted enterprise profile') %> | |
31 | -<% end %> |