Sha256: ac35ff164c2a637a938a8b5f8e6d278922243f434c5fe4c436de61491d24143d

Contents?: true

Size: 851 Bytes

Versions: 4

Compression:

Stored size: 851 Bytes

Contents

module My
  class HighlightsController < MyController
    def search_builder_class
      Sufia::MyHighlightsSearchBuilder
    end

    def index
      super
      @selected_tab = 'highlighted'
    end

    protected

      def search_action_url(*args)
        sufia.dashboard_highlights_url(*args)
      end

      def query_solr
        return empty_search_result if Sufia::TrophyPresenter.find_by_user(@user).count == 0
        super
      end

      def empty_search_result
        solr_response = Blacklight::Solr::Response.new(empty_request, {})
        docs = []
        [solr_response, docs]
      end

      def empty_request
        {
          responseHeader: {
            status: 0,
            params: { wt: 'ruby', rows: '11', q: '*:*' }
          },
          response: { numFound: 0, start: 0, docs: [] }
        }
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sufia-7.1.0 app/controllers/my/highlights_controller.rb
sufia-7.0.0 app/controllers/my/highlights_controller.rb
sufia-7.0.0.rc2 app/controllers/my/highlights_controller.rb
sufia-7.0.0.rc1 app/controllers/my/highlights_controller.rb