<%= link_to_function(l(:button_add), "$('new-watcher-form').toggle();") if User.current.allowed_to?("add_#{watched.class.name.underscore}_watchers".to_sym, @project) %>

<%= l(:label_issue_watchers) %> (<%= watched.watcher_users.size %>)

<% if User.current.allowed_to?("add_#{watched.class.name.underscore}_watchers".to_sym, @project) %> <% remote_form_for(:watcher, @watcher, :url => {:controller => 'watchers', :action => 'new', :object_type => watched.class.name.underscore, :object_id => watched}, :method => :post, :html => {:id => 'new-watcher-form', :style => 'display:none;'}) do |f| %> <% users = Principal.active.find(:all, :limit => 25) - watched.watcher_users %>

<%= label_tag "user_search", l(:label_user_search) %><%= text_field_tag 'user_search', nil, :style => "width:98%;" %>

<%= observe_field(:user_search, :frequency => 0.5, :update => :users, :url => auto_complete_users_path(:remove_watchers => watched.id, :klass => watched.class, :include_groups => true), :with => 'q') %>
<%= principals_check_box_tags 'user_ids[]', users %>

<%= submit_tag l(:button_add) %> <%= toggle_link l(:button_cancel), 'new-watcher-form'%>

<% end %> <% end %> <%= watchers_list(watched) %>