Sha256: 166df4337e6cf679cf77fdb55da015375b8f9d6dd5d7abaceb2b52f1a38c92e4

Contents?: true

Size: 462 Bytes

Versions: 49

Compression:

Stored size: 462 Bytes

Contents

module ForemanTasks
  module FindTasksCommon
    def search_query
      [current_taxonomy_search, params[:search]].select(&:present?).join(' AND ')
    end

    def current_taxonomy_search
      conditions = []
      conditions << "organization_id = #{Organization.current.id}" if Organization.current
      conditions << "location_id = #{Location.current.id}" if Location.current
      conditions.empty? ? '' : "(#{conditions.join(' AND ')})"
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
foreman-tasks-10.0.2 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-10.0.1 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-10.0.0 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.2.3 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.2.2 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.2.1 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.2.0 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.1.1 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.0.4 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.1.0 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.0.2 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.0.1 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.3.3 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-9.0.0 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.2.1 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.1.4 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.3.2 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.3.1 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.1.3 app/controllers/concerns/foreman_tasks/find_tasks_common.rb
foreman-tasks-8.3.0 app/controllers/concerns/foreman_tasks/find_tasks_common.rb