Commit 0e575f49339461b1b14806c6a2eafcaa0096a7d5
1 parent
412ffbaa
Exists in
master
and in
22 other branches
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
Showing
5 changed files
with
10 additions
and
3 deletions
Show diff stats
app/controllers/enterprise_controller.rb
@@ -14,6 +14,7 @@ class EnterpriseController < ApplicationController | @@ -14,6 +14,7 @@ class EnterpriseController < ApplicationController | ||
14 | 14 | ||
15 | def register | 15 | def register |
16 | @enterprise = Enterprise.new(params[:enterprise]) | 16 | @enterprise = Enterprise.new(params[:enterprise]) |
17 | + @enterprise.identifier = @enterprise.name | ||
17 | if @enterprise.save | 18 | if @enterprise.save |
18 | @enterprise.people << current_user.person | 19 | @enterprise.people << current_user.person |
19 | flash[:notice] = _('Enterprise was succesfully created') | 20 | flash[:notice] = _('Enterprise was succesfully created') |
app/models/enterprise.rb
1 | #A enterprise is a kind of profile. According to the system concept, only enterprises can offer priducts/services | 1 | #A enterprise is a kind of profile. According to the system concept, only enterprises can offer priducts/services |
2 | class Enterprise < Profile | 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 | end | 6 | end |
app/views/enterprise/_enterprise.rhtml
app/views/enterprise/index.rhtml
@@ -3,3 +3,8 @@ | @@ -3,3 +3,8 @@ | ||
3 | <ul> | 3 | <ul> |
4 | <%= render :partial => 'enterprise', :collection => @my_enterprises %> | 4 | <%= render :partial => 'enterprise', :collection => @my_enterprises %> |
5 | </ul> | 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,5 +31,5 @@ | ||
31 | <%= text_area 'enterprise', 'management_information', 'cols' => 40, 'rows' => 20 %></p> | 31 | <%= text_area 'enterprise', 'management_information', 'cols' => 40, 'rows' => 20 %></p> |
32 | 32 | ||
33 | <p><%= submit_tag _('Register') %> | 33 | <p><%= submit_tag _('Register') %> |
34 | -<%= link_to _('Cancel'), :action => 'register' %></p> | 34 | +<%= link_to _('Cancel'), :action => 'index' %></p> |
35 | <% end %> | 35 | <% end %> |