Module: Card::Set::Rule::Editor::HtmlFormat

Extended by:
AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rule_contextObject

Returns the value of attribute rule_context.



22
23
24
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 22

def rule_context
  @rule_context
end

Instance Method Details

#category_classesObject



61
62
63
64
65
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 61

def category_classes
  card.rule_set.categories(card.rule_setting.codename)
      .map { |cat| "_category-#{cat}" }
      .join(" ")
end

#current_ruleObject



78
79
80
81
82
83
84
85
86
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 78

def current_rule
  if params[:assign]
    card
  elsif (existing = card.find_existing_rule_card)
    existing
  else
    card
  end
end

#current_set_keyObject



121
122
123
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 121

def current_set_key
  card.new_card? ? Card.quick_fetch(:all).name.key : card.rule_set_key
end


67
68
69
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 67

def edit_link_view
  :rule_edit
end

#edit_rule_titleObject



71
72
73
74
75
76
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 71

def edit_rule_title
  output [
    wrap_with(:h5, setting_title, class: "title fw-bold")
    # render_overlay_rule_help
  ]
end


45
46
47
48
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 45

def pill_rule_link target_view
  link_to_view target_view, (setting_title + short_help_text),
               pill_rule_link_opts
end


50
51
52
53
54
55
56
57
58
59
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 50

def pill_rule_link_opts
  opts = board_link_opts(
    class: "edit-rule-link nav-link _rule-item #{category_classes}",
    "data-bs-toggle": "pill",
    "data-category": card.rule_set.categories(card.rule_setting.codename).join(" "),
    "data-cy": "#{setting_title.to_name.key}-pill"
  )
  opts[:path].delete(:layout)
  opts
end

#quick_editorObject



88
89
90
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 88

def quick_editor
  rule_content_formgroup
end

#rule_content_formgroupObject



117
118
119
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 117

def rule_content_formgroup
  _render_content_formgroup hide: :conflict_tracker
end

#rule_set_descriptionObject



100
101
102
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 100

def rule_set_description
  card.rule_set.follow_label
end

#rules_type_formgroupObject



104
105
106
107
108
109
110
111
112
113
114
115
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 104

def rules_type_formgroup
  return unless card.right.rule_type_editable

  success = @edit_rule_success
  wrap_type_formgroup do
    type_field(
      href: path(mark: success[:id], view: :rule_form_card_editor, assign: true),
      class: "type-field rule-type-field _live-type-field",
      "data-remote" => true
    )
  end
end

#setting_titleObject



92
93
94
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 92

def setting_title
  card.name.tag.tr "*", ""
end

#short_help_textObject



96
97
98
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 96

def short_help_text
  "<div class=\"help-text\">#{card.short_help_text}</div>"
end


41
42
43
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 41

view :rule_board_link, unknown: true do
  pill_rule_link :overlay_rule
end

#view: rule_editObject



24
25
26
27
28
29
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 24

view :rule_edit, cache: :never, unknown: true,
                 wrap: { modal: { size: :large,
                                  title: :edit_rule_title,
                                  footer: "" } } do
  current_rule_form form_type: :modal
end

#view: rule_helpObject



31
32
33
34
35
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 31

view :rule_help, unknown: true, perms: :none, cache: :never do
  wrap_with :div, class: "alert alert-info rule-instruction" do
    rule_based_help
  end
end


37
38
39
# File 'platypus/tmp/set/gem-defaults/mod010-rules/rule/editor.rb', line 37

view :rule_nest_editor_link, unknown: true do
  pill_rule_link :modal_rule
end