Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
O
OHR Support
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
97
Issues
97
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
OHR Support
Commits
8e3d4da3
Commit
8e3d4da3
authored
Apr 19, 2011
by
Eric Davis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[#802] Show groups in the watchers partial and users autocomplete
parent
65e79956
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
3 deletions
+23
-3
auto_completes_controller.rb
app/controllers/auto_completes_controller.rb
+7
-1
_watchers.rhtml
app/views/watchers/_watchers.rhtml
+2
-2
auto_completes_controller_test.rb
test/functional/auto_completes_controller_test.rb
+14
-0
No files found.
app/controllers/auto_completes_controller.rb
View file @
8e3d4da3
...
@@ -48,8 +48,14 @@ class AutoCompletesController < ApplicationController
...
@@ -48,8 +48,14 @@ class AutoCompletesController < ApplicationController
end
end
@removed_users
||=
[]
@removed_users
||=
[]
if
params
[
:include_groups
]
user_finder
=
Principal
else
user_finder
=
User
end
@users
=
Us
er
.
active
.
like
(
params
[
:q
]).
find
(
:all
,
:limit
=>
100
)
-
@removed_users
@users
=
user_find
er
.
active
.
like
(
params
[
:q
]).
find
(
:all
,
:limit
=>
100
)
-
@removed_users
render
:layout
=>
false
render
:layout
=>
false
end
end
...
...
app/views/watchers/_watchers.rhtml
View file @
8e3d4da3
...
@@ -12,12 +12,12 @@
...
@@ -12,12 +12,12 @@
:object_id
=>
watched
},
:object_id
=>
watched
},
:method
=>
:post
,
:method
=>
:post
,
:html
=>
{
:id
=>
'new-watcher-form'
,
:style
=>
'display:none;'
})
do
|
f
|
%>
:html
=>
{
:id
=>
'new-watcher-form'
,
:style
=>
'display:none;'
})
do
|
f
|
%>
<%
users
=
User
.
active
.
find
(
:all
,
:limit
=>
25
)
-
watched
.
watcher_users
%>
<%
users
=
Principal
.
active
.
find
(
:all
,
:limit
=>
25
)
-
watched
.
watcher_users
%>
<p>
<%=
label_tag
"user_search"
,
l
(
:label_user_search
)
%><%=
text_field_tag
'user_search'
,
nil
,
:style
=>
"width:98%;"
%>
</p>
<p>
<%=
label_tag
"user_search"
,
l
(
:label_user_search
)
%><%=
text_field_tag
'user_search'
,
nil
,
:style
=>
"width:98%;"
%>
</p>
<%=
observe_field
(
:user_search
,
<%=
observe_field
(
:user_search
,
:frequency
=>
0.5
,
:frequency
=>
0.5
,
:update
=>
:users
,
:update
=>
:users
,
:url
=>
auto_complete_users_path
(
:remove_watchers
=>
watched
.
id
,
:klass
=>
watched
.
class
),
:url
=>
auto_complete_users_path
(
:remove_watchers
=>
watched
.
id
,
:klass
=>
watched
.
class
,
:include_groups
=>
true
),
:with
=>
'q'
)
:with
=>
'q'
)
%>
%>
...
...
test/functional/auto_completes_controller_test.rb
View file @
8e3d4da3
...
@@ -92,6 +92,20 @@ class AutoCompletesControllerTest < ActionController::TestCase
...
@@ -92,6 +92,20 @@ class AutoCompletesControllerTest < ActionController::TestCase
end
end
end
end
context
"including groups"
do
setup
do
@group
=
Group
.
generate
(
:lastname
=>
'Complete Group'
).
reload
get
:users
,
:q
=>
'complete'
,
:include_groups
=>
true
end
should_respond_with
:success
should
"include matching groups"
do
assert_select
"input[type=checkbox][value=?]"
,
@group
.
id
end
end
context
"restrict by removing group members"
do
context
"restrict by removing group members"
do
setup
do
setup
do
@group
=
Group
.
first
@group
=
Group
.
first
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment