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-mod-rules-0.14.2 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.14.1 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.14.0 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.13.4 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.13.3 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.13.2 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.13.1 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.13.0 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.7 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.12.0 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.6 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.5 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.4 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.3 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.2 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.1 set/type/set/html_views/rule_lists.rb
card-mod-rules-0.11.0 set/type/set/html_views/rule_lists.rb
card-1.100.0 mod/rules/set/type/set/html_views/rule_lists.rb
card-1.99.6 mod/rules/set/type/set/html_views/rule_lists.rb
card-1.99.5 mod/rules/set/type/set/html_views/rule_lists.rb