Commit 7a2fb0a043bcb7fa90ef3a3030481695b9b2ecba

Authored by MoisesMachado
1 parent 7b7083b7

ActionItem121: moved the enterprise_info form to organization_info and fixed som…

…e issues with the noosfero form builder


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1187 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/profile_editor_controller.rb
@@ -45,7 +45,7 @@ class ProfileEditorController < MyProfileController @@ -45,7 +45,7 @@ class ProfileEditorController < MyProfileController
45 redirect_to :action => 'index' 45 redirect_to :action => 'index'
46 else 46 else
47 flash[:notice] = _('Could not upload image') 47 flash[:notice] = _('Could not upload image')
48 - render :action => 'change_imange' 48 + render :action => 'change_image'
49 end 49 end
50 end 50 end
51 end 51 end
app/helpers/application_helper.rb
@@ -190,10 +190,12 @@ module ApplicationHelper @@ -190,10 +190,12 @@ module ApplicationHelper
190 field_id = $1 190 field_id = $1
191 end 191 end
192 field_html =~ /type=['"]([^'"]*)['"]/ 192 field_html =~ /type=['"]([^'"]*)['"]/
  193 + field_html =~ /<(\w*)/ unless $1
193 field_type = $1 194 field_type = $1
  195 + field_class = 'formfield type-' + field_type if field_type
194 196
195 label_html = content_tag('label', text, :class => 'formlabel', :for => field_id) 197 label_html = content_tag('label', text, :class => 'formlabel', :for => field_id)
196 - control_html = content_tag('div', field_html, :class => 'formfield type-'+field_type ) 198 + control_html = content_tag('div', field_html, :class => field_class )
197 199
198 content_tag('div', label_html + control_html, :class => 'formfieldline' ) 200 content_tag('div', label_html + control_html, :class => 'formfieldline' )
199 end 201 end
app/views/profile_editor/enterprise_info.rhtml
@@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
1 -<label class='formlabel' for="name"><%= _('Name') %></label>  
2 -<p class='formfield text_field'><%= text_field 'enterprise', 'name', 'size' => 20, 'class' => 'formfield text_field' %></p>  
3 -  
4 -<p class='formfield text_field'><label for="address"><%= _('Address') %></label><br/>  
5 -<%= text_field 'enterprise', 'address', 'size' => 50 %></p>  
6 -  
7 -<p class='formfield text_field'><label for="contact_phone"><%= _('Contact Phone') %></label><br/>  
8 -<%= text_field 'enterprise', 'contact_phone', 'size' => 20 %></p>  
9 -  
10 -<p class='formfield text_field'><label for="contact_person"><%= _('Contact Person') %></label><br/>  
11 -<%= text_field 'organization_info', 'contact_person', 'size' => 20 %></p>  
12 -  
13 -<p class='formfield text_field'><label for="acronym"><%= _('Acronym') %></label><br/>  
14 -<%= text_field 'organization_info', 'acronym', 'size' => 20 %></p>  
15 -  
16 -<p class='formfield text_field'><label for="foundation_year"><%= _('Foundation Year') %></label><br/>  
17 -<%= text_field 'organization_info', 'foundation_year', 'size' => 20 %></p>  
18 -  
19 -<p class='formfield text_field'><label for="legal_form"><%= _('Legal Form') %></label><br/>  
20 -<%= text_field 'organization_info', 'legal_form', 'size' => 20 %></p>  
21 -  
22 -<p class='formfield text_field'><label for="economic_activity"><%= _('Economic Activity') %></label><br/>  
23 -<%= text_field 'organization_info', 'economic_activity', 'size' => 20 %></p>  
24 -  
25 -<p class='formfield text_area'><label for="management_information"><%= _('Management Information') %></label><br/>  
26 -<%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %></p>  
27 -  
28 -<p class='formfield select'><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 class='formfield text_field'><label for="tag_list"><%= _('Tags') %></label><br/>  
32 -<%= text_field 'enterprise', 'tag_list', 'size' => 20 %></p>  
app/views/profile_editor/organization_info.rhtml
1 -<p class='formfield text_field'><label class='formlabel' for="name"><%= _('Name') %></label>  
2 -<%= text_field 'enterprise', 'name', 'size' => 20, 'class' => 'formfield text_field' %></p>  
3 -  
4 -<p class='formfield text_field'><label class='formlabel' for="address"><%= _('Address') %></label>  
5 -<%= text_field 'enterprise', 'address', 'size' => 50 , :id => 'address'%></p>  
6 -  
7 -<p class='formfield text_field'><label for="contact_phone"><%= _('Contact Phone') %></label><br/>  
8 -<%= text_field 'enterprise', 'contact_phone', 'size' => 20 %></p>  
9 -  
10 -<p class='formfield text_field'><label for="contact_person"><%= _('Contact Person') %></label><br/>  
11 -<%= text_field 'organization_info', 'contact_person', 'size' => 20 %></p>  
12 -  
13 -<p class='formfield text_field'><label for="acronym"><%= _('Acronym') %></label><br/>  
14 -<%= text_field 'organization_info', 'acronym', 'size' => 20 %></p>  
15 -  
16 -<p class='formfield text_field'><label for="foundation_year"><%= _('Foundation Year') %></label><br/>  
17 -<%= text_field 'organization_info', 'foundation_year', 'size' => 20 %></p>  
18 -  
19 -<p class='formfield text_field'><label for="legal_form"><%= _('Legal Form') %></label><br/>  
20 -<%= text_field 'organization_info', 'legal_form', 'size' => 20 %></p>  
21 -  
22 -<p class='formfield text_field'><label for="economic_activity"><%= _('Economic Activity') %></label><br/>  
23 -<%= text_field 'organization_info', 'economic_activity', 'size' => 20 %></p>  
24 -  
25 -<p class='formfield text_area'><label for="management_information"><%= _('Management Information') %></label><br/>  
26 -<%= text_area 'organization_info', 'management_information', 'cols' => 40, 'rows' => 20 %></p>  
27 -  
28 -<p class='formfield text_field'><label for="tag_list"><%= _('Tags') %></label><br/>  
29 -<%= text_field 'enterprise', 'tag_list', 'size' => 20 %></p> 1 +<% labelled_form_for :info, @info do |f| %>
  2 + <%= f.text_field(:contact_person) %>
  3 + <%= f.text_field(:acronym) %>
  4 + <%= f.text_field(:foundation_year) %>
  5 + <%= f.text_field(:legal_form) %>
  6 + <%= f.text_field(:economic_activity) %>
  7 + <%= f.text_area(:management_information) %>
  8 + <%= display_submit_tag(_('Save')) %>
  9 +<% end %>
app/views/profile_editor/person_info.rhtml
1 <h2><%= _('Edit person info') %></h2> 1 <h2><%= _('Edit person info') %></h2>
2 2
3 -<% form_for :info, @info do |f| %>  
4 -  
5 - <%= display_form_field(_('Name'), f.text_field(:name)) %>  
6 -  
7 - <%= display_form_field(_('Contact Information'), f.text_area(:contact_information, :rows => 5)) %>  
8 - <%= display_form_field(_('Birth day'), f.date_select(:birth_date, :start_year => 1930, :use_month_numbers => true, :order => [:day, :month, :year])) %> 3 +<% labelled_form_for :info, @info do |f| %>
9 4
  5 + <%= f.text_field(:name) %>
10 <%= _('Sex: ') %> 6 <%= _('Sex: ') %>
11 - <%= display_form_field(_('Male'), f.radio_button(:sex, 'male')) %>  
12 - <%= display_form_field(_('Female'), f.radio_button(:sex, 'female')) %>  
13 - <%= display_form_field(_('Address'), f.text_area(:address, :rows => 3)) %>  
14 - <%= display_form_field(_('City'), f.text_field(:city)) %>  
15 - <%= display_form_field(_('State'), f.text_field(:state)) %>  
16 - <%= display_form_field(_('Country'), f.text_field(:country)) %>  
17 -  
18 - <%= submit_tag _('Save') %> 7 + <%= display_form_field(_('Male'), radio_button(:info, :sex, 'male')) %>
  8 + <%= display_form_field(_('Female'), radio_button(:info, :sex, 'female')) %>
  9 + <%= f.text_field(:city) %>
  10 + <%= f.text_field(:state) %>
  11 + <%= f.text_field(:country) %>
  12 + <%= display_submit_tag _('Save') %>
19 13
20 <% end %> 14 <% end %>