Commit 0e575f49339461b1b14806c6a2eafcaa0096a7d5

Authored by DanielaFeitosa
1 parent 412ffbaa

ActionItem6: Fixing links in views and validation in model of enterprise


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@213 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/enterprise_controller.rb
... ... @@ -14,6 +14,7 @@ class EnterpriseController < ApplicationController
14 14  
15 15 def register
16 16 @enterprise = Enterprise.new(params[:enterprise])
  17 + @enterprise.identifier = @enterprise.name
17 18 if @enterprise.save
18 19 @enterprise.people << current_user.person
19 20 flash[:notice] = _('Enterprise was succesfully created')
... ...
app/models/enterprise.rb
1 1 #A enterprise is a kind of profile. According to the system concept, only enterprises can offer priducts/services
2 2 class Enterprise < Profile
3 3  
4   - validates_numericality_of :foundation_year, :only_integer => true
  4 + validates_numericality_of :foundation_year, :only_integer => true, :allow_nil => true
  5 +
5 6 end
... ...
app/views/enterprise/_enterprise.rhtml
1   -<li> <%= enterprise.name %> </li>
  1 +<li> <%= link_to enterprise.name %> </li>
... ...
app/views/enterprise/index.rhtml
... ... @@ -3,3 +3,8 @@
3 3 <ul>
4 4 <%= render :partial => 'enterprise', :collection => @my_enterprises %>
5 5 </ul>
  6 +
  7 +<h2> <%= _('Listing pending enterprises') %> </h2>
  8 +<ul>
  9 + <%= render :partial => 'enterprise', :collection => @pending_enterprises %>
  10 +</ul>
... ...
app/views/enterprise/register_form.rhtml
... ... @@ -31,5 +31,5 @@
31 31 <%= text_area 'enterprise', 'management_information', 'cols' => 40, 'rows' => 20 %></p>
32 32  
33 33 <p><%= submit_tag _('Register') %>
34   -<%= link_to _('Cancel'), :action => 'register' %></p>
  34 +<%= link_to _('Cancel'), :action => 'index' %></p>
35 35 <% end %>
... ...