Class: Kommandant::Commands::SearchesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/kommandant/commands/searches_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/kommandant/commands/searches_controller.rb', line 8

def show
  @results = filtered_resources.map do |resource|
    Kommandant::Commands::SearchResult.new(command: @command, resource: resource)
  end

  if Kommandant.config.pagination.enabled
    @pagination, @results = Kommandant.config.pagination.pagination_lambda.call(@results, Kommandant.config.pagination.items_per_page, self)
    @pagination_info_label = Kommandant.config.pagination.info_label_lambda.call(@pagination, self)
  end
end