Rumamge.Phoenix v2.0.0 Rummage.Phoenix.SearchView View Source

Search View Module for Rummage. This has view helpers that can generate rummagable links and forms.

Usage:

  defmodule MyApp.ProductView do
    use MyApp.Web, :view
    use Rummage.Phoenix.View, only: [:search]
  end

OR

  defmodule MyApp.ProductView do
    use MyApp.Web, :view
    use Rummage.Phoenix.View
  end

Link to this section Summary

Functions

This macro includes the helpers functions for searching.

Link to this section Functions

Link to this function

search_form(conn, rummage, link_params, opts \\ [])

View Source

This macro includes the helpers functions for searching.

Provides helpers function search_form/3 for creating search form in an html.eex file of using Phoenix.

Usage: Just add the following code in the index template. Make sure that you're passing rummage from the controller. Please look at the README for more details

<%= search_form(@conn, @rummage, [fields:
[
  name: %{label: "Search by Product Name", search_type: "ilike"},
  price: %{label: "Search by Price", search_type: "eq"},
], button_class: "btn",
]) %>