card 1.99.1 → 1.99.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/config/initializers/01_core_extensions/array.rb +1 -0
  4. data/config/initializers/01_core_extensions/persistent_identifiers.rb +1 -1
  5. data/config/initializers/02_patches/zeitwerk.rb +13 -0
  6. data/config/initializers/patches.rb +7 -0
  7. data/config/initializers/recaptcha.rb +1 -2
  8. data/config/initializers/zeitwerk.rb +5 -0
  9. data/config/locales/de.yml +1 -1
  10. data/config/locales/en.yml +1 -1
  11. data/config/locales/es.yml +1 -1
  12. data/db/migrate/20110511221913_require_earlier_migrations.rb +0 -3
  13. data/db/migrate/20141001105348_move_revisions_to_actions.rb +1 -1
  14. data/db/migrate_core_cards/20140629222005_add_email_cards.rb +5 -5
  15. data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +1 -1
  16. data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +1 -1
  17. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +2 -2
  18. data/db/migrate_core_cards/20150317162412_bootstrap_themes.rb +4 -4
  19. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +1 -1
  20. data/db/migrate_core_cards/20190204195039_add_rule_card.rb +1 -1
  21. data/db/migrate_core_cards/20191008201046_fixture_fix.rb +3 -1
  22. data/db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb +8 -0
  23. data/db/migrate_core_cards/20191115160748_history_cleanup.rb +27 -0
  24. data/db/migrate_core_cards/20191118145629_codename_fixes.rb +6 -0
  25. data/db/seed/new/card_actions.yml +874 -874
  26. data/db/seed/new/card_acts.yml +2 -2
  27. data/db/seed/new/card_references.yml +2 -2
  28. data/db/seed/new/cards.yml +1576 -1576
  29. data/db/seed/new/schema_migrations_core_cards.yml +8 -0
  30. data/db/seed/test/fixtures/card_actions.yml +1815 -1815
  31. data/db/seed/test/fixtures/card_acts.yml +499 -499
  32. data/db/seed/test/fixtures/card_changes.yml +66 -66
  33. data/db/seed/test/fixtures/card_references.yml +634 -634
  34. data/db/seed/test/fixtures/cards.yml +2730 -2730
  35. data/db/seed/test/fixtures/schema_migrations_core_cards.yml +8 -0
  36. data/db/test_seed.rb +10 -11
  37. data/lib/card.rb +9 -30
  38. data/lib/card/act_manager.rb +0 -2
  39. data/lib/card/auth.rb +0 -5
  40. data/lib/card/auth/current.rb +32 -59
  41. data/lib/card/auth/setup.rb +1 -1
  42. data/lib/card/codename.rb +5 -6
  43. data/lib/card/content.rb +5 -8
  44. data/lib/card/content/chunk.rb +0 -78
  45. data/lib/card/content/chunk/abstract.rb +88 -0
  46. data/lib/card/content/clean.rb +3 -3
  47. data/lib/card/content/diff/{lcs.rb → l_c_s.rb} +5 -7
  48. data/lib/card/content/diff/{processor.rb → l_c_s/processor.rb} +0 -0
  49. data/lib/card/content/parser.rb +1 -1
  50. data/lib/card/dirty.rb +25 -31
  51. data/lib/card/dirty/method_factory.rb +15 -0
  52. data/lib/card/env.rb +0 -3
  53. data/lib/card/error.rb +6 -2
  54. data/lib/card/format.rb +5 -5
  55. data/lib/card/format/nest/fetch.rb +2 -1
  56. data/lib/card/mark.rb +1 -0
  57. data/lib/card/migration.rb +4 -0
  58. data/lib/card/mod.rb +2 -5
  59. data/lib/card/mod/dirs.rb +1 -0
  60. data/lib/card/mod/load_strategy.rb +23 -12
  61. data/lib/card/mod/loader.rb +13 -13
  62. data/lib/card/mod/loader/set_loader.rb +7 -1
  63. data/lib/card/mod/loader/set_pattern_loader.rb +2 -2
  64. data/lib/card/mod/module_template.rb +1 -5
  65. data/lib/card/mod_inflector.rb +16 -0
  66. data/lib/card/model/save_helper.rb +2 -2
  67. data/lib/card/name.rb +2 -2
  68. data/lib/card/name/name_variants.rb +19 -0
  69. data/lib/card/query.rb +4 -2
  70. data/lib/card/query/card_query/reference_attributes.rb +2 -2
  71. data/lib/card/query/sql_statement.rb +4 -0
  72. data/lib/card/set.rb +18 -3
  73. data/lib/card/set/abstract.rb +6 -0
  74. data/lib/card/set/event.rb +13 -11
  75. data/lib/card/set/event/delayed_event.rb +2 -0
  76. data/lib/card/set/format.rb +3 -3
  77. data/lib/card/set/helpers.rb +20 -8
  78. data/lib/card/set/loader.rb +1 -1
  79. data/lib/card/set/pattern.rb +47 -0
  80. data/lib/card/{set_pattern.rb → set/pattern/base.rb} +11 -92
  81. data/lib/card/set/required_field.rb +64 -30
  82. data/lib/card/set/trait.rb +3 -2
  83. data/lib/card/set/type.rb +46 -0
  84. data/lib/card/subcards.rb +0 -4
  85. data/lib/card/tasks/card.rake +1 -0
  86. data/lib/card/tasks/card/migrate.rake +1 -1
  87. data/lib/card/view.rb +2 -7
  88. data/lib/card/view/cache.rb +3 -0
  89. data/lib/card/view/cache/stub.rb +5 -0
  90. data/lib/cardio.rb +73 -46
  91. data/mod/account/set/abstract/accountable.rb +49 -0
  92. data/mod/account/set/all/account.rb +3 -3
  93. data/mod/account/set/right/account.rb +1 -1
  94. data/mod/account/set/self/signin.rb +2 -2
  95. data/mod/account/set/type/role.rb +1 -1
  96. data/mod/account/set/type/signup.rb +2 -2
  97. data/mod/account/set/type/signup/views.rb +1 -1
  98. data/mod/account/set/type/user.rb +1 -1
  99. data/mod/account/spec/set/abstract/accountable_spec.rb +7 -0
  100. data/mod/account/spec/set/all/account_spec.rb +3 -3
  101. data/mod/account/spec/set/right/account_spec.rb +1 -1
  102. data/mod/account/spec/set/type/signup_spec.rb +4 -4
  103. data/mod/admin/set/self/admin.rb +1 -1
  104. data/mod/admin/set/self/admin_info.rb +2 -2
  105. data/mod/admin/set/self/version.rb +1 -1
  106. data/mod/basic_types/set/type/json.rb +4 -0
  107. data/mod/basic_types/spec/set/type/html_spec.rb +1 -1
  108. data/mod/bootstrap/db/migrate_core_cards/data/20181108181219_migrate_classic_skins_to_bootstrap.rb +2 -2
  109. data/mod/bootstrap/lib/bootstrap/component_loader.rb +1 -1
  110. data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +1 -0
  111. data/mod/bootstrap/set/abstract/bootswatch_theme.rb +1 -1
  112. data/mod/bootstrap/set/all/bootstrap/tabs.rb +4 -4
  113. data/mod/bootstrap/set/type/customized_bootswatch_skin.rb +5 -4
  114. data/mod/carrierwave/config/core_initializers/carrierwave.rb +1 -3
  115. data/mod/carrierwave/lib/carrier_wave/{cardmount.rb → card_mount.rb} +2 -2
  116. data/mod/carrierwave/lib/carrier_wave/file_card_uploader.rb +27 -12
  117. data/mod/carrierwave/set/abstract/attachment.rb +0 -2
  118. data/mod/carrierwave/set/all/file_utils.rb +5 -1
  119. data/mod/carrierwave/set/self/admin.rb +1 -1
  120. data/mod/core/chunk/link.rb +99 -91
  121. data/mod/core/chunk/nest.rb +2 -2
  122. data/mod/core/chunk/query_reference.rb +79 -74
  123. data/mod/core/chunk/view_stub.rb +10 -1
  124. data/mod/core/format/html_format.rb +1 -1
  125. data/mod/core/set/abstract/code_file.rb +6 -6
  126. data/mod/core/set/all/content.rb +1 -1
  127. data/mod/core/set/all/event_conditions.rb +1 -2
  128. data/mod/core/set/all/fetch.rb +22 -19
  129. data/mod/core/set/all/fetch_helper.rb +7 -5
  130. data/mod/core/set/all/initialize.rb +35 -9
  131. data/mod/core/set/all/item.rb +16 -6
  132. data/mod/core/set/all/name.rb +19 -15
  133. data/mod/core/set/all/pattern.rb +4 -0
  134. data/mod/core/set/all/permissions.rb +13 -11
  135. data/mod/core/set/all/rename.rb +1 -0
  136. data/mod/core/set/all/rules.rb +4 -4
  137. data/mod/core/set/all/subcards.rb +36 -1
  138. data/mod/core/set/all/type.rb +1 -1
  139. data/mod/core/set_pattern/03_type.rb +2 -0
  140. data/mod/core/spec/chunk/nest_spec.rb +7 -2
  141. data/mod/core/spec/set/all/fetch_spec.rb +1 -1
  142. data/mod/core/spec/set/all/permissions_spec.rb +11 -12
  143. data/mod/core/spec/set/all/rules_spec.rb +3 -3
  144. data/mod/edit/set/all/bridge.rb +1 -3
  145. data/mod/edit/set/all/bridge/tab_views.rb +0 -7
  146. data/mod/edit/set/all/bridge/tab_visibility.rb +5 -7
  147. data/mod/edit/set/all/form_buttons.rb +1 -1
  148. data/mod/edit/set/all/form_elements.rb +1 -0
  149. data/mod/edit/set/all/new.rb +2 -2
  150. data/mod/edit/spec/set/all/bridge/tab_views_spec.rb +1 -1
  151. data/mod/edit/spec/set/all/{nest_editor → reference_editor/nest_editor}/nest_parser_spec.rb +1 -1
  152. data/mod/edit/spec/set/all/{nest_editor_spec.rb → reference_editor/nest_editor_spec.rb} +6 -3
  153. data/mod/edit/spec/set/all/{nest_image_spec.rb → reference_editor/nest_image_spec.rb} +1 -1
  154. data/mod/email/set/abstract/test_context.rb +1 -1
  155. data/mod/email/set/type/email_template/email_config.rb +1 -1
  156. data/mod/follow/set/all/notify.rb +1 -1
  157. data/mod/follow/set/all/notify/base_views.rb +1 -1
  158. data/mod/follow/set/right/account.rb +8 -6
  159. data/mod/follow/set/right/followers.rb +2 -5
  160. data/mod/follow/set/right/following.rb +1 -1
  161. data/mod/follow/spec/set/all/follow_spec.rb +3 -3
  162. data/mod/follow/spec/set/all/notify_spec.rb +1 -1
  163. data/mod/follow/spec/set/right/followers_spec.rb +2 -2
  164. data/mod/history/lib/card/act.rb +3 -1
  165. data/mod/history/lib/card/action.rb +3 -3
  166. data/mod/history/lib/card/action/admin.rb +0 -11
  167. data/mod/history/set/all/history_bridge.rb +1 -1
  168. data/mod/machines/file/all_script_machine_output/file.js +38415 -69
  169. data/mod/machines/file/all_style_machine_output/file.css +2 -2
  170. data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
  171. data/mod/machines/lib/javascript/decko/filter.js.coffee +7 -1
  172. data/mod/machines/lib/javascript/decko/filter_links.js.coffee +13 -2
  173. data/mod/machines/lib/javascript/decko/link_editor.js.coffee +64 -0
  174. data/mod/machines/lib/javascript/decko/mod.js.coffee +3 -0
  175. data/mod/machines/lib/javascript/decko/nest_editor.js.coffee +49 -29
  176. data/mod/machines/lib/javascript/decko/nest_editor_name.js.coffee +30 -7
  177. data/mod/machines/lib/javascript/decko/slot.js.coffee +4 -1
  178. data/mod/machines/lib/stylesheets/style_cards.scss +31 -19
  179. data/mod/machines/set/abstract/machine/output_cache.rb +1 -1
  180. data/mod/machines/set/abstract/machine/output_update.rb +1 -1
  181. data/mod/machines/set/all/reset_machines.rb +2 -2
  182. data/mod/machines/set/self/script_decko.rb +1 -0
  183. data/mod/media/set/abstract/media.rb +1 -1
  184. data/mod/media/set/type/image.rb +1 -1
  185. data/mod/navbar/set/abstract/account_dropdown.rb +5 -1
  186. data/mod/navbar/set/right/enabled_roles.rb +1 -1
  187. data/mod/navbar/set/self/account_links.rb +1 -1
  188. data/mod/pointer/set/abstract/02_pointer.rb +1 -1
  189. data/mod/pointer/set/abstract/02_pointer/events.rb +30 -10
  190. data/mod/pointer/set/abstract/02_pointer/html_views.rb +6 -2
  191. data/mod/pointer/set/abstract/02_pointer/html_views/autocomplete_input.haml +1 -1
  192. data/mod/pointer/set/abstract/02_pointer/html_views/filter.rb +1 -1
  193. data/mod/pointer/set/abstract/02_pointer/item_api.rb +51 -31
  194. data/mod/pointer/set/abstract/id_pointer.rb +21 -0
  195. data/mod/pointer/set/type/link_list.rb +1 -1
  196. data/mod/pointer/set/type/mirror_list.rb +1 -1
  197. data/mod/pointer/set/type/mirrored_list.rb +2 -2
  198. data/mod/pointer/spec/set/abstract/paging_params_spec.rb +1 -1
  199. data/mod/pointer/spec/set/abstract/pointer/item_api_spec.rb +1 -1
  200. data/mod/recaptcha/set/all/recaptcha.rb +4 -9
  201. data/mod/rules/set/rule/editor.rb +2 -2
  202. data/mod/rules/set/type/set/html_views/rule_lists.rb +1 -1
  203. data/mod/rules/spec/set/type/set_spec.rb +1 -1
  204. data/mod/search/set/abstract/03_filter/filter_form.haml +1 -1
  205. data/mod/search/set/abstract/03_filter/filter_form.rb +23 -2
  206. data/mod/search/set/abstract/03_filter/quick_filters.haml +7 -10
  207. data/mod/search/template/abstract/search/checkbox_item.haml +5 -6
  208. data/mod/settings/set/abstract/permission.rb +2 -2
  209. data/mod/settings/set/right/input_type.rb +3 -3
  210. data/mod/settings/set/right/structure.rb +1 -1
  211. data/mod/settings/set/right/style.rb +1 -1
  212. data/mod/settings/set/type/setting.rb +2 -2
  213. data/mod/standard/set/all/rich_html/html_views/guide.rb +1 -1
  214. data/mod/standard/set/all/rich_html/menu.rb +6 -5
  215. data/mod/standard/set/self/cardtype.rb +1 -1
  216. data/mod/standard/set/type/cardtype.rb +33 -17
  217. data/mod/standard/set/type/session.rb +12 -0
  218. data/mod/standard/spec/set/type/email_template/email_config_spec.rb +1 -2
  219. data/mod/standard/spec/set/type/email_template_spec.rb +1 -3
  220. data/mod/tinymce_editor/lib/javascript/script_tinymce_config.js.coffee +3 -2
  221. data/mod/tinymce_editor/public/assets/tinymce/plugins/nest/plugin.min.js +1 -1
  222. data/mod/tinymce_editor/set/all/reference_editor.rb +23 -0
  223. data/mod/tinymce_editor/set/all/reference_editor/_link_editor.haml +18 -0
  224. data/mod/tinymce_editor/set/all/reference_editor/_nest_editor.haml +17 -0
  225. data/mod/tinymce_editor/set/all/reference_editor/link_editor.rb +33 -0
  226. data/mod/tinymce_editor/set/all/reference_editor/link_editor/link_parser.rb +35 -0
  227. data/mod/tinymce_editor/set/all/reference_editor/nest_editor.rb +174 -0
  228. data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/_help.haml +0 -0
  229. data/mod/tinymce_editor/set/all/reference_editor/nest_editor/_options.haml +12 -0
  230. data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/_options_select.haml +0 -0
  231. data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/_options_select_row.haml +0 -0
  232. data/mod/{edit/set/all → tinymce_editor/set/all/reference_editor}/nest_editor/nest_parser.rb +7 -1
  233. data/mod/tinymce_editor/set/all/reference_editor/nest_image.rb +70 -0
  234. data/mod/tinymce_editor/set/all/reference_editor/reference_editor.haml +18 -0
  235. metadata +39 -21
  236. data/mod/account/set/abstract/accounted.rb +0 -15
  237. data/mod/edit/set/all/bridge/account_section.rb +0 -16
  238. data/mod/edit/set/all/nest_editor.rb +0 -122
  239. data/mod/edit/set/all/nest_editor/_options.haml +0 -12
  240. data/mod/edit/set/all/nest_editor/nest_editor.haml +0 -31
  241. data/mod/edit/set/all/nest_image.rb +0 -37
@@ -0,0 +1,33 @@
1
+ format :html do
2
+ view :link_editor, cache: :never, unknown: true,
3
+ wrap: {
4
+ slot: { class: "_overlay d0-card-overlay card nodblclick" }
5
+ } do
6
+ link_editor :overlay
7
+ end
8
+
9
+ view :modal_link_editor, cache: :never, unknown: true,
10
+ wrap: { slot: { class: "nodblclick" } } do
11
+ modal_link_editor
12
+ end
13
+
14
+ def link_editor editor_mode
15
+ @tm_snippet_editor_mode = editor_mode
16
+ haml :reference_editor, ref_type: :link, editor_mode: @tm_snippet_editor_mode,
17
+ apply_opts: link_apply_opts, snippet: link_snippet
18
+ end
19
+
20
+ def modal_link_editor
21
+ wrap_with :modal do
22
+ link_editor :modal
23
+ end
24
+ end
25
+
26
+ def link_snippet
27
+ @link_snippet ||= LinkParser.new params[:tm_snippet_raw]
28
+ end
29
+
30
+ def link_apply_opts
31
+ apply_tm_snippet_data link_snippet
32
+ end
33
+ end
@@ -0,0 +1,35 @@
1
+ #! no set module
2
+
3
+ # Extracts all information needed to generate the link editor form
4
+ # from a link syntax string
5
+ class LinkParser
6
+ attr_reader :name, :options, :field, :raw
7
+
8
+ def self.new link_string
9
+ return super if link_string.is_a? String
10
+
11
+ OpenStruct.new(name: "", options: {}, raw: "[[ ]]")
12
+ end
13
+
14
+ def initialize link_string
15
+ @raw = link_string
16
+ link = Card::Content::Chunk::Link.new link_string, nil
17
+ init_name link.name
18
+ @options = link.options
19
+ end
20
+
21
+ def title
22
+ @options && @options[:title]
23
+ end
24
+
25
+ def field?
26
+ @field
27
+ end
28
+
29
+ private
30
+
31
+ def init_name name
32
+ @field = name.to_name.simple_relative?
33
+ @name = @field ? name.to_s[1..-1] : name
34
+ end
35
+ end
@@ -0,0 +1,174 @@
1
+ format :html do
2
+ NEST_OPTIONS = %i[view title show hide wrap help variant size params].freeze
3
+ # Card::View::Options.shark_keys - %i[nest_syntax nest_name items cache]
4
+ # TODO: connect to Card::View::Options
5
+ # (that way a mod can add an option that becomes available to nests)
6
+
7
+ view :nest_editor, cache: :never, unknown: true,
8
+ wrap: {
9
+ slot: { class: "_overlay d0-card-overlay card nodblclick" }
10
+ } do
11
+ nest_editor :overlay
12
+ end
13
+
14
+ view :modal_nest_editor, cache: :never, unknown: true,
15
+ wrap: { slot: { class: "nodblclick" } } do
16
+ modal_nest_editor
17
+ end
18
+
19
+ view :nest_content, perms: :create, cache: :never, unknown: true, wrap: :slot do
20
+ if card.known?
21
+ known_nest_content
22
+ else
23
+ unknown_nest_content
24
+ end
25
+ end
26
+
27
+ def nest_editor editor_mode
28
+ @tm_snippet_editor_mode = editor_mode
29
+ voo.hide :content_tab unless show_content_tab?
30
+ haml :reference_editor, ref_type: :nest, editor_mode: @tm_snippet_editor_mode,
31
+ apply_opts: nest_apply_opts,
32
+ snippet: nest_snippet
33
+ end
34
+
35
+ def nest_editor_tabs
36
+ tabs = {}
37
+ tabs[:content] = nest_content_tab if voo.show? :content_tab
38
+ static_tabs(tabs.merge(
39
+ options: haml(:_options, snippet: nest_snippet),
40
+ rules: nest_rules_tab,
41
+ help: haml(:_help)
42
+ ),
43
+ default_active_tab, "tabs")
44
+ end
45
+
46
+ def show_content_tab?
47
+ !card.is_structure?
48
+ end
49
+
50
+ def default_active_tab
51
+ voo.show?(:content_tab) ? :content : :options
52
+ end
53
+
54
+ def nest_content_tab
55
+ name_dependent_slot do
56
+ @nest_content_tab || nest(card.name.field(nest_snippet.name),
57
+ view: :nest_content, hide: :guide)
58
+ end
59
+ end
60
+
61
+ def nest_rules_tab
62
+ name_dependent_slot do
63
+ nest(set_name_for_nest_rules, view: :nest_rules)
64
+ end
65
+ end
66
+
67
+ def name_dependent_slot
68
+ result = [empty_nest_name_alert(nest_snippet.name.blank?)]
69
+ result <<
70
+ if nest_snippet.name.blank?
71
+ content_tag :div, "", class: "card-slot" # placeholder
72
+ else
73
+ yield
74
+ end
75
+ result
76
+ end
77
+
78
+ def empty_nest_name_alert show
79
+ alert :warning, false, false,
80
+ class: "mb-0 _empty-nest-name-alert #{'d-none' unless show}" do
81
+ "nest name required" # LOCALIZE
82
+ end
83
+ end
84
+
85
+ def modal_nest_editor
86
+ wrap_with :modal do
87
+ nest_editor :modal
88
+ end
89
+ end
90
+
91
+ def nest_snippet
92
+ @nest_snippet ||= NestParser.new params[:tm_snippet_raw],
93
+ default_nest_view, default_item_view
94
+ end
95
+
96
+ def left_type_for_nest_editor_set_selection
97
+ card.type_name
98
+ end
99
+
100
+ def set_name_for_nest_rules
101
+ nest_name = nest_snippet.name
102
+ if left_type_for_nest_editor_set_selection
103
+ [left_type_for_nest_editor_set_selection, nest_name, :type_plus_right]
104
+ else
105
+ [nest_name, :right]
106
+ end
107
+ end
108
+
109
+ def default_nest_editor_item_options
110
+ [[:view, default_item_view]]
111
+ end
112
+
113
+ def nest_option_name_select selected=nil, level=0
114
+ classes = "form-control form-control-sm _nest-option-name"
115
+ classes += " _new-row" unless selected
116
+ select_tag "nest_option_name_#{unique_id}",
117
+ nest_option_name_select_options(selected, level),
118
+ class: classes, id: nil
119
+ # id: nil ensures that select2 generates its own unique identifier
120
+ # that ensures that we can clone this tag without breaking select2
121
+ end
122
+
123
+ def nest_option_name_select_options selected, level
124
+ options = selected ? [] : ["--"]
125
+ options += NEST_OPTIONS
126
+ options_for_select(
127
+ options, disabled: nest_option_name_disabled(selected, level),
128
+ selected: selected
129
+ )
130
+ end
131
+
132
+ def nest_option_name_disabled selected, level
133
+ disabled = if level == 0
134
+ nest_snippet.options
135
+ else
136
+ nest_snippet.item_options[level - 1] || default_nest_editor_item_options
137
+ end
138
+
139
+ disabled = disabled&.map(&:first)
140
+ disabled&.delete selected if selected
141
+ disabled
142
+ end
143
+
144
+ def nest_apply_opts
145
+ apply_tm_snippet_data nest_snippet
146
+ end
147
+
148
+ def nest_option_value_select value=nil
149
+ # select_tag "nest_option_value_#{unique_id}"
150
+ text_field_tag "value", value,
151
+ class: "_nest-option-value form-control form-control-sm",
152
+ disabled: !value,
153
+ id: nil
154
+ end
155
+
156
+ def known_nest_content
157
+ voo.hide! :cancel_button
158
+ add_name_context
159
+ with_nest_mode :edit do
160
+ frame do
161
+ [
162
+ render_edit_inline
163
+ ]
164
+ end
165
+ end
166
+ end
167
+
168
+ def unknown_nest_content
169
+ voo.hide! :guide
170
+ voo.show! :new_type_formgroup
171
+ new_view_frame_and_form buttons: new_image_buttons,
172
+ success: { tinymce_id: Env.params[:tinymce_id] }
173
+ end
174
+ end
@@ -0,0 +1,12 @@
1
+ .options-container.p-2.border-bottom
2
+ = haml_partial :options_select, template: false, level: 0, data: snippet.options
3
+ - snippet.item_options.each_with_index do |options, i|
4
+ .options-container.p-2.border-bottom._configure-items
5
+ %h6
6
+ = "#{'sub' * i} items"
7
+ = haml_partial :options_select, template: false, level: i + 1, data: options
8
+ .options-container.p-2.border-bottom._configure-items
9
+ = button_tag "Configure #{'sub' * snippet.item_options.size}items", situation: "secondary", class: "_configure-items-button btn-sm"
10
+ = haml_partial :options_select, template: true, level: snippet.item_options.size + 1, data: default_nest_editor_item_options
11
+
12
+
@@ -13,6 +13,11 @@ class NestParser
13
13
  raw: "{{+|view: #{default_view}}}")
14
14
  end
15
15
 
16
+ def self.new_image name
17
+ OpenStruct.new(name: name, field?: true, options: [%i[size medium]], item_options: [],
18
+ raw: "{{+#{name}|size: medium}}")
19
+ end
20
+
16
21
  def field?
17
22
  @field
18
23
  end
@@ -34,7 +39,8 @@ class NestParser
34
39
  end
35
40
 
36
41
  def extract_options options
37
- Card::Set::All::NestEditor::NEST_OPTIONS.each_with_object([]) do |key, res|
42
+ Card::Set::All::ReferenceEditor::NestEditor::NEST_OPTIONS
43
+ .each_with_object([]) do |key, res|
38
44
  next unless options[key]
39
45
 
40
46
  if key.in? %i[show hide]
@@ -0,0 +1,70 @@
1
+ format :html do
2
+ view :nest_image, unknown: true, cache: :never,
3
+ wrap: {
4
+ slot: { class: "_overlay d0-card-overlay card nodblclick" }
5
+ } do
6
+ nest_image_editor :overlay
7
+ end
8
+
9
+ view :modal_nest_image, unknown: true, cache: :never,
10
+ wrap: { slot: { class: "nodblclick" } } do
11
+ nest_image_editor :modal
12
+ end
13
+
14
+ view :new_image, perms: :create, unknown: true, cache: :never do
15
+ new_view_frame_and_form new_image_form_opts
16
+ end
17
+
18
+ def nest_image_editor editor_mode
19
+ adapt_reference_editor_for_images
20
+ nest_editor editor_mode
21
+ end
22
+
23
+
24
+ def adapt_reference_editor_for_images
25
+ nest_name = card.autoname(card.name.field("image01"))
26
+ voo.show! :content_tab
27
+ @nest_content_tab = nest(nest_name, view: :new_image, type: :image, hide: :guide)
28
+
29
+ image_name = nest_name.to_name.right
30
+ @nest_snippet = NestEditor::NestParser.new_image image_name
31
+ end
32
+
33
+
34
+ def new_image_form_opts
35
+ { buttons: new_image_buttons,
36
+ success: { tinymce_id: Env.params[:tinymce_id],
37
+ view: :open } }
38
+ end
39
+
40
+ def new_image_buttons
41
+ button_formgroup do
42
+ [standard_save_button(no_origin_update: true, class: "_change-create-to-update")]
43
+ end
44
+ end
45
+ end
46
+
47
+ format :js do
48
+ view :change_create_to_update, unknown: true do
49
+ tm_id = if Env.params[:tinymce_id].present?
50
+ "\"#{Env.params[:tinymce_id]}\""
51
+ else
52
+ '$(".tinymce-textarea").attr("id")'
53
+ end
54
+ <<-JAVASCRIPT.strip_heredoc
55
+ nest.changeCreateToUpdate(#{tm_id});
56
+ JAVASCRIPT
57
+ end
58
+
59
+ view :open_nest_editor, unknown: true do
60
+ tm_id = if Env.params[:tinymce_id].present?
61
+ "\"#{Env.params[:tinymce_id]}\""
62
+ else
63
+ '$(".tinymce-textarea").attr("id")'
64
+ end
65
+ <<-JAVASCRIPT.strip_heredoc
66
+ tm = tinymce.get(#{tm_id});
67
+ nest.insertNest(tm, "{{+#{card.name.tag}|size: medium}}");
68
+ JAVASCRIPT
69
+ end
70
+ end
@@ -0,0 +1,18 @@
1
+ %div._nest-editor
2
+ .nest-header.d-flex.ml-2
3
+ %h5.mt-1
4
+ = ref_type.capitalize
5
+ .ml-auto
6
+ = link_to fa_icon(:close), path: "#", "data-dismiss": editor_mode, class: "text-dark p-1 ml-1"
7
+
8
+ .form
9
+ = haml_partial "#{ref_type}_editor", snippet: snippet
10
+
11
+ .card-footer.p-0
12
+ .preview.mx-1.my-1.form-control-feedback
13
+ = text_field_tag "preview", snippet.raw, class: "_#{ref_type}-preview w-100 text-muted", readonly: true
14
+ %hr.mt-1.mb-1
15
+ .form-group-inline.d-flex.justify-content-center.py-2
16
+ = button_tag (modal_tm_snippet_editor? ? "Apply and Close" : "Apply"), apply_opts.merge(class: "_#{ref_type}-apply btn-sm mr-3")
17
+ %a.border-light.text-dark.btn.btn-sm.btn-outline-secondary{"data-dismiss": editor_mode, href: "#"}
18
+ = modal_tm_snippet_editor? ? "Cancel" : "Close"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.99.1
4
+ version: 1.99.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-10-16 00:00:00.000000000 Z
14
+ date: 2020-02-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: cardname
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.9.1
22
+ version: 0.9.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.9.1
29
+ version: 0.9.2
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: haml
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -362,6 +362,7 @@ files:
362
362
  - config/initializers/02_patches/active_support.rb
363
363
  - config/initializers/02_patches/better_errors.rb
364
364
  - config/initializers/02_patches/kaminari.rb
365
+ - config/initializers/02_patches/zeitwerk.rb
365
366
  - config/initializers/core_extensions.rb
366
367
  - config/initializers/deck_config.rb
367
368
  - config/initializers/delayed_job_config.rb
@@ -372,6 +373,7 @@ files:
372
373
  - config/initializers/patches.rb
373
374
  - config/initializers/recaptcha.rb
374
375
  - config/initializers/uuid_state_file.rb
376
+ - config/initializers/zeitwerk.rb
375
377
  - config/locales/de.yml
376
378
  - config/locales/en.yml
377
379
  - config/locales/es.yml
@@ -494,6 +496,9 @@ files:
494
496
  - db/migrate_core_cards/20190909104250_add_cardtype_input_types.rb
495
497
  - db/migrate_core_cards/20190918200115_ensure_description_card.rb
496
498
  - db/migrate_core_cards/20191008201046_fixture_fix.rb
499
+ - db/migrate_core_cards/20191028135243_add_link_editor_to_tiny_mce_config.rb
500
+ - db/migrate_core_cards/20191115160748_history_cleanup.rb
501
+ - db/migrate_core_cards/20191118145629_codename_fixes.rb
497
502
  - db/migrate_core_cards/data/1.11_help_text.json
498
503
  - db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss
499
504
  - db/migrate_core_cards/data/1.12_stylesheets/common.scss
@@ -630,14 +635,16 @@ files:
630
635
  - lib/card/codename.rb
631
636
  - lib/card/content.rb
632
637
  - lib/card/content/chunk.rb
638
+ - lib/card/content/chunk/abstract.rb
633
639
  - lib/card/content/clean.rb
634
640
  - lib/card/content/diff.rb
635
- - lib/card/content/diff/lcs.rb
636
- - lib/card/content/diff/processor.rb
641
+ - lib/card/content/diff/l_c_s.rb
642
+ - lib/card/content/diff/l_c_s/processor.rb
637
643
  - lib/card/content/diff/result.rb
638
644
  - lib/card/content/parser.rb
639
645
  - lib/card/content/truncate.rb
640
646
  - lib/card/dirty.rb
647
+ - lib/card/dirty/method_factory.rb
641
648
  - lib/card/env.rb
642
649
  - lib/card/env/location.rb
643
650
  - lib/card/env/location_history.rb
@@ -678,6 +685,7 @@ files:
678
685
  - lib/card/mod/loader/set_loader.rb
679
686
  - lib/card/mod/loader/set_pattern_loader.rb
680
687
  - lib/card/mod/module_template.rb
688
+ - lib/card/mod_inflector.rb
681
689
  - lib/card/model/save_helper.rb
682
690
  - lib/card/name.rb
683
691
  - lib/card/name/fields_and_traits.rb
@@ -709,6 +717,7 @@ files:
709
717
  - lib/card/reference.rb
710
718
  - lib/card/seed_consts.rb
711
719
  - lib/card/set.rb
720
+ - lib/card/set/abstract.rb
712
721
  - lib/card/set/advanced_api.rb
713
722
  - lib/card/set/basket.rb
714
723
  - lib/card/set/code_nest.rb
@@ -728,9 +737,11 @@ files:
728
737
  - lib/card/set/i18n_scope.rb
729
738
  - lib/card/set/inheritance.rb
730
739
  - lib/card/set/loader.rb
740
+ - lib/card/set/pattern.rb
741
+ - lib/card/set/pattern/base.rb
731
742
  - lib/card/set/required_field.rb
732
743
  - lib/card/set/trait.rb
733
- - lib/card/set_pattern.rb
744
+ - lib/card/set/type.rb
734
745
  - lib/card/subcards.rb
735
746
  - lib/card/subcards/add.rb
736
747
  - lib/card/subcards/relate.rb
@@ -782,7 +793,7 @@ files:
782
793
  - mod/Modfile
783
794
  - mod/account/README.md
784
795
  - mod/account/set/abstract/account_field.rb
785
- - mod/account/set/abstract/accounted.rb
796
+ - mod/account/set/abstract/accountable.rb
786
797
  - mod/account/set/all/account.rb
787
798
  - mod/account/set/right/account.rb
788
799
  - mod/account/set/right/account/events.rb
@@ -801,6 +812,7 @@ files:
801
812
  - mod/account/set/type/user.rb
802
813
  - mod/account/set/type/user/setup_help.haml
803
814
  - mod/account/set/type_plus_right/user/email.rb
815
+ - mod/account/spec/set/abstract/accountable_spec.rb
804
816
  - mod/account/spec/set/all/account_spec.rb
805
817
  - mod/account/spec/set/right/account_spec.rb
806
818
  - mod/account/spec/set/right/email_spec.rb
@@ -4105,7 +4117,7 @@ files:
4105
4117
  - mod/bootstrap/vendor/select2/vendor/jquery-2.1.0.js
4106
4118
  - mod/carrierwave/Gemfile
4107
4119
  - mod/carrierwave/config/core_initializers/carrierwave.rb
4108
- - mod/carrierwave/lib/carrier_wave/cardmount.rb
4120
+ - mod/carrierwave/lib/carrier_wave/card_mount.rb
4109
4121
  - mod/carrierwave/lib/carrier_wave/file_card_uploader.rb
4110
4122
  - mod/carrierwave/lib/carrier_wave/image_card_uploader.rb
4111
4123
  - mod/carrierwave/set/abstract/attachment.rb
@@ -4933,7 +4945,6 @@ files:
4933
4945
  - mod/developer/spec/set/all/view_viz_spec.rb
4934
4946
  - mod/developer/spec/set/right/debug_spec.rb
4935
4947
  - mod/edit/set/all/bridge.rb
4936
- - mod/edit/set/all/bridge/account_section.rb
4937
4948
  - mod/edit/set/all/bridge/bridge.haml
4938
4949
  - mod/edit/set/all/bridge/bridge_pills.rb
4939
4950
  - mod/edit/set/all/bridge/follow_section.rb
@@ -4950,14 +4961,6 @@ files:
4950
4961
  - mod/edit/set/all/form_buttons.rb
4951
4962
  - mod/edit/set/all/form_elements.rb
4952
4963
  - mod/edit/set/all/formgroup.rb
4953
- - mod/edit/set/all/nest_editor.rb
4954
- - mod/edit/set/all/nest_editor/_help.haml
4955
- - mod/edit/set/all/nest_editor/_options.haml
4956
- - mod/edit/set/all/nest_editor/_options_select.haml
4957
- - mod/edit/set/all/nest_editor/_options_select_row.haml
4958
- - mod/edit/set/all/nest_editor/nest_editor.haml
4959
- - mod/edit/set/all/nest_editor/nest_parser.rb
4960
- - mod/edit/set/all/nest_image.rb
4961
4964
  - mod/edit/set/all/new.rb
4962
4965
  - mod/edit/set/all/overlay_guide.haml
4963
4966
  - mod/edit/set/all/overlay_guide.rb
@@ -4970,9 +4973,9 @@ files:
4970
4973
  - mod/edit/spec/set/all/editing_spec.rb
4971
4974
  - mod/edit/spec/set/all/form_elements_spec.rb
4972
4975
  - mod/edit/spec/set/all/form_spec.rb
4973
- - mod/edit/spec/set/all/nest_editor/nest_parser_spec.rb
4974
- - mod/edit/spec/set/all/nest_editor_spec.rb
4975
- - mod/edit/spec/set/all/nest_image_spec.rb
4976
+ - mod/edit/spec/set/all/reference_editor/nest_editor/nest_parser_spec.rb
4977
+ - mod/edit/spec/set/all/reference_editor/nest_editor_spec.rb
4978
+ - mod/edit/spec/set/all/reference_editor/nest_image_spec.rb
4976
4979
  - mod/email/README
4977
4980
  - mod/email/format/email_html_format.rb
4978
4981
  - mod/email/format/email_text_format.rb
@@ -5079,6 +5082,7 @@ files:
5079
5082
  - mod/machines/lib/javascript/decko/filter_links.js.coffee
5080
5083
  - mod/machines/lib/javascript/decko/follow.js.coffee
5081
5084
  - mod/machines/lib/javascript/decko/layout.js.coffee
5085
+ - mod/machines/lib/javascript/decko/link_editor.js.coffee
5082
5086
  - mod/machines/lib/javascript/decko/mod.js.coffee
5083
5087
  - mod/machines/lib/javascript/decko/modal.js.coffee
5084
5088
  - mod/machines/lib/javascript/decko/name_editor.js.coffee
@@ -5263,6 +5267,7 @@ files:
5263
5267
  - mod/pointer/set/abstract/02_pointer/options_api.rb
5264
5268
  - mod/pointer/set/abstract/02_pointer/other_views.rb
5265
5269
  - mod/pointer/set/abstract/code_pointer.rb
5270
+ - mod/pointer/set/abstract/id_pointer.rb
5266
5271
  - mod/pointer/set/right/content_options.rb
5267
5272
  - mod/pointer/set/self/input_options.rb
5268
5273
  - mod/pointer/set/self/script_editors.rb
@@ -5597,6 +5602,19 @@ files:
5597
5602
  - mod/tinymce_editor/public/assets/tinymce/themes/silver/theme.min.js
5598
5603
  - mod/tinymce_editor/public/assets/tinymce/tinymce.min.js
5599
5604
  - mod/tinymce_editor/set/abstract/tinymce_editor.rb
5605
+ - mod/tinymce_editor/set/all/reference_editor.rb
5606
+ - mod/tinymce_editor/set/all/reference_editor/_link_editor.haml
5607
+ - mod/tinymce_editor/set/all/reference_editor/_nest_editor.haml
5608
+ - mod/tinymce_editor/set/all/reference_editor/link_editor.rb
5609
+ - mod/tinymce_editor/set/all/reference_editor/link_editor/link_parser.rb
5610
+ - mod/tinymce_editor/set/all/reference_editor/nest_editor.rb
5611
+ - mod/tinymce_editor/set/all/reference_editor/nest_editor/_help.haml
5612
+ - mod/tinymce_editor/set/all/reference_editor/nest_editor/_options.haml
5613
+ - mod/tinymce_editor/set/all/reference_editor/nest_editor/_options_select.haml
5614
+ - mod/tinymce_editor/set/all/reference_editor/nest_editor/_options_select_row.haml
5615
+ - mod/tinymce_editor/set/all/reference_editor/nest_editor/nest_parser.rb
5616
+ - mod/tinymce_editor/set/all/reference_editor/nest_image.rb
5617
+ - mod/tinymce_editor/set/all/reference_editor/reference_editor.haml
5600
5618
  - mod/tinymce_editor/set/self/script_tinymce.rb
5601
5619
  - mod/tinymce_editor/set/self/script_tinymce_config.rb
5602
5620
  - mod/tinymce_editor/set/self/tiny_mce.rb