[Git][noosfero/noosfero][master] 4 commits: Fixes profile members search to use a lowercase query

Rodrigo Souto gitlab at mg.gitlab.com
Mon May 7 16:05:41 BRT 2018


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
0778bd3c by Gabriel Silva at 2018-05-03T14:59:51Z
Fixes profile members search to use a lowercase query

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>

- - - - -
98dd1979 by Gabriel Silva at 2018-05-03T15:49:30Z
Removes method call to Object#display

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>

- - - - -
33340634 by Gabriel Silva at 2018-05-03T17:30:58Z
Fixes style on members-list table

Signed-off-by: Gabriel Silva <gabriel93.silva at gmail.com>

- - - - -
c1eb8c8b by Rodrigo Souto at 2018-05-07T19:05:35Z
Merge branch 'enterprise-members' into 'master'

Fixes ProfileMembers#search_users

See merge request noosfero/noosfero!1455
- - - - -


9 changed files:

- app/controllers/my_profile/profile_members_controller.rb
- app/views/blocks/profile_info_actions/_common.html.erb
- app/views/cms/_text_article.html.erb
- app/views/profile_members/_members_list.html.erb
- app/views/shared/_change_image.html.erb
- app/views/shared/_lead_and_body.html.erb
- app/views/shared/_show_thumbnail.html.erb
- public/stylesheets/profile-members.scss
- test/functional/profile_members_controller_test.rb


Changes:

=====================================
app/controllers/my_profile/profile_members_controller.rb
=====================================
--- a/app/controllers/my_profile/profile_members_controller.rb
+++ b/app/controllers/my_profile/profile_members_controller.rb
@@ -139,7 +139,8 @@ class ProfileMembersController < MyProfileController
 
   def search_user
     role = Role.find(params[:role])
-    render :text => environment.people.where('LOWER(name) LIKE ? OR LOWER(identifier) LIKE ?', "%#{params['q_'+role.key]}%", "%#{params['q_'+role.key]}%").
+    q = params['q_'+role.key].try(:downcase)
+    render :text => environment.people.where('LOWER(name) LIKE ? OR LOWER(identifier) LIKE ?', "%#{q}%", "%#{q}%").
       select { |person| !profile.members_by_role(role).include?(person) }.
       map {|person| {:id => person.id, :name => person.name} }.
       to_json


=====================================
app/views/blocks/profile_info_actions/_common.html.erb
=====================================
--- a/app/views/blocks/profile_info_actions/_common.html.erb
+++ b/app/views/blocks/profile_info_actions/_common.html.erb
@@ -8,6 +8,7 @@
         <%= link_to(font_awesome(:undo, _('Unfollow')), {:profile => profile.identifier, :controller => 'profile', :action => 'unfollow'}, :method => :post, :id => 'action-unfollow', :title => _("Unfollow")) %>
       </li>
     <% end %>
+  <li>
     <div id="circles-container" style="display: none;">
     </div>
   </li>


=====================================
app/views/cms/_text_article.html.erb
=====================================
--- a/app/views/cms/_text_article.html.erb
+++ b/app/views/cms/_text_article.html.erb
@@ -7,4 +7,3 @@
 <%= render :partial => 'translatable' %>
 
 <%= render :partial => 'shared/lead_and_body' %>
-


=====================================
app/views/profile_members/_members_list.html.erb
=====================================
--- a/app/views/profile_members/_members_list.html.erb
+++ b/app/views/profile_members/_members_list.html.erb
@@ -7,7 +7,6 @@
 <h3><%= title %></h3>
 
 <table>
-  <col width="1">
   <tr>
     <th><%= check_box_tag 'checkbox-all', 1, false, :onClick => "toggle(this)"  %></th>
     <th><%= _('Member') %></th>


=====================================
app/views/shared/_change_image.html.erb
=====================================
--- a/app/views/shared/_change_image.html.erb
+++ b/app/views/shared/_change_image.html.erb
@@ -1,6 +1,7 @@
 <div class='file-fieldset'>
 
-    <div id='change-image' style='<%= "display:#{display}" if display %>' >
+    <div id='change-image'
+         style='<%= "display:#{display}" if local_assigns.has_key?(:display) %>'>
 
     <%= button_to_function :plus, _('Add image'), "add_new_image(this)",
                            class: "button with-text icon-plus" %>


=====================================
app/views/shared/_lead_and_body.html.erb
=====================================
--- a/app/views/shared/_lead_and_body.html.erb
+++ b/app/views/shared/_lead_and_body.html.erb
@@ -8,7 +8,7 @@
 <% f ||= false %>
 
 <% if @article %>
-        <%= file_field_or_thumbnail(_('Image:'), @article.image, 'article[image_builder]', 'article') %>
+  <%= file_field_or_thumbnail(_('Image:'), @article.image, 'article[image_builder]', 'article') %>
 <% end %>
 
 <%= button :add, _("Add Lead"), '#', :class => "lead-button", :article_id => "#article-lead-"+lead_id.to_s, :style => "margin-left: 0px;" %>


=====================================
app/views/shared/_show_thumbnail.html.erb
=====================================
--- a/app/views/shared/_show_thumbnail.html.erb
+++ b/app/views/shared/_show_thumbnail.html.erb
@@ -1,9 +1,10 @@
 <div>
   <div id='actual-image'><%= image_tag(image.public_filename(:thumb)) %></div>
-  <%= render :partial => 'shared/change_image', :locals => { :for_attr => for_attr, :display => 'none', :type => type } %>
+  <%= render partial: 'shared/change_image',
+             locals: { for_attr: for_attr, display: 'none', type: type } %>
 </div>
 
-<%= button_to_function(:photos, _('Change image'), 'display_change_image()', :id => 'change-image-link' ) %>
+<%= button_to_function(:photos, _('Change image'), 'display_change_image()', id: 'change-image-link' ) %>
 
 <% if image.present? && removable %>
   <div id='image-builder-remove-checkbox'>


=====================================
public/stylesheets/profile-members.scss
=====================================
--- a/public/stylesheets/profile-members.scss
+++ b/public/stylesheets/profile-members.scss
@@ -21,10 +21,16 @@
 .controller-profile_members .draggable-user {
   cursor: move;
 }
-.controller-profile_members #members-list.add-members {
-  float: right;
-  width: 30%;
-  text-align: center;
+.controller-profile_members #members-list {
+  table th:first-child {
+    width: 10px;
+  }
+
+  .add-members {
+    float: right;
+    width: 30%;
+    text-align: center;
+  }
 }
 .controller-profile_members .members-buttons-cell {
   width: 60px;


=====================================
test/functional/profile_members_controller_test.rb
=====================================
--- a/test/functional/profile_members_controller_test.rb
+++ b/test/functional/profile_members_controller_test.rb
@@ -287,7 +287,7 @@ class ProfileMembersControllerTest < ActionController::TestCase
     p7.name = 'Bli'
     p7.save!
 
-    get :search_user, :profile => e.identifier, 'q_'+r1.key => 'per', :role => r1.id
+    get :search_user, :profile => e.identifier, 'q_'+r1.key => 'Per', :role => r1.id
     assert_match /#{p1.name}/, @response.body
     assert_match /#{p2.name}/, @response.body
     assert_no_match /#{p3.name}/, @response.body



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/eeaf0019ad4a12e4c66e9cb8da9e29bb7aaebb10...c1eb8c8b9d2814b9184f90cceca26bad152dc02f

-- 
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/eeaf0019ad4a12e4c66e9cb8da9e29bb7aaebb10...c1eb8c8b9d2814b9184f90cceca26bad152dc02f
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180507/bd9c2cdc/attachment-0001.html>


More information about the Noosfero-dev mailing list