Sha256: e0e8511bb2412d0bb2e66861803db029d191271d6e29e9ab9491694817e0d28c

Contents?: true

Size: 806 Bytes

Versions: 5

Compression:

Stored size: 806 Bytes

Contents

module Kms
  class Public::SearchController < ActionController::Base
    protect_from_forgery with: :exception

    def search
      results = Page.advanced_search(params[:query]).to_drop#.split(' ').join('|').to_drop
      if params[:result_page] and @page = Page.find_by_fullpath(params[:result_page])
        @externals = Hash[ExternalsRegistry.externals.map{ |k, v| [k, v.call(request, self)] }]
        @template = @page.template

        page_result = Rails.configuration.x.template_manager.render(@page.register_id, @externals.merge!(search: results))
        result = Rails.configuration.x.template_manager.render(@template.register_id, @externals.merge(_inner_template: page_result))

        render text: result, layout: false
      else
        redirect_to root_path
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kms-1.2.1 app/controllers/kms/public/search_controller.rb
kms-1.2.0 app/controllers/kms/public/search_controller.rb
kms-1.1.0 app/controllers/kms/public/search_controller.rb
kms-1.0.1 app/controllers/kms/public/search_controller.rb
kms-1.0.0 app/controllers/kms/public/search_controller.rb