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