@@ -428,7 +428,10 class IssuesController < ApplicationController | |||
|
428 | 428 | |
|
429 | 429 | @priorities = IssuePriority.active |
|
430 | 430 | @allowed_statuses = @issue.new_statuses_allowed_to(User.current, @issue.new_record?) |
|
431 |
@available_watchers = |
|
|
431 | @available_watchers = @issue.watcher_users | |
|
432 | if @issue.project.users.count <= 20 | |
|
433 | @available_watchers = (@available_watchers + @issue.project.users.sort).uniq | |
|
434 | end | |
|
432 | 435 | end |
|
433 | 436 | |
|
434 | 437 | def check_for_default_issue_status |
@@ -30,6 +30,7 class WatchersController < ApplicationController | |||
|
30 | 30 | accept_api_auth :create, :destroy |
|
31 | 31 | |
|
32 | 32 | def new |
|
33 | @users = users_for_new_watcher | |
|
33 | 34 | end |
|
34 | 35 | |
|
35 | 36 | def create |
@@ -44,7 +45,7 class WatchersController < ApplicationController | |||
|
44 | 45 | end |
|
45 | 46 | respond_to do |format| |
|
46 | 47 | format.html { redirect_to_referer_or {render :text => 'Watcher added.', :layout => true}} |
|
47 | format.js | |
|
48 | format.js { @users = users_for_new_watcher } | |
|
48 | 49 | format.api { render_api_ok } |
|
49 | 50 | end |
|
50 | 51 | end |
@@ -66,10 +67,7 class WatchersController < ApplicationController | |||
|
66 | 67 | end |
|
67 | 68 | |
|
68 | 69 | def autocomplete_for_user |
|
69 | @users = User.active.sorted.like(params[:q]).limit(100).all | |
|
70 | if @watched | |
|
71 | @users -= @watched.watcher_users | |
|
72 | end | |
|
70 | @users = users_for_new_watcher | |
|
73 | 71 | render :layout => false |
|
74 | 72 | end |
|
75 | 73 | |
@@ -106,4 +104,17 class WatchersController < ApplicationController | |||
|
106 | 104 | format.js { render :partial => 'set_watcher', :locals => {:user => user, :watched => watchables} } |
|
107 | 105 | end |
|
108 | 106 | end |
|
107 | ||
|
108 | def users_for_new_watcher | |
|
109 | users = [] | |
|
110 | if params[:q].blank? && @project.present? | |
|
111 | users = @project.users.sorted | |
|
112 | else | |
|
113 | users = User.active.sorted.like(params[:q]).limit(100) | |
|
114 | end | |
|
115 | if @watched | |
|
116 | users -= @watched.watcher_users | |
|
117 | end | |
|
118 | users | |
|
119 | end | |
|
109 | 120 | end |
@@ -17,11 +17,7 | |||
|
17 | 17 | :project_id => @project) }')" %> |
|
18 | 18 | |
|
19 | 19 | <div id="users_for_watcher"> |
|
20 | <%= principals_check_box_tags( | |
|
21 | 'watcher[user_ids][]', | |
|
22 | (watched ? | |
|
23 | watched.addable_watcher_users : User.active.limit(100).all) | |
|
24 | ) %> | |
|
20 | <%= principals_check_box_tags('watcher[user_ids][]', users) %> | |
|
25 | 21 | </div> |
|
26 | 22 | |
|
27 | 23 | <p class="buttons"> |
@@ -1,2 +1,2 | |||
|
1 | $('#ajax-modal').html('<%= escape_javascript(render(:partial => 'watchers/new', :locals => {:watched => @watched})) %>'); | |
|
1 | $('#ajax-modal').html('<%= escape_javascript(render(:partial => 'watchers/new', :locals => {:watched => @watched, :users => @users})) %>'); | |
|
2 | 2 | $('#watchers').html('<%= escape_javascript(render(:partial => 'watchers/watchers', :locals => {:watched => @watched})) %>'); |
@@ -1,3 +1,3 | |||
|
1 | $('#ajax-modal').html('<%= escape_javascript(render :partial => 'watchers/new', :locals => {:watched => @watched}) %>'); | |
|
1 | $('#ajax-modal').html('<%= escape_javascript(render :partial => 'watchers/new', :locals => {:watched => @watched, :users => @users}) %>'); | |
|
2 | 2 | showModal('ajax-modal', '400px'); |
|
3 | 3 | $('#ajax-modal').addClass('new-watcher'); |
General Comments 0
You need to be logged in to leave comments.
Login now