Permalink
Browse files

fixes #68

  • Loading branch information...
kawasima committed Jul 11, 2012
1 parent 950b56f commit 164ab0fe9fec958b9f5453da56b3b8d89d35bfc5
@@ -108,4 +108,9 @@ def remove_test_case
format.json { render :json => { :status => true} }
end
end
+
+ def autocomplete
+ @users = @project.users.like(params[:q]).all(:limit => 100)
+ render :layout => false
+ end
end
@@ -0,0 +1,5 @@
+<ul>
+ <% for user in @users %>
+ <li class="jstree-draggable test-member" style="list-style:none; cursor: pointer" id="principal-<%=h user.id %>"><%= avatar user, :size=>16 %><%=h user %></li>
+ <% end %>
+</ul>
@@ -45,12 +45,24 @@
<div id="calendar-view" style="width: 100%"></div>
</fieldset>
<fieldset>
+ <p><%= label_tag "principal_search", l(:label_user_search) %><%= text_field_tag 'principal_search', nil %></p>
+ <%= observe_field(:principal_search,
+ :frequency => 0.5,
+ :update => :principals,
+ :url => { :controller => :impasse_test_plans, :action => :autocomplete, :project_id => @project },
+ :method => :get,
+ :before => '$("principal_search").addClassName("ajax-loading")',
+ :complete => '$("principal_search").removeClassName("ajax-loading")',
+ :with => 'q')
+ %>
<legend><%=l :label_member_plural %></legend>
- <ul id="principals">
- <% for principal in @project.principals %>
- <li class="jstree-draggable test-member" style="list-style:none; cursor: pointer" id="principal-<%=h principal.id %>"><%= avatar principal, :size=>16 %><%=h principal %></li>
- <% end %>
- </ul>
+ <div id="principals">
+ <ul>
+ <% for user in @project.users.all(:limit => 100) %>
+ <li class="jstree-draggable test-member" style="list-style:none; cursor: pointer" id="principal-<%=h user.id %>"><%= avatar user, :size=>16 %><%=h user %></li>
+ <% end %>
+ </ul>
+ </div>
</fieldset>
</div>
</div>
View
@@ -27,7 +27,7 @@
project_module :impasse do
permission :view_testcases, {
'impasse_test_case' => [:index, :show, :list, :keywords],
- 'impasse_test_plans' => [:index, :show, :list, :tc_assign, :user_assign, :statistics],
+ 'impasse_test_plans' => [:index, :show, :list, :tc_assign, :user_assign, :statistics, :autocomplete],
'impasse_executions' => [:index, :get_list]
}
permission :manage_testcases, {

0 comments on commit 164ab0f

Please sign in to comment.