Sha256: 859eb59c50899fdc91532040599b8b4f4dda08fc1d3d5f6e196d6ee355b8cbf9

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

format :html do
  view :navbox, cache: :never do
    select_tag "query[keyword]", "", class: "_navbox navbox form-control w-100",
                                     placeholder: navbar_placeholder
  end

  view :navbar do
    # FIXME: not bootstrap class here.
    class_up "navbox-form", "form-inline"
    render_core
  end

  view :core do
    form_tag path(mark: :search), method: "get", role: "search",
                                  class: classy("navbox-form", "nodblclick") do
      wrap_with :div, class: "form-group w-100" do
        render_navbox
      end
    end
  end

  # def initial_options
  #   return "" unless (keyword = params.dig :query, :keyword)
  #   options_for_select [keyword]
  # end

  # TODO: the more natural placeholder would be the content of the navbox card, no?
  # Also, the forced division of "raw" and "core" should probably be replaced
  # with a single haml template (for core view)
  def navbar_placeholder
    @placeholder ||= Card[:navbox, "*placeholder"]&.content || "Search"
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
card-mod-layout-0.14.2 set/self/navbox.rb
card-mod-layout-0.14.1 set/self/navbox.rb
card-mod-layout-0.14.0 set/self/navbox.rb
card-mod-layout-0.13.4 set/self/navbox.rb
card-mod-layout-0.13.3 set/self/navbox.rb
card-mod-layout-0.13.2 set/self/navbox.rb
card-mod-layout-0.13.1 set/self/navbox.rb
card-mod-layout-0.13.0 set/self/navbox.rb
card-mod-layout-0.11.7 set/self/navbox.rb
card-mod-layout-0.12.0 set/self/navbox.rb
card-mod-layout-0.11.6 set/self/navbox.rb
card-mod-layout-0.11.5 set/self/navbox.rb
card-mod-layout-0.11.4 set/self/navbox.rb
card-mod-layout-0.11.3 set/self/navbox.rb
card-mod-layout-0.11.2 set/self/navbox.rb
card-mod-layout-0.11.1 set/self/navbox.rb
card-mod-layout-0.11.0 set/self/navbox.rb