Class: KeywordsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- KeywordsController
- Defined in:
- app/controllers/keywords_controller.rb
Instance Method Summary collapse
-
#autocomplete ⇒ Object
TODO: deprecate for CVT + params.
-
#lookup_keyword ⇒ Object
TODO: deprecat for CVT + params.
- #select_options ⇒ Object
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
Methods included from RequestType
Methods included from LogRecent
Methods included from Cookies
#digest_cookie, #digested_cookie_exists?
Methods included from Whitelist
Methods included from ProjectsHelper
#invalid_object, #project_link, #project_matches, #project_tag, #projects_list, #projects_search_form
Methods included from Api::Intercept
Methods included from TokenAuthentication
#intercept_project, #intercept_user, #intercept_user_or_project, #project_token_authenticate, #token_authenticate
Instance Method Details
#autocomplete ⇒ Object
TODO: deprecate for CVT + params
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/keywords_controller.rb', line 5 def autocomplete predicates = Keyword.find_for_autocomplete(params.merge(project_id: sessions_current_project_id)).distinct data = predicates.collect do |t| str = t.name + ': ' + t.definition {id: t.id, label: str, response_values: { params[:method] => t.id}, label_html: str } end render json: data end |
#lookup_keyword ⇒ Object
TODO: deprecat for CVT + params
22 23 24 25 26 27 28 29 30 31 |
# File 'app/controllers/keywords_controller.rb', line 22 def lookup_keyword @keywords = Keyword.find_for_autocomplete(params.merge(project_id: sessions_current_project_id)) render(json: @keywords.collect { |t| { label: t.name, object_id: t.id, definition: t.definition } }) end |
#select_options ⇒ Object
33 34 35 |
# File 'app/controllers/keywords_controller.rb', line 33 def @keywords = Keyword.select_optimized(sessions_current_user_id, sessions_current_project_id, params.require(:klass)) end |