Commit 2ac0268015376b77106223227de4de52d9012886
1 parent
c091bfbf
Exists in
master
and in
29 other branches
ActionItem182: messages for mandatory fields
Showing
16 changed files
with
53 additions
and
1 deletions
Show diff stats
app/helpers/forms_helper.rb
... | ... | @@ -100,6 +100,13 @@ module FormsHelper |
100 | 100 | content_tag('span', content, :class => 'required-field') |
101 | 101 | end |
102 | 102 | |
103 | + def required_fields_message | |
104 | + content_tag('p', content_tag('span', | |
105 | + _("The <label class='pseudoformlabel'>highlighted</label> fields are mandatory."), | |
106 | + :class => 'required-field' | |
107 | + )) | |
108 | + end | |
109 | + | |
103 | 110 | protected |
104 | 111 | def self.next_id_number |
105 | 112 | if defined? @@id_num | ... | ... |
app/views/account/_signup_form.rhtml
1 | 1 | <%= error_messages_for :user %> |
2 | + | |
2 | 3 | <% labelled_form_for :user, @user, |
3 | 4 | :html => { :help=>_('Fill all this fields to join in this environment. <p/> If you forgot your password, do not create a new account, click on the "<b>I forgot my password!</b>" link. ;-)'), :id => 'profile-data' |
4 | 5 | } do |f| -%> |
5 | 6 | |
7 | +<%= required_fields_message %> | |
8 | + | |
6 | 9 | <%= required f.text_field(:login, |
7 | 10 | :onchange => 'this.value = convToValidLogin( this.value )') %> |
8 | 11 | <small><%= help %></small> | ... | ... |
app/views/categories/_form.rhtml
1 | 1 | <%= error_messages_for 'category' %> |
2 | 2 | |
3 | 3 | <% labelled_form_for 'category', @category, :html => { :multipart => true} do |f| %> |
4 | + | |
5 | + <%= required_fields_message %> | |
6 | + | |
4 | 7 | <% if @category.new_record? %> |
5 | 8 | <% if @category.parent %> |
6 | 9 | <%= hidden_field_tag('parent_id', @category.parent.id) %> | ... | ... |
app/views/cms/_event.rhtml
app/views/cms/_folder.rhtml
app/views/cms/_rss_feed.rhtml
app/views/cms/_textile_article.rhtml
app/views/cms/_tiny_mce_article.rhtml
app/views/cms/_uploaded_file.rhtml
1 | +<%= required_fields_message %> | |
2 | + | |
1 | 3 | <%= required labelled_form_field(_("Select the file you want to upload (max size %s).") % UploadedFile.max_size.to_humanreadable, file_field(:article, :uploaded_data)) %> |
2 | 4 | |
3 | 5 | <%= labelled_form_field(_('Describe this file:'), text_area(:article, :abstract)) %> | ... | ... |
app/views/contact/new.rhtml
... | ... | @@ -2,8 +2,11 @@ |
2 | 2 | |
3 | 3 | <%= error_messages_for 'contact' %> |
4 | 4 | |
5 | + | |
5 | 6 | <% labelled_form_for :contact, @contact do |f| %> |
6 | 7 | |
8 | + <%= required_fields_message %> | |
9 | + | |
7 | 10 | <%= f.text_field :name %> |
8 | 11 | <%= f.text_field :email %> |
9 | 12 | <%= labelled_form_field _('City and state'), select_city(true) %> | ... | ... |
app/views/content_viewer/_comment_form.rhtml
app/views/manage_products/_form.rhtml
1 | 1 | <%= error_messages_for :product %> <br/> |
2 | 2 | |
3 | 3 | <% form_for :product, @product, :html => {:multipart => true }, :url => {:action => mode} do |f| %> |
4 | + <%= required_fields_message %> | |
5 | + | |
4 | 6 | <%= required display_form_field( _('Name:'), f.text_field(:name) ) %> |
5 | 7 | <%= display_form_field( _('Price:'), f.text_field(:price) ) %> |
6 | 8 | <%= display_form_field( _('Description:'), f.text_area(:description, :rows => 10) ) %> | ... | ... |
app/views/memberships/new_community.rhtml
app/views/role/_form.rhtml
public/stylesheets/forms.css
test/unit/forms_helper_test.rb
... | ... | @@ -10,4 +10,20 @@ class FormsHelperTest < Test::Unit::TestCase |
10 | 10 | assert_tag_in_string content, :tag => 'span', :attributes => {:class => 'required-field'} |
11 | 11 | end |
12 | 12 | |
13 | + should 'wrapper required fields message in <span class=required-field>' do | |
14 | + content = required_fields_message() | |
15 | + assert_tag_in_string content, :tag => 'span', :attributes => {:class => 'required-field'} | |
16 | + end | |
17 | + | |
18 | + should 'wrapper highlighted in label pseudoformlabel' do | |
19 | + content = required_fields_message() | |
20 | + assert_tag_in_string content, :tag => 'label', :content => 'highlighted', :attributes => {:class => 'pseudoformlabel'} | |
21 | + end | |
22 | + | |
23 | + protected | |
24 | + | |
25 | + def _(text) | |
26 | + text | |
27 | + end | |
28 | + | |
13 | 29 | end | ... | ... |