Commit 0f49bd450aa2a2b5418904b7383ed37782e39af5

Authored by Daniela Feitosa
1 parent 69e0f1f2

ActionItem862: small bug fixes

  * removing links to edit template on manage templates
  * removing mark for required from non-formlabel labels
  * fix: only one error message for each field
  * fixing problem with translation
app/models/profile.rb
... ... @@ -44,6 +44,11 @@ class Profile < ActiveRecord::Base
44 44  
45 45 acts_as_searchable :additional_fields => [ :extra_data_for_index ]
46 46  
  47 + # FIXME ugly workaround
  48 + def self.human_attribute_name(attrib)
  49 + _(self.superclass.human_attribute_name(attrib))
  50 + end
  51 +
47 52 class_inheritable_accessor :extra_index_methods
48 53 self.extra_index_methods = []
49 54  
... ... @@ -158,7 +163,7 @@ class Profile < ActiveRecord::Base
158 163 end
159 164  
160 165 validates_presence_of :identifier, :name
161   - validates_format_of :identifier, :with => IDENTIFIER_FORMAT
  166 + validates_format_of :identifier, :with => IDENTIFIER_FORMAT, :if => lambda { |profile| !profile.identifier.blank? }
162 167 validates_exclusion_of :identifier, :in => RESERVED_IDENTIFIERS
163 168 validates_uniqueness_of :identifier, :scope => :environment_id
164 169  
... ...
app/models/user.rb
... ... @@ -13,7 +13,7 @@ class User < ActiveRecord::Base
13 13 case attrib.to_sym
14 14 when :login: return _('Username')
15 15 when :email: return _('e-Mail')
16   - else self.superclass.human_attribute_name(attrib)
  16 + else _(self.superclass.human_attribute_name(attrib))
17 17 end
18 18 end
19 19  
... ... @@ -43,16 +43,16 @@ class User < ActiveRecord::Base
43 43 attr_accessor :password
44 44  
45 45 validates_presence_of :login, :email
46   - validates_format_of :login, :with => Profile::IDENTIFIER_FORMAT
  46 + validates_format_of :login, :with => Profile::IDENTIFIER_FORMAT, :if => (lambda {|user| !user.login.blank?})
47 47 validates_presence_of :password, :if => :password_required?
48   - validates_presence_of :password_confirmation, :if => :password_required?
49   - validates_length_of :password, :within => 4..40, :if => :password_required?
  48 + validates_presence_of :password_confirmation, :if => :password_required?, :if => (lambda {|user| !user.password.blank?})
  49 + validates_length_of :password, :within => 4..40, :if => :password_required?, :if => (lambda {|user| !user.password.blank?})
50 50 validates_confirmation_of :password, :if => :password_required?
51   - validates_length_of :login, :within => 2..40
52   - validates_length_of :email, :within => 3..100
  51 + validates_length_of :login, :within => 2..40, :if => (lambda {|user| !user.login.blank?})
  52 + validates_length_of :email, :within => 3..100, :if => (lambda {|user| !user.email.blank?})
53 53 validates_uniqueness_of :login, :email, :case_sensitive => false
54 54 before_save :encrypt_password
55   - validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT
  55 + validates_format_of :email, :with => Noosfero::Constants::EMAIL_FORMAT, :if => (lambda {|user| !user.email.blank?})
56 56  
57 57 validates_inclusion_of :terms_accepted, :in => [ '1' ], :if => lambda { |u| ! u.terms_of_use.blank? }, :message => N_('%{fn} must be checked in order to signup.')
58 58  
... ...
app/views/admin_panel/manage_templates.rhtml
... ... @@ -22,12 +22,3 @@
22 22 <% end %>
23 23  
24 24 <% end %>
25   -
26   -<h1><%= _('Edit Templates') %></h1>
27   -
28   -<ul>
29   -<% @templates.each do |template| %>
30   - <li><%= link_to template.identifier, :controller => 'profile_editor', :profile => template.identifier %></li>
31   -<% end %>
32   -</ul>
33   -
... ...
app/views/features/_manage_enterprise_fields.rhtml
1   -<h2><%= _('Manage enterprise fields') %></h2>
  1 +<h2><%= __('Manage enterprise fields') %></h2>
2 2  
3 3 <% labelled_form_for(:environment, @environment, :url => {:action => 'manage_enterprise_fields'}) do |f| %>
4 4  
... ...
lib/unifreire_terminology.rb
... ... @@ -28,6 +28,7 @@ class UnifreireTerminology &lt; Noosfero::Terminology::Custom
28 28 'Enterprises in "%s"' => N_('Institutions in "%s"'),
29 29 'Register a new Enterprise' => N_('Register a new Institution'),
30 30 'Events' => N_('Schedule'),
  31 + 'Manage enterprise fields' => N_('Manage institutions fields'),
31 32 })
32 33 end
33 34  
... ...
public/stylesheets/forms.css
... ... @@ -76,10 +76,10 @@
76 76  
77 77 /*** REQUIRED FIELDS ***/
78 78  
79   -#content form .required-field label {
  79 +#content form .required-field label.formlabel {
80 80 font-weight: bold;
81 81 }
82 82  
83   -#content form .required-field label:after {
  83 +#content form .required-field label.formlabel:after {
84 84 content: ' (*)';
85 85 }
... ...