Module: Card::Set::Rule::RuleForm::HtmlFormat
- Extended by:
- AbstractFormat
- Defined in:
- platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb
Instance Method Summary collapse
-
#current_rule_form(success_view: :overlay_rule, form_type: :overlay) ⇒ Object
-
#edit_rule_form(success_view, &block) ⇒ Object
-
#edit_rule_success(view = "overlay_rule") ⇒ Object
-
#form_type ⇒ Object
-
#prepare_rule_form_options ⇒ Object
-
#rule_form(success_view, rule_context, form_type = :overlay) ⇒ Object
-
#rule_form_args ⇒ Object
-
#validate_form_type(form_type) ⇒ Object
-
#view: rule_form ⇒ Object
-
#view: rule_form_card_editor ⇒ Object
Instance Method Details
#current_rule_form(success_view: :overlay_rule, form_type: :overlay) ⇒ Object
44 45 46 47 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 44 def current_rule_form success_view: :overlay_rule, form_type: :overlay current_rule_format = subformat current_rule current_rule_format.rule_form success_view, card, form_type end |
#edit_rule_form(success_view, &block) ⇒ Object
65 66 67 68 69 70 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 65 def edit_rule_form success_view, &block @rule_context ||= card @edit_rule_success = edit_rule_success success_view action_args = { action: :update, no_mark: true } card_form action_args, rule_form_args, &block end |
#edit_rule_success(view = "overlay_rule") ⇒ Object
76 77 78 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 76 def edit_rule_success view="overlay_rule" { mark: @rule_context.name.url_key, view: view } end |
#form_type ⇒ Object
40 41 42 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 40 def form_type @form_type || :overlay end |
#prepare_rule_form_options ⇒ Object
22 23 24 25 26 27 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 22 def @success_view ||= :open @rule_context ||= card @form_type ||= :overlay @edit_rule_success = edit_rule_success @success_view end |
#rule_form(success_view, rule_context, form_type = :overlay) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 49 def rule_form success_view, rule_context, form_type=:overlay validate_form_type form_type @rule_context = rule_context @form_type = form_type @success_view = success_view render_rule_form end |
#rule_form_args ⇒ Object
72 73 74 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 72 def rule_form_args { class: "card-rule-form", "data-slotter-mode": "update-origin" } end |
#validate_form_type(form_type) ⇒ Object
59 60 61 62 63 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 59 def validate_form_type form_type return if form_type.in? %i[overlay modal] raise "invalid rule_form type: #{form_type}; has to be overlay or modal" end |
#view: rule_form ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 9 view :rule_form, cache: :never, unknown: true do wrap do edit_rule_form @success_view do [ (success: @edit_rule_success), haml(:rule_form) ].join end end end |
#view: rule_form_card_editor ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/rule_form.rb', line 29 view :rule_form_card_editor, cache: :never, unknown: true do wrap true, class: "card-editor slotter" do [ rules_type_formgroup, rule_content_formgroup ] end end |