<% if @department.people.any? %> <% if User.current.allowed_people_to?(:edit_people) %> <% end %> <% @department.people.sort.each do |person| %> <% if User.current.allowed_people_to?(:edit_people) %> <% end %> <% end %>
<%= l(:label_user) %>
<%= link_to_user person %> <%= delete_link url_for(:action => "remove_person", :id => @department, :person_id => person), :remote => true %>
<% else %>

<%= l(:label_no_data) %>

<% end %>
<% people = Person.active.where(:type => 'User').not_in_department(@department).all(:limit => 100) %> <% if people.any? %> <%= form_for(@department, :remote => true, :url => {:action => "add_people", :id => @department}, :html => {:method => :post, :class => "select-users"}) do |f| %>
<%=l(:label_user_new)%>

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

<%= javascript_tag "observeSearchfield('user_search', 'people', '#{ escape_javascript url_for(:action => "autocomplete_for_person", :id => @department)}')" %>
<%= principals_check_box_tags 'person_ids[]', people %>

<%= submit_tag l(:button_add) %>

<% end %> <% end %>