Added new autocomplete for task assignments.

Introduced the cool jquery token plugin.
This commit is contained in:
benni 2011-05-14 19:41:46 +02:00
parent 2e56bfe895
commit 5d028ccf3a
10 changed files with 880 additions and 13 deletions

View file

@ -3,12 +3,12 @@
%head
%meta{"http-equiv" => "content-type", :content => "text/html;charset=UTF-8"}
%title= "FoodSoft - " + (yield(:title) or controller.controller_name)
= stylesheet_link_tag 'main', 'rails_messages', 'nav', 'simple_form', :cache => "all_cached"
= stylesheet_link_tag 'main', 'rails_messages', 'nav', 'simple_form', 'token-input', :cache => "all_cached"
= stylesheet_link_tag "print", :media => "print"
<!--[if lte IE 7]>
= stylesheet_link_tag 'ie_hacks'
<![endif]-->
= javascript_include_tag 'jquery.min', 'jquery-ui.min', 'jquery_ujs', 'application', 'ordering', :cache => "all_cached"
= javascript_include_tag 'jquery.min', 'jquery-ui.min', 'jquery_ujs', 'jquery.tokeninput', 'application', 'ordering', :cache => "all_cached"
= yield(:head)
%body
#logininfo= render :partial => 'shared/loginInfo'

View file

@ -1,8 +1,17 @@
- content_for :head do
:javascript
$(function() {
$("#task_user_list").tokenInput("#{users_path(:format => :json)}", {
crossDomain: false,
prePopulate: $("#task_user_list").data("pre")
});
});
= simple_form_for @task do |f|
= f.input :name
= f.input :description
= f.input :duration, :as => :select, :collection => 1..3
= f.input :user_list, :as => :string
= f.input :user_list, :as => :string, :input_html => { 'data-pre' => @task.users.map { |u| {:id => u.id, :name => u.nick} }.to_json }
= f.input :required_users
= f.association :workgroup
= f.input :due_date, :include_blank => true