Commit 06e61860417904800c27d56e7d12c140055e2ae5
Exists in
master
and in
23 other branches
Merge branch 'stable'
Showing
4 changed files
with
22 additions
and
3 deletions
Show diff stats
app/controllers/my_profile/profile_members_controller.rb
| @@ -76,7 +76,11 @@ class ProfileMembersController < MyProfileController | @@ -76,7 +76,11 @@ class ProfileMembersController < MyProfileController | ||
| 76 | end | 76 | end |
| 77 | 77 | ||
| 78 | def find_users | 78 | def find_users |
| 79 | - @users_found = Person.find_by_contents(params[:query] + '*') | 79 | + if !params[:query] || params[:query].length <= 2 |
| 80 | + @users_found = [] | ||
| 81 | + else | ||
| 82 | + @users_found = Person.find_by_contents(params[:query] + '*') | ||
| 83 | + end | ||
| 80 | render :layout => false | 84 | render :layout => false |
| 81 | end | 85 | end |
| 82 | 86 |
app/views/profile_members/add_members.rhtml
| 1 | <h2><%= _('Add members to %s') % profile.name %></h2> | 1 | <h2><%= _('Add members to %s') % profile.name %></h2> |
| 2 | 2 | ||
| 3 | <% form_remote_tag :url => {:action => 'find_users', :profile => profile.identifier}, :update => 'users-list', :loading => '$("users-list").addClassName("loading")', :complete => '$("users-list").removeClassName("loading")' do %> | 3 | <% form_remote_tag :url => {:action => 'find_users', :profile => profile.identifier}, :update => 'users-list', :loading => '$("users-list").addClassName("loading")', :complete => '$("users-list").removeClassName("loading")' do %> |
| 4 | - <%= text_field_tag('query') %> | 4 | + <%= text_field_tag('query', '', :autocomplete => 'off') %> |
| 5 | <%= submit_tag(_('Search')) %> | 5 | <%= submit_tag(_('Search')) %> |
| 6 | <% end %> | 6 | <% end %> |
| 7 | 7 | ||
| 8 | <%= observe_field('query', :url => {:action => 'find_users', :profile => profile.identifier}, :update => 'users-list', :frequency => 1, :with => 'query', :condition => '$("query").value.length > 2', :loading => '$("users-list").addClassName("loading")', :complete => '$("users-list").removeClassName("loading")') %> | 8 | <%= observe_field('query', :url => {:action => 'find_users', :profile => profile.identifier}, :update => 'users-list', :frequency => 1, :with => 'query', :condition => '$("query").value.length > 2', :loading => '$("users-list").addClassName("loading")', :complete => '$("users-list").removeClassName("loading")') %> |
| 9 | +<%= observe_field('query', :frequency => 1, :condition => '$("query").value.length <= 2', :function => '$("users-list").update($("empty-query").innerHTML)') %> | ||
| 9 | 10 | ||
| 10 | <div id="users-list"> | 11 | <div id="users-list"> |
| 11 | <%= render :partial => 'find_users' %> | 12 | <%= render :partial => 'find_users' %> |
| 12 | </div> | 13 | </div> |
| 13 | 14 | ||
| 15 | +<div id='empty-query' style='display: none'> | ||
| 16 | + <%= render :partial => 'find_users' %> | ||
| 17 | +</div> | ||
| 18 | + | ||
| 14 | <div id="members-list" class="add-members"> | 19 | <div id="members-list" class="add-members"> |
| 15 | <%= render :partial => 'members_list' %> | 20 | <%= render :partial => 'members_list' %> |
| 16 | </div> | 21 | </div> |
app/views/profile_members/find_users.rhtml
| @@ -25,4 +25,11 @@ | @@ -25,4 +25,11 @@ | ||
| 25 | </td> | 25 | </td> |
| 26 | </tr> | 26 | </tr> |
| 27 | <% end if @users_found %> | 27 | <% end if @users_found %> |
| 28 | + <% if !params[:query] || params[:query].length <= 2 %> | ||
| 29 | + <tr> | ||
| 30 | + <td style='text-align: center'> | ||
| 31 | + <em><%= _('You must type at least 3 characters') %></em> | ||
| 32 | + </td> | ||
| 33 | + </tr> | ||
| 34 | + <% end %> | ||
| 28 | </table> | 35 | </table> |
po/pt_BR/noosfero.po
| @@ -13,7 +13,7 @@ msgid "" | @@ -13,7 +13,7 @@ msgid "" | ||
| 13 | msgstr "" | 13 | msgstr "" |
| 14 | "Project-Id-Version: noosfero 0.19.0\n" | 14 | "Project-Id-Version: noosfero 0.19.0\n" |
| 15 | "POT-Creation-Date: 2009-08-04 14:28-0300\n" | 15 | "POT-Creation-Date: 2009-08-04 14:28-0300\n" |
| 16 | -"PO-Revision-Date: 2009-08-07 12:20-0300\n" | 16 | +"PO-Revision-Date: 2009-08-07 17:47-0300\n" |
| 17 | "Last-Translator: Joenio Costa <joenio@colivre.coop.br>\n" | 17 | "Last-Translator: Joenio Costa <joenio@colivre.coop.br>\n" |
| 18 | "Language-Team: LANGUAGE <LL@li.org>\n" | 18 | "Language-Team: LANGUAGE <LL@li.org>\n" |
| 19 | "MIME-Version: 1.0\n" | 19 | "MIME-Version: 1.0\n" |
| @@ -6668,3 +6668,6 @@ msgstr "Manutenção do sistema" | @@ -6668,3 +6668,6 @@ msgstr "Manutenção do sistema" | ||
| 6668 | msgid "This system is under maintainance. It should be back in a few hours." | 6668 | msgid "This system is under maintainance. It should be back in a few hours." |
| 6669 | msgstr "" | 6669 | msgstr "" |
| 6670 | "Este sistema está em manutenção. Ele deve estar de volta em algumas horas." | 6670 | "Este sistema está em manutenção. Ele deve estar de volta em algumas horas." |
| 6671 | + | ||
| 6672 | +msgid "You must type at least 3 characters" | ||
| 6673 | +msgstr "Você precisa digitar pelo menos 3 caracteres" |