diff --git a/app/controllers/my_profile/tasks_controller.rb b/app/controllers/my_profile/tasks_controller.rb index 874e59c..4c6ca89 100644 --- a/app/controllers/my_profile/tasks_controller.rb +++ b/app/controllers/my_profile/tasks_controller.rb @@ -1,7 +1,7 @@ class TasksController < MyProfileController - protect [:perform_task, :view_tasks], :profile, :only => [:index, :save_tags] - protect :perform_task, :profile, :except => [:index, :save_tags] + protect [:perform_task, :view_tasks], :profile, :only => [:index, :save_tags, :search_tags] + protect :perform_task, :profile, :except => [:index, :save_tags, :search_tags] def index @filter_type = params[:filter_type].presence @@ -114,4 +114,15 @@ class TasksController < MyProfileController render json: result end + #FIXME make this test + # Should not search for article tasks + # Should not search for other profile tags + # Should search only task tags + # Should check the permissions + def search_tags + arg = params[:term].downcase + result = ActsAsTaggableOn::Tag.find(:all, :conditions => ['LOWER(name) LIKE ?', "%#{arg}%"]) + render :text => prepare_to_token_input_by_label(result).to_json, :content_type => 'application/json' + end + end diff --git a/app/views/tasks/index.html.erb b/app/views/tasks/index.html.erb index ae43ecc..fe0ae1a 100644 --- a/app/views/tasks/index.html.erb +++ b/app/views/tasks/index.html.erb @@ -107,7 +107,7 @@ }); jQuery('.tag-list').inputosaurus({ - autoCompleteSource: <%= "'/myprofile/#{profile.identifier}/cms/search_tags'," %> + autoCompleteSource: <%= "'/myprofile/#{profile.identifier}/tasks/search_tags'," %> activateFinalResult: true, submitTags: { url: <%= "'/myprofile/#{profile.identifier}/tasks/save_tags'" %>, diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 049d121..0c24051 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -684,9 +684,6 @@ class TasksControllerTest < ActionController::TestCase assert_not_includes task_one.tags_from(nil), 'test' end -#region_validators_controller_test.rb: give_permission('ze', 'manage_environment_validators', environment) -#profile_editor_controller_test.rb: user2.stubs(:has_permission?).with('edit_profile', anything).returns(true) -#profile_editor_controller_test.rb: user2.expects(:has_permission?).with(:manage_friends, anything).returns(true) should 'not tag task with permission but another user' do requestor = fast_create(Person) -- libgit2 0.21.2