Sha256: fef8ba095a4d7b99af919c6b00975b0adf4cf6aaffce701157e3bc8eb072438c

Contents?: true

Size: 1.2 KB

Versions: 12

Compression:

Stored size: 1.2 KB

Contents

format :html do
  def filtered_rule_list view, *filter_args
    [
      setting_filter(view, *filter_args),
      render(view)
    ]
  end

  def setting_filter view, selected_category=:common, path_opts={}
    form_tag path(path_opts.merge(view: view)),
             remote: true, method: "get", role: "filter",
             "data-slot-selector": ".card-slot._setting-list",
             class: classy("nodblclick slotter") do
      output [
        filter_buttons(selected_category)
      ].flatten
    end
  end

  def filter_buttons selected=:all
    wrap_with :div, class: "my-4 mx-2 _setting-filter" do
      [
        content_tag(:label, "Settings"),
        filter_radio(:all, "All", selected == :all),
        filter_radio(:common, "Common", selected == :common),
        filter_radio(:field, "Field", selected == :field_related),
        filter_radio(:recent, "Recent", selected == :recent)
      ]
    end
  end

  def filter_radio name, label, checked=false
    <<-HTML.strip_heredoc
        <input type="radio" class="btn-check _setting-category" name="options" id="#{name}" autocomplete="off" #{'checked' if checked}>
        <label class="btn btn-outline-primary" for="#{name}">#{label}</label>
    HTML
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
card-mod-rules-0.18.1 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.18.0 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.17.0 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.16.0 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.6 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.5 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.4 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.3 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.2.pre1 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.1.1 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.1 set/type/set/html_views/setting_filter.rb
card-mod-rules-0.15.0 set/type/set/html_views/setting_filter.rb