Module: Card::Set::All::ReferenceEditor::NestEditor::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb

Instance Method Summary collapse

Instance Method Details

#default_nest_editor_item_optionsObject



86
87
88
89
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 86

def default_nest_editor_item_options
  []
  # [[:view, default_item_view]]
end

#demoObject



91
92
93
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 91

def demo
  _render_demo
end

#empty_nest_name_alert(show) ⇒ Object



59
60
61
62
63
64
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 59

def empty_nest_name_alert show
  alert :warning, false, false,
        class: "mb-0 _empty-nest-name-alert #{'d-none' unless show}" do
    "nest name required" # LOCALIZE
  end
end

#known_nest_contentObject



99
100
101
102
103
104
105
106
107
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 99

def known_nest_content
  voo.hide! :cancel_button
  add_name_context
  with_nest_mode :edit do
    wrap true do
      render_edit_inline
    end
  end
end


66
67
68
69
70
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 66

def modal_nest_editor
  wrap_with :modal do
    nest_editor :modal
  end
end

#name_dependent_slotObject



48
49
50
51
52
53
54
55
56
57
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 48

def name_dependent_slot
  result = [empty_nest_name_alert(nest_snippet.name.blank?)]
  result <<
    if nest_snippet.name.blank?
       :div, "", class: "card-slot" # placeholder
    else
      yield
    end
  result
end

#nest_apply_optsObject



95
96
97
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 95

def nest_apply_opts
  apply_tm_snippet_data nest_snippet
end

#nest_editor(editor_mode, ref_type = :nest, title = "Nest", editor = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 37

def nest_editor editor_mode, ref_type=:nest, title="Nest", editor=nil
  @tm_snippet_editor_mode = editor_mode
  voo.hide :content_tab unless show_content_tab?
  haml :reference_editor, title: title,
                          editor: editor || ref_type,
                          ref_type: ref_type,
                          editor_mode: @tm_snippet_editor_mode,
                          apply_opts: nest_apply_opts,
                          snippet: nest_snippet
end

#nest_snippetObject



72
73
74
75
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 72

def nest_snippet
  @nest_snippet ||=
    Card::Reference::NestParser.new params[:tm_snippet_raw]
end

#set_name_for_nest_rulesObject



77
78
79
80
81
82
83
84
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 77

def set_name_for_nest_rules
  nest_name = nest_snippet.name
  if (type_name = card.left_type_for_nest_editor_set_selection)
    [type_name, nest_name, :type_plus_right]
  else
    [nest_name, :right]
  end
end

#unknown_nest_contentObject



109
110
111
112
113
114
115
116
117
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 109

def unknown_nest_content
  voo.hide! :guide
  voo.show! :new_type_formgroup
  voo.buttons_view = :new_image_buttons
  wrap true do
    create_form success: { tinymce_id: Env.params[:tinymce_id] }
  end
  # framed_create_form
end


24
25
26
27
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 24

view :modal_nest_editor, cache: :never, unknown: true,
                         wrap: { slot: { class: "nodblclick" } } do
  modal_nest_editor
end

#view: nest_contentObject



29
30
31
32
33
34
35
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 29

view :nest_content, perms: :create, cache: :never, unknown: true, wrap: :slot do
  if card.known?
    known_nest_content
  else
    unknown_nest_content
  end
end

#view: nest_editorObject

Card::View::Options.shark_keys - %i[nest_syntax nest_name items cache] TODO: connect to Card::View::Options (that way a mod can add an option that becomes available to nests)



17
18
19
20
21
22
# File 'platypus/tmp/set/gem-defaults/mod033-tinymce_editor/all/reference_editor/nest_editor.rb', line 17

view :nest_editor, cache: :never, unknown: true,
                   wrap: {
                     slot: { class: "_overlay d0-card-overlay card nodblclick" }
                   } do
  nest_editor :overlay
end