def left_type_for_nest_editor_set_selection return super unless is_template? case rule_set_pattern_name.card_id when TypeID rule_set.anchor_name when SelfID rule_set.anchor&.type_name || Card.new(name: rule_set.anchor_name).type_name else super end end format :html do attr_accessor :rule_context 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_help, unknown: true, perms: :none, cache: :never do wrap_with :div, class: "alert alert-info rule-instruction" do rule_based_help end end view :rule_nest_editor_link, unknown: true do pill_rule_link :modal_rule end view :rule_board_link, unknown: true do pill_rule_link :overlay_rule end def pill_rule_link target_view link_to_view target_view, (setting_title + short_help_text), pill_rule_link_opts end 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 def category_classes card.rule_set.categories(card.rule_setting.codename) .map { |cat| "_category-#{cat}" } .join(" ") end def edit_link_view :rule_edit end def edit_rule_title output [ wrap_with(:h5, setting_title, class: "title fw-bold") # render_overlay_rule_help ] end def current_rule if params[:assign] card elsif (existing = find_existing_rule_card) existing else card end end def quick_editor rule_content_formgroup end def setting_title card.name.tag.tr "*", "" end def short_help_text "