Skip to content
This repository

User admin #1934

Closed
wants to merge 2 commits into from

3 participants

Marek Uģis Ozols Philip Arndt
Marek

hello,
I add search stuff on users because, if you have small number of users you don't notice change,
but if you have many users (100.. and more) you really appreciate search ability.. .)

depends on #1922

Uģis Ozols
Owner

I'm not sure we really need this but I guess it makes life easier when you have many users.

@robyurkowski @parndt

Philip Arndt
Owner

Makes sense, I think

Philip Arndt
Owner

Merged into cec1a57 thanks :)

Philip Arndt parndt closed this September 10, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4  authentication/app/models/refinery/user.rb
... ...
@@ -1,5 +1,6 @@
1 1
 require 'devise'
2 2
 require 'friendly_id'
  3
+require 'acts_as_indexed'
3 4
 
4 5
 module Refinery
5 6
   class User < Refinery::Core::BaseModel
@@ -10,6 +11,9 @@ class User < Refinery::Core::BaseModel
10 11
     has_many :plugins, :class_name => "UserPlugin", :order => "position ASC", :dependent => :destroy
11 12
     friendly_id :username, :use => [:slugged]
12 13
 
  14
+    # Docs for acts_as_indexed http://github.com/dougal/acts_as_indexed
  15
+    acts_as_indexed :fields => [:username, :email]
  16
+
13 17
     # Include default devise modules. Others available are:
14 18
     # :token_authenticatable, :confirmable, :lockable and :timeoutable
15 19
     if self.respond_to?(:devise)
3  authentication/app/views/refinery/admin/users/_actions.html.erb
... ...
@@ -1,5 +1,8 @@
1 1
 <ul>
2 2
   <li>
  3
+    <%= render '/refinery/admin/search', :url => refinery.admin_users_path %>
  4
+  </li>
  5
+  <li>
3 6
     <%= link_to t('.create_new_user'),
4 7
                 refinery.new_admin_user_path, :class => "add_icon" %>
5 8
   </li>
10  authentication/app/views/refinery/admin/users/_records.html.erb
... ...
@@ -1,3 +1,13 @@
  1
+<% if searching? %>
  2
+  <%= link_to t('cancel_search', :scope => 'refinery.admin.search'), refinery.admin_users_path, :class => "cancel-search" %>
  3
+  <h2><%= t('results_for_html', :scope => 'refinery.admin.search', :query => h(params[:search])).html_safe %></h2>
  4
+<% end %>
  5
+<% if @users.any? %>
1 6
 <div class='pagination_container'>
2 7
   <%= render 'users' %>
3 8
 </div>
  9
+<% else %>
  10
+  <p>
  11
+    <%= t('no_results', :scope => 'refinery.admin.search') %>
  12
+  </p>
  13
+<% end %>
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.