@@ -24,11 +24,6 class UsersController < ApplicationController | |||
|
24 | 24 | include CustomFieldsHelper |
|
25 | 25 | |
|
26 | 26 | def index |
|
27 | list | |
|
28 | render :action => 'list' unless request.xhr? | |
|
29 | end | |
|
30 | ||
|
31 | def list | |
|
32 | 27 | sort_init 'login', 'asc' |
|
33 | 28 | sort_update %w(login firstname lastname mail admin created_on last_login_on) |
|
34 | 29 | |
@@ -49,7 +44,7 class UsersController < ApplicationController | |||
|
49 | 44 | :limit => @user_pages.items_per_page, |
|
50 | 45 | :offset => @user_pages.current.offset |
|
51 | 46 | |
|
52 |
render |
|
|
47 | render :layout => !request.xhr? | |
|
53 | 48 | end |
|
54 | 49 | |
|
55 | 50 | def show |
|
1 | NO CONTENT: file renamed from app/views/users/list.rhtml to app/views/users/index.rhtml |
@@ -157,7 +157,6 ActionController::Routing::Routes.draw do |map| | |||
|
157 | 157 | |
|
158 | 158 | map.with_options :controller => 'users' do |users| |
|
159 | 159 | users.with_options :conditions => {:method => :get} do |user_views| |
|
160 | user_views.connect 'users', :action => 'list' | |
|
161 | 160 | user_views.connect 'users', :action => 'index' |
|
162 | 161 | user_views.connect 'users/:id', :action => 'show', :id => /\d+/ |
|
163 | 162 | user_views.connect 'users/new', :action => 'add' |
@@ -35,40 +35,39 class UsersControllerTest < ActionController::TestCase | |||
|
35 | 35 | end |
|
36 | 36 | |
|
37 | 37 | def test_index_routing |
|
38 | #TODO: unify with list | |
|
39 | 38 | assert_generates( |
|
40 | 39 | '/users', |
|
41 | 40 | :controller => 'users', :action => 'index' |
|
42 | 41 | ) |
|
42 | assert_routing( | |
|
43 | {:method => :get, :path => '/users'}, | |
|
44 | :controller => 'users', :action => 'index' | |
|
45 | ) | |
|
46 | assert_recognizes( | |
|
47 | {:controller => 'users', :action => 'index'}, | |
|
48 | {:method => :get, :path => '/users'} | |
|
49 | ) | |
|
43 | 50 | end |
|
44 | 51 | |
|
45 | 52 | def test_index |
|
46 | 53 | get :index |
|
47 | 54 | assert_response :success |
|
48 |
assert_template ' |
|
|
49 | end | |
|
50 | ||
|
51 | def test_list_routing | |
|
52 | #TODO: rename action to index | |
|
53 | assert_routing( | |
|
54 | {:method => :get, :path => '/users'}, | |
|
55 | :controller => 'users', :action => 'list' | |
|
56 | ) | |
|
55 | assert_template 'index' | |
|
57 | 56 | end |
|
58 | 57 | |
|
59 |
def test_ |
|
|
60 |
get : |
|
|
58 | def test_index | |
|
59 | get :index | |
|
61 | 60 | assert_response :success |
|
62 |
assert_template ' |
|
|
61 | assert_template 'index' | |
|
63 | 62 | assert_not_nil assigns(:users) |
|
64 | 63 | # active users only |
|
65 | 64 | assert_nil assigns(:users).detect {|u| !u.active?} |
|
66 | 65 | end |
|
67 | 66 | |
|
68 |
def test_ |
|
|
69 |
get : |
|
|
67 | def test_index_with_name_filter | |
|
68 | get :index, :name => 'john' | |
|
70 | 69 | assert_response :success |
|
71 |
assert_template ' |
|
|
70 | assert_template 'index' | |
|
72 | 71 | users = assigns(:users) |
|
73 | 72 | assert_not_nil users |
|
74 | 73 | assert_equal 1, users.size |
General Comments 0
You need to be logged in to leave comments.
Login now