Module: Card::Set::Rule::RuleForm::SetSelection::HtmlFormat

Extended by:
AbstractFormat
Defined in:
tmpsets/set/mod022-rules/rule/rule_form/set_selection.rb

Instance Method Summary collapse

Instance Method Details

#bridge_option_list(_title) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'tmpsets/set/mod022-rules/rule/rule_form/set_selection.rb', line 26

def bridge_option_list _title
  index = -1
  formgroup "", editor: "set", class: "col-xs-6", help: false do
    yield.inject("") do |res, radio|
      index += 1
      # TODO
      if false # index.in? [2,3]
        wrap_with(:li, radio, class: "radio") + res
      else
        wrap_with :ul do
          wrap_with(:li, (radio + res), class: "radio")
        end
      end
    end
  end
end

#bridge_rule_set_formgroupObject



15
16
17
18
19
20
21
22
23
24
# File 'tmpsets/set/mod022-rules/rule/rule_form/set_selection.rb', line 15

def bridge_rule_set_formgroup
  tag = @rule_context.rule_user_setting_name
  narrower = []

  bridge_option_list "set" do
    rule_set_options.map do |set_name, state|
      RuleSetRadio.new(self, set_name, tag, state).html narrower
    end
  end
end

#bridge_rule_set_selectionObject



9
10
11
12
13
# File 'tmpsets/set/mod022-rules/rule/rule_form/set_selection.rb', line 9

def bridge_rule_set_selection
  wrap_with :div, class: "set-list" do
    bridge_rule_set_formgroup
  end
end

#rule_set_optionsObject



43
44
45
# File 'tmpsets/set/mod022-rules/rule/rule_form/set_selection.rb', line 43

def rule_set_options
  @rule_set_options ||= @rule_context.set_options
end

#selected_rule_setObject



47
48
49
50
51
52
# File 'tmpsets/set/mod022-rules/rule/rule_form/set_selection.rb', line 47

def selected_rule_set
  if @rule_set_options.length == 1 then true
  elsif params[:type_reload]       then card.rule_set_name
  else                                  false
  end
end