Sha256: 12ff027ca11c8284a42624594b4709ae1a3c1a61c66752c5454e3159f58188db

Contents?: true

Size: 1.76 KB

Versions: 6

Compression:

Stored size: 1.76 KB

Contents

# -*- encoding : utf-8 -*-
class Card; module Set; class Rule; module RuleForm;
# Set: All rule cards (RuleForm, FormElements)
#
module FormElements;
extend Card::Set
def self.source_location; "/Users/ethan/dev/decko/gem/card-mod-rules/set/rule/rule_form/form_elements.rb"; end
module HtmlFormat; module_parent.send :register_set_format, Card::Format::HtmlFormat, self; extend Card::Set::AbstractFormat
  #### DEPRECATED

  def rule_set_selection
    wrap_with :div, class: "set-list" do
      [rule_set_formgroup, related_set_formgroup]
    end
  end

  def rule_set_formgroup
    tag = @rule_context.rule_user_setting_name
    narrower = []
    option_list "Set" do
      rule_set_options.map do |set_name, state|
        rule_set_radio_button set_name, tag, state, narrower
      end
    end
  end

  def related_set_formgroup
    related_sets = related_sets_in_context
    return "" unless related_sets&.present?

    tag = @rule_context.rule_user_setting_name
    option_list "related set" do
      related_rule_radios related_sets, tag
    end
  end

  def related_sets_in_context
    set_context = @rule_context.rule_set_name
    set_context && Card.fetch(set_context).prototype.related_sets
  end

  def option_list title
    formgroup title, input: "set", class: "col-xs-6", help: false do
      wrap_with :ul do
        wrap_each_with(:li, class: "radio") { yield }
      end
    end
  end

  def related_rule_radios related_sets, tag
    related_sets.map do |set_name, _label|
      rule_name = "#{set_name}+#{tag}"
      state = Card.exists?(rule_name) ? :exists : nil
      rule_radio set_name, state do
        radio_button :name, rule_name
      end
    end
  end
end
end;end;end;end;end;
# ~~ generated from /Users/ethan/dev/decko/gem/card-mod-rules/set/rule/rule_form/form_elements.rb ~~

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
card-1.101.5 tmpsets/set/mod036-card-mod-rules/rule/rule_form/form_elements.rb
card-1.101.4 tmpsets/set/mod036-card-mod-rules/rule/rule_form/form_elements.rb
card-1.101.3 tmpsets/set/mod036-card-mod-rules/rule/rule_form/form_elements.rb
card-1.101.2 tmpsets/set/mod036-card-mod-rules/rule/rule_form/form_elements.rb
card-1.101.1 tmpsets/set/mod036-card-mod-rules/rule/rule_form/form_elements.rb
card-1.101.0 tmpsets/set/mod036-card-mod-rules/rule/rule_form/form_elements.rb