Sha256: 5fc88bd0f8bec8abc117027757e22d6237c67ddfbcb3dd327faa7b1abd8a46f7

Contents?: true

Size: 1.67 KB

Versions: 2

Compression:

Stored size: 1.67 KB

Contents

include_set Abstract::WqlSearch

format do
  view :core, cache: :never do
    _render search_result_view
  end

  def chunk_list
    :query
  end

  def search_result_view
    case search_with_params
    when Exception          then :search_error
    when Integer            then :search_count
    when @mode == :template then :raw
    else                         :card_list
    end
  end
end

format :json do
  view :export do |args|
    # avoid running the search from options and structure that
    # case a huge result or error
    return [render_atom(args)] if card.content.empty? ||
                                  card.name.include?("+*options") ||
                                  card.name.include?("+*structure")
    super(args)
  end

  view :export_items, cache: :never do |args|
    card.item_names(limit: 0).map do |i_name|
      next unless (i_card = Card[i_name])
      subformat(i_card).render_atom(args)
    end.flatten.reject(&:blank?)
  end
end

format :rss do
  view :feed_body do
    case raw_feed_items
    when Exception then @xml.item(render(:search_error))
    when Integer then @xml.item(render(:search_count))
    else super()
    end
  end

  def raw_feed_items
    @raw_feed_items ||= search_with_params
  end
end

format :html do
  view :closed do
    voo.hide :closed_content
    super()
  end

  view :closed_content, cache: :never do
    if @depth > max_depth
      "..."
    else
      search_params[:limit] = closed_limit
      _render_core hide: "paging", items: { view: :link }
      # TODO: if item is queryified to be "name", then that should work.
      # otherwise use link
    end
  end

  def editor
    :ace_editor
  end

  def ace_mode
    :json
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
card-1.91 mod/standard/set/type/search_type.rb
card-1.21.0 mod/standard/set/type/search_type.rb