Sha256: 3013d929af1270475d471f4ff50733ab6af628d028abfff13427d9d3cc244d02

Contents?: true

Size: 1.21 KB

Versions: 23

Compression:

Stored size: 1.21 KB

Contents

format :html do
  view :quick_edit_rule_list, cache: :never, wrap: { slot: { class: "rule-list" } } do
    quick_edit_rule_list setting_list_from_params(:field_related)
  end

  view :bar_rule_list, cache: :never, wrap: { slot: { class: "rule-list" } } do
    bar_rule_list setting_list_from_params
  end

  view :pill_rule_list, cache: :never, wrap: { slot: { class: "rule-list" } } do
    pill_rule_list setting_list_from_params
  end

  def quick_edit_rule_list settings
    list_tag class: "nav nav-pills flex-column bridge-pills" do
      settings.map { |setting| rule_list_item setting, :quick_edit }
    end
  end

  def pill_rule_list settings
    list_items =
      settings.map { |setting| rule_list_item setting, :rule_bridge_link }
    bridge_pills list_items
  end

  def bar_rule_list settings
    list_items =
      settings.map { |setting| rule_list_item setting, :bar, hide: :full_name }
    list_items.join("\n").html_safe
  end

  def rule_list_item setting, view, opts={}
    return "" unless show_view? setting

    rule_card = card.fetch setting, new: {}
    nest(rule_card, opts.merge(view: view)).html_safe
  end

  def setting_list_from_params default=:common
    setting_list setting_group(default)
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
card-1.99.4 mod/rules/set/type/set/html_views/rule_lists.rb
card-1.99.3 mod/rules/set/type/set/html_views/rule_lists.rb
card-1.99.2 mod/rules/set/type/set/html_views/rule_lists.rb