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
@@ -1,3 +1,5 @@
1
+ load "card/set/type.rb" # "load" not "require" so pattern reloads properly
2
+
1
3
  def label name
2
4
  %(All "#{name}" cards)
3
5
  end
@@ -126,6 +126,11 @@ RSpec.describe Card::Content::Chunk::Nest do
126
126
  "Woot"
127
127
  end
128
128
 
129
+ it "handles triple curlies" do
130
+ card = Card.new content: "{{{A|name}}}"
131
+ expect(card.format._render_core).to eq("{A}")
132
+ end
133
+
129
134
  it "handles complex relative names" do
130
135
  bob_city = create! "bob+city", "Sparta"
131
136
  Card::Auth.as_bot do
@@ -178,8 +183,8 @@ RSpec.describe Card::Content::Chunk::Nest do
178
183
  create!("age")
179
184
  Card["*template"]
180
185
  specialtype = Card.create type_code: :cardtype, name: "SpecialType"
181
- specialtype_template = specialtype.fetch(trait: :type, new: {})
182
- .fetch(trait: :structure, new: {})
186
+ specialtype_template = specialtype.fetch(:type, new: {})
187
+ .fetch(:structure, new: {})
183
188
  specialtype_template.content = "{{#{Card::Name.joint}age}}"
184
189
  Card::Auth.as_bot { specialtype_template.save! }
185
190
  assert_equal "{{#{Card::Name.joint}age}}",
@@ -152,7 +152,7 @@ RSpec.describe Card::Set::All::Fetch do
152
152
 
153
153
  describe "preferences" do
154
154
  before do
155
- Card::Auth.current_id = Card::WagnBotID
155
+ Card::Auth.signin Card::WagnBotID
156
156
  end
157
157
 
158
158
  it "prefers db cards to pattern virtual cards" do
@@ -98,9 +98,9 @@ RSpec.describe Card::Set::All::Permissions do
98
98
 
99
99
  it "write user permissions" do
100
100
  Card::Auth.as_bot do
101
- @u1.fetch(trait: :roles, new: {}).items = [@r1, @r2]
102
- @u2.fetch(trait: :roles, new: {}).items = [@r1, @r3]
103
- @u3.fetch(trait: :roles, new: {}).items = [@r1, @r2, @r3]
101
+ @u1.fetch(:roles, new: {}).items = [@r1, @r2]
102
+ @u2.fetch(:roles, new: {}).items = [@r1, @r3]
103
+ @u3.fetch(:roles, new: {}).items = [@r1, @r2, @r3]
104
104
 
105
105
  (1..3).map do |num|
106
106
  Card.create name: "c#{num}+*self+*update", type: "Pointer",
@@ -121,8 +121,8 @@ RSpec.describe Card::Set::All::Permissions do
121
121
 
122
122
  it "read group permissions" do
123
123
  Card::Auth.as_bot do
124
- @u1.fetch(trait: :roles).items = [@r1, @r2]
125
- @u2.fetch(trait: :roles).items = [@r1, @r3]
124
+ @u1.fetch(:roles).items = [@r1, @r2]
125
+ @u2.fetch(:roles).items = [@r1, @r3]
126
126
 
127
127
  (1..3).each do |num|
128
128
  Card.create name: "c#{num}+*self+*read", type: "Pointer",
@@ -146,7 +146,7 @@ RSpec.describe Card::Set::All::Permissions do
146
146
  content: "[[r#{num}]]"
147
147
  end
148
148
 
149
- @u3.fetch(trait: :roles, new: {}).items = [@r1]
149
+ @u3.fetch(:roles, new: {}).items = [@r1]
150
150
  end
151
151
 
152
152
  # u1 u2 u3
@@ -166,9 +166,9 @@ RSpec.describe Card::Set::All::Permissions do
166
166
 
167
167
  it "read user permissions" do
168
168
  Card::Auth.as_bot do
169
- @u1.fetch(trait: :roles, new: {}).items = [@r1, @r2]
170
- @u2.fetch(trait: :roles, new: {}).items = [@r1, @r3]
171
- @u3.fetch(trait: :roles, new: {}).items = [@r1, @r2, @r3]
169
+ @u1.fetch(:roles, new: {}).items = [@r1, @r2]
170
+ @u2.fetch(:roles, new: {}).items = [@r1, @r3]
171
+ @u3.fetch(:roles, new: {}).items = [@r1, @r2, @r3]
172
172
 
173
173
  (1..3).each do |num|
174
174
  Card.create name: "c#{num}+*self+*read", type: "Pointer",
@@ -235,8 +235,7 @@ RSpec.describe Card::Set::All::Permissions do
235
235
  end
236
236
 
237
237
  it "role wql" do
238
- # warn "u1 roles #{Card[ @u1.id ].fetch(trait:
239
- # :roles).item_names.inspect}"
238
+ # warn "u1 roles #{Card[ @u1.id ].fetch(roles).item_names.inspect}"
240
239
 
241
240
  # set up cards of type TestType, 2 with nil reader, 1 with role1 reader
242
241
  Card::Auth.as_bot do
@@ -252,7 +251,7 @@ RSpec.describe Card::Set::All::Permissions do
252
251
  )
253
252
  end
254
253
  # for Card::Auth.as to be effective, you can't have a logged in user
255
- Card::Auth.current_id = nil
254
+ Card::Auth.signin nil
256
255
  Card::Auth.as(@u2) do
257
256
  expect(Card.search(content: "WeirdWord").map(&:name).sort).to(
258
257
  eq(%w[c2 c3])
@@ -2,7 +2,7 @@
2
2
 
3
3
  describe Card::Set::All::Rules do
4
4
  before do
5
- Card::Auth.current_id = Card::WagnBotID
5
+ Card::Auth.signin Card::WagnBotID
6
6
  end
7
7
 
8
8
  describe "setting data setup" do
@@ -68,7 +68,7 @@ describe Card::Set::All::Rules do
68
68
 
69
69
  describe "user specific rules" do
70
70
  before do
71
- Card::Auth.current_id = Card.fetch("Joe User").id
71
+ Card::Auth.signin "Joe User"
72
72
  end
73
73
 
74
74
  it "user rule is recognized as rule" do
@@ -107,7 +107,7 @@ describe Card::Set::All::Rules do
107
107
  it "returns all user with values for the given Set and rule" do
108
108
  Card::Auth.as_bot do
109
109
  Card.create(name: "Book+*type+Joe User+*follow", content: "[[Home]]")
110
- Card::Auth.current_id = Card.fetch("Joe Admin").id
110
+ Card::Auth.signin "Joe Admin"
111
111
  Card.create(name: "Book+*type+Joe Admin+*follow", content: "[[Home]]")
112
112
  user_ids = Card.all_user_ids_with_rule_for(
113
113
  Card.fetch("Book+*type"), :follow
@@ -54,9 +54,7 @@ format :html do
54
54
  end
55
55
 
56
56
  def default_bridge_tab
57
- (show_account_tab? && :account_tab) ||
58
- (show_guide_tab? && :guide_tab) ||
59
- :engage_tab
57
+ show_guide_tab? ? :guide_tab : :engage_tab
60
58
  end
61
59
 
62
60
  def breadcrumb_data title, html_class=nil
@@ -24,13 +24,6 @@ format :html do
24
24
  end
25
25
  end
26
26
 
27
- view :account_tab do
28
- bridge_pill_sections "Account" do
29
- [["Settings", account_details_items],
30
- ["Content", account_content_items]]
31
- end
32
- end
33
-
34
27
  view :follow_section, wrap: :slot, cache: :never do
35
28
  follow_section
36
29
  end
@@ -7,18 +7,16 @@ format :html do
7
7
 
8
8
  private
9
9
 
10
- def show_account_tab?
11
- return unless card.real?
12
-
13
- card.account&.ok?(:update)
14
- end
15
-
16
10
  def show_engage_tab?
17
11
  return unless card.real?
18
12
 
19
13
  show_follow? || show_discussion?
20
14
  end
21
15
 
16
+ def show_account_tab?
17
+ false
18
+ end
19
+
22
20
  def show_history_tab?
23
21
  card.real?
24
22
  end
@@ -50,6 +48,6 @@ format :html do
50
48
  def discussion_card
51
49
  return if card.new_card? || discussion_card?
52
50
 
53
- card.fetch trait: :discussion, skip_modules: true, new: {}
51
+ card.fetch :discussion, skip_modules: true, new: {}
54
52
  end
55
53
  end
@@ -38,7 +38,7 @@ format :html do
38
38
  end
39
39
 
40
40
  def new_cancel_button
41
- modal_cancel_button
41
+ voo.show?(:cancel_button) && modal_cancel_button
42
42
  end
43
43
 
44
44
  def delete_button opts={}
@@ -51,6 +51,7 @@ format :html do
51
51
 
52
52
  # redirect to *previous if no :href is given
53
53
  def cancel_button args={}
54
+ return unless voo.show? :cancel_button
54
55
  text = args.delete(:text) || "Cancel"
55
56
  add_class args, "btn btn-#{args.delete(:situation) || 'secondary'}"
56
57
  add_class args, cancel_strategy(args[:redirect], args[:href])
@@ -37,7 +37,7 @@ format :html do
37
37
  end
38
38
  end
39
39
 
40
- def new_view_frame_and_form form_opts
40
+ def new_view_frame_and_form form_opts={}
41
41
  buttons = form_opts.delete(:buttons) || _render_new_buttons
42
42
  form_opts = form_opts.reverse_merge(success: new_success)
43
43
 
@@ -61,7 +61,7 @@ format :html do
61
61
  buttons
62
62
  ]
63
63
  end),
64
- alert_guide]
64
+ (alert_guide if voo.show?(:guide))]
65
65
  end
66
66
  end
67
67
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  RSpec.describe Card::Set::All::Bridge::TabViews do
4
4
  check_views_for_errors :engage_tab, :history_tab, :related_tab, :rules_tab,
5
- :account_tab, :follow_section
5
+ :follow_section
6
6
 
7
7
  specify "view :related_tab" do
8
8
  expect_view(:related_tab).to have_tag :ul do
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- RSpec.describe Card::Set::All::NestEditor::NestParser do
3
+ RSpec.describe Card::Set::All::ReferenceEditor::NestEditor::NestParser do
4
4
  def parse nest
5
5
  described_class.new nest, :titled, :bar
6
6
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- RSpec.describe Card::Set::All::NestEditor do
3
+ RSpec.describe Card::Set::All::ReferenceEditor::NestEditor do
4
4
  describe "view: nest_editor" do
5
5
  check_html_views_for_errors
6
6
 
@@ -50,7 +50,10 @@ RSpec.describe Card::Set::All::NestEditor do
50
50
  end
51
51
  end
52
52
 
53
- example "with given field nest syntax", params: { edit_nest: "{{+hi|view: open; show: menu, toggle|view: titled}}" } do
53
+ example "with given field nest syntax",
54
+ params: {
55
+ tm_snippet_raw: "{{+hi|view: open; show: menu, toggle|view: titled}}"
56
+ } do
54
57
  expect_view(:nest_editor).to have_tag "div.nest_editor-view" do
55
58
  with_name "hi", true
56
59
  with_tag "div.options-container" do
@@ -69,7 +72,7 @@ RSpec.describe Card::Set::All::NestEditor do
69
72
  end
70
73
 
71
74
  example "with given non-field nest syntax",
72
- params: { edit_nest: "{{hi|view: open; show: menu, toggle}}" } do
75
+ params: { tm_snippet_raw: "{{hi|view: open; show: menu, toggle}}" } do
73
76
  expect_view(:nest_editor).to have_tag "div.nest_editor-view" do
74
77
  with_name "hi", false
75
78
  with_tag "div.options-container" do
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- RSpec.describe Card::Set::All::NestImage do
3
+ RSpec.describe Card::Set::All::ReferenceEditor::NestImage do
4
4
  describe "view: nest_image" do
5
5
  check_html_views_for_errors
6
6
 
@@ -7,7 +7,7 @@ format :html do
7
7
  end
8
8
 
9
9
  def test_context_card
10
- card.left.fetch(trait: :test_context)&.item_card
10
+ card.left.fetch(:test_context)&.item_card
11
11
  end
12
12
  end
13
13
 
@@ -21,7 +21,7 @@ def email_config context, fields={}, opts={}
21
21
  end
22
22
 
23
23
  def email_field_from_card field, auth, format_opts
24
- return unless (field_card = fetch(trait: field))
24
+ return unless (field_card = fetch(field))
25
25
  auth ||= field_card.updater
26
26
  special_email_field_method(field, field_card, auth, format_opts) ||
27
27
  standard_email_field(field, field_card, auth, format_opts)
@@ -35,7 +35,7 @@ end
35
35
 
36
36
  def notable_change?
37
37
  !silent_change? && current_act_card? &&
38
- (Card::Auth.current_id != WagnBotID) && followable?
38
+ (Card::Auth.current_id != Card::WagnBotID) && followable?
39
39
  end
40
40
 
41
41
  def silent_change?
@@ -45,7 +45,7 @@ format do
45
45
  view :unfollow_url, perms: :none, compact: true, cache: :never do
46
46
  return "" unless (rule_name = live_follow_rule_name)
47
47
 
48
- card_url path(mark: "#{active_notice(:follower)}+#{Card[:follow].name}",
48
+ card_url path(mark: "#{active_notice(:follower)}+#{:follow.cardname}",
49
49
  action: :update,
50
50
  card: { subcards: { rule_name => Card[:never].name } })
51
51
  end
@@ -1,13 +1,15 @@
1
1
  def send_change_notice act, followed_set, follow_option
2
- return unless changes_visible?(act)
2
+ return unless email.present? && changes_visible?(act)
3
3
 
4
+ notify_of_act act do
5
+ { follower: left.name, followed_set: followed_set, follow_option: follow_option }
6
+ end
7
+ end
8
+
9
+ def notify_of_act act
4
10
  Auth.as(left.id) do
5
11
  Card[:follower_notification_email].deliver(
6
- act.card, { to: email },
7
- auth: left,
8
- active_notice: { follower: left.name,
9
- followed_set: followed_set,
10
- follow_option: follow_option }
12
+ act.card, { to: email }, auth: left, active_notice: yield
11
13
  )
12
14
  end
13
15
  end
@@ -11,14 +11,11 @@ format :html do
11
11
  end
12
12
 
13
13
  def content
14
- return "" unless left
15
-
16
- item_names.map { |item| "[[#{item}]]" }.join "\n"
14
+ left ? item_names.to_pointer_content : ""
17
15
  end
18
16
 
19
17
  def item_names _args={}
20
- return [] unless left
21
- left.follow_set_card.prototype.follower_names
18
+ left ? left.follow_set_card.prototype.follower_names : []
22
19
  end
23
20
 
24
21
  def virtual?
@@ -28,7 +28,7 @@ format :html do
28
28
  end
29
29
 
30
30
  view :rule_editor, cache: :never do
31
- rule_context = Card.fetch preference_name, new: { type_id: PointerID }
31
+ rule_context = Card.fetch preference_name, new: { type_id: Card::PointerID }
32
32
  wrap_with :div, class: "edit-rule" do
33
33
  follow_context = current_follow_rule_card || rule_context
34
34
  subformat(follow_context).rule_form :open, rule_context, :modal
@@ -65,7 +65,7 @@ RSpec.describe Card::Set::All::Follow do
65
65
  # didn't check if it can be adjusted to knew follow ui
66
66
  xdescribe "view: follow_link" do
67
67
  before do
68
- Card::Auth.current_id = Card["Big Brother"].id
68
+ Card::Auth.signin "Big Brother"
69
69
  end
70
70
 
71
71
  def assert_following_view name, args
@@ -131,7 +131,7 @@ RSpec.describe Card::Set::All::Follow do
131
131
  end
132
132
 
133
133
  context "when following content I created" do
134
- before { Card::Auth.current_id = Card["Narcissist"].id }
134
+ before { Card::Auth.signin "Narcissist" }
135
135
 
136
136
  it "renders following link" do
137
137
  assert_following_view "Sunglasses", add_set: "Sunglasses+*self",
@@ -140,7 +140,7 @@ RSpec.describe Card::Set::All::Follow do
140
140
  end
141
141
 
142
142
  context "when following content I edited" do
143
- before { Card::Auth.current_id = Card["Narcissist"].id }
143
+ before { Card::Auth.signin "Narcissist" }
144
144
 
145
145
  it "renders following link" do
146
146
  assert_following_view "Magnifier+lens",
@@ -189,7 +189,7 @@ RSpec.describe Card::Set::All::Notify do
189
189
  end
190
190
 
191
191
  it "does not send notification to author of change" do
192
- Card::Auth.current_id = Card["Big Brother"].id
192
+ Card::Auth.signin "Big Brother"
193
193
  expect_user("Big Brother").not_to be_notified
194
194
  update "Google glass"
195
195
  end
@@ -82,7 +82,7 @@ RSpec.describe Card::Set::Right::Followers do
82
82
 
83
83
  context "when following content I created" do
84
84
  it "contains creator" do
85
- Card::Auth.current_id = Card["Big Brother"].id
85
+ Card::Auth.signin "Big Brother"
86
86
  card = Card.create! name: "created by Follower"
87
87
  expect(followers_of(card)).to include("Big Brother")
88
88
  end
@@ -95,7 +95,7 @@ RSpec.describe Card::Set::Right::Followers do
95
95
  end
96
96
 
97
97
  card = Card.create! name: "edited by Sara"
98
- Card::Auth.current_id = Card["Sara"].id
98
+ Card::Auth.signin "Sara"
99
99
  card.update! content: "some content"
100
100
  expect(followers_of(card)).to include("Sara")
101
101
  end
@@ -23,6 +23,8 @@ class Card
23
23
  class_name: "Card::Action"
24
24
  class << self
25
25
  # remove all acts that have no card. (janitorial)
26
+ #
27
+ # CAREFUL - could still have actions even if act card is gone...
26
28
  def delete_cardless
27
29
  left_join = "LEFT JOIN cards ON card_acts.card_id = cards.id"
28
30
  joins(left_join).where("cards.id IS NULL").delete_all
@@ -78,7 +80,7 @@ class Card
78
80
  # FIXME: if the following is necessary, we need to document why.
79
81
  # generally it's a very bad idea to have type-specific code here.
80
82
 
81
- # return res unless res&.type_id&.in?([FileID, ImageID])
83
+ # return res unless res&.type_id&.in?([Card::FileID, Card::ImageID])
82
84
  # res.include_set_modules
83
85
  end
84
86
 
@@ -21,8 +21,8 @@ class Card
21
21
  # * a _comment_ (where applicable)
22
22
  #
23
23
  class Action < ApplicationRecord
24
- include Card::Action::Differ
25
- extend Card::Action::Admin
24
+ include Differ
25
+ extend Admin
26
26
 
27
27
  belongs_to :act, foreign_key: :card_act_id, inverse_of: :ar_actions
28
28
  belongs_to :ar_card, foreign_key: :card_id, inverse_of: :actions, class_name: "Card"
@@ -86,7 +86,7 @@ class Card
86
86
  # specific types in here!
87
87
 
88
88
  # , skip_modules: true
89
- # return res unless res && res.type_id.in?([FileID, ImageID])
89
+ # return res unless res && res.type_id.in?([Card::FileID, Card::ImageID])
90
90
  # res.include_set_modules
91
91
  end
92
92