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

Extended by:
AbstractFormat
Defined in:
card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb,
card/tmpsets/set/mod037-card-mod-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 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 22

def rule_context
  @rule_context
end

Instance Method Details

#current_ruleObject



56
57
58
59
60
61
62
63
64
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 56

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

#current_set_keyObject



99
100
101
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 99

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


45
46
47
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 45

def edit_link_view
  :rule_edit
end

#edit_rule_titleObject



49
50
51
52
53
54
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 49

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

#quick_editorObject



66
67
68
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 66

def quick_editor
  rule_content_formgroup
end

#rule_content_formgroupObject



95
96
97
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 95

def rule_content_formgroup
  _render_content_formgroup hide: :conflict_tracker
end

#rule_set_descriptionObject



78
79
80
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 78

def rule_set_description
  card.rule_set.follow_label
end

#rules_type_formgroupObject



82
83
84
85
86
87
88
89
90
91
92
93
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 82

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, assign: true),
      class: "type-field rule-type-field live-type-field",
      "data-remote" => true
    )
  end
end

#setting_titleObject



70
71
72
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 70

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

#short_help_textObject



74
75
76
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 74

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


37
38
39
40
41
42
43
# File 'card/tmpsets/set/mod036-card-mod-rules/rule/editor.rb', line 37

view :rule_bridge_link, unknown: true do
  opts = bridge_link_opts(class: "edit-rule-link nav-link",
                          "data-toggle": "pill",
                          "data-cy": "#{setting_title.to_name.key}-pill")
  opts[:path].delete(:layout)
  link_to_view(:overlay_rule, (setting_title + short_help_text), opts)
end

#view: rule_editObject



24
25
26
27
28
29
# File 'card/tmpsets/set/mod036-card-mod-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 'card/tmpsets/set/mod036-card-mod-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