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,49 @@
1
+ def account
2
+ fetch :account, new: {}
3
+ end
4
+
5
+ def default_account_status
6
+ "active"
7
+ end
8
+
9
+ def current_account?
10
+ id && Auth.current_id == id
11
+ end
12
+
13
+ format :html do
14
+ def default_bridge_tab
15
+ card.current_account? ? :account_tab : super
16
+ end
17
+
18
+ view :account_tab do
19
+ bridge_pill_sections "Account" do
20
+ [["Settings", account_details_items],
21
+ ["Content", account_content_items]]
22
+ end
23
+ end
24
+
25
+ def show_account_tab?
26
+ card.account.real?
27
+ end
28
+
29
+ def account_formgroups
30
+ Auth.as_bot do
31
+ subformat(card.account)._render :content_formgroups, structure: true
32
+ end
33
+ end
34
+
35
+ def account_details_items
36
+ [
37
+ ["Email and Password", :account,
38
+ { path: { slot: { hide: %i[help_link bridge_link] } } }],
39
+ ["Roles", :roles,
40
+ { path: { view: :content_with_edit_button } }],
41
+ ["Notifications", :follow]
42
+ ]
43
+ end
44
+
45
+ def account_content_items
46
+ [["Created", :created],
47
+ ["Edited", :edited]]
48
+ end
49
+ end
@@ -5,7 +5,7 @@ module ClassMethods
5
5
  end
6
6
 
7
7
  def account
8
- fetch trait: :account
8
+ fetch :account
9
9
  end
10
10
 
11
11
  def parties
@@ -63,7 +63,7 @@ def enabled_role_ids
63
63
  # workaround for broken migrations
64
64
  return fetch_roles unless Card::Codename.exists? :enabled_roles
65
65
 
66
- role_trait = fetch(trait: :enabled_roles, new: { type_id: SessionID })
66
+ role_trait = fetch(:enabled_roles, new: { type_id: Card::SessionID })
67
67
  role_trait.virtual? ? role_trait.item_ids : fetch_roles
68
68
  end
69
69
  end
@@ -74,7 +74,7 @@ end
74
74
 
75
75
  def role_ids_from_roles_trait
76
76
  Auth.as_bot do
77
- role_trait = fetch trait: :roles
77
+ role_trait = fetch :roles
78
78
  role_trait ? role_trait.item_ids : []
79
79
  end
80
80
  end
@@ -36,7 +36,7 @@ end
36
36
 
37
37
  def send_account_email email_template
38
38
  ecard = Card[email_template]
39
- unless ecard&.type_id == EmailTemplateID
39
+ unless ecard&.type_id == Card::EmailTemplateID
40
40
  raise Card::Error, "invalid email template: #{email_template}"
41
41
  end
42
42
 
@@ -23,7 +23,7 @@ end
23
23
 
24
24
  event :signout, :validate, on: :delete do
25
25
  Env.reset_session
26
- Auth.signin AnonymousID
26
+ Auth.signin Card::AnonymousID
27
27
  abort :success
28
28
  end
29
29
 
@@ -38,7 +38,7 @@ def ok_to_read
38
38
  true
39
39
  end
40
40
 
41
- def consider_recaptcha?
41
+ def recaptcha_on?
42
42
  false
43
43
  end
44
44
 
@@ -1,5 +1,5 @@
1
1
  def disabled?
2
- Auth.current&.fetch(trait: :disabled_roles)&.item_ids&.include? id
2
+ Auth.current&.fetch(:disabled_roles)&.item_ids&.include? id
3
3
  end
4
4
 
5
5
  format :html do
@@ -1,4 +1,4 @@
1
- include_set Abstract::Accounted
1
+ include_set Abstract::Accountable
2
2
 
3
3
  require_field :account
4
4
 
@@ -31,7 +31,7 @@ event :approve_without_verification, :validate, on: :update, trigger: :required
31
31
  end
32
32
 
33
33
  event :act_as_current_for_integrate_stage, :integrate, on: :create do
34
- Auth.current_id = id
34
+ Auth.signin id
35
35
  end
36
36
 
37
37
  def account_subfield
@@ -39,7 +39,7 @@ format :html do
39
39
  end
40
40
 
41
41
  def self_signup?
42
- card.creator_id == AnonymousID
42
+ card.creator_id == Card::AnonymousID
43
43
  end
44
44
 
45
45
  def account_lines
@@ -1,5 +1,5 @@
1
1
  include Basic
2
- include_set Abstract::Accounted
2
+ include_set Abstract::Accountable
3
3
 
4
4
  attr_accessor :email
5
5
 
@@ -0,0 +1,7 @@
1
+ RSpec.describe Card::Set::Abstract::Accountable do
2
+ def card_subject
3
+ Card["Joe User"]
4
+ end
5
+
6
+ check_html_views_for_errors
7
+ end
@@ -21,7 +21,7 @@ RSpec.describe Card::Set::All::Account do
21
21
  end
22
22
 
23
23
  it "updates when new roles are set" do
24
- roles_card = @joe_user_card.fetch trait: :roles, new: {}
24
+ roles_card = @joe_user_card.fetch :roles, new: {}
25
25
  r1 = Card["r1"]
26
26
 
27
27
  Card::Auth.as_bot { roles_card.items = [r1.id] }
@@ -29,7 +29,7 @@ RSpec.describe Card::Set::All::Account do
29
29
  # simulate new request
30
30
  # clears local cache, where, eg, @parties would still be cached on card
31
31
 
32
- Card::Auth.current_id = Card::Auth.current_id
32
+ Card::Auth.signin Card::Auth.current_id
33
33
  # simulate new request
34
34
  # current_id assignment clears several class variables
35
35
 
@@ -53,7 +53,7 @@ RSpec.describe Card::Set::All::Account do
53
53
  describe "+*email" do
54
54
  it "creates a card and account card" do
55
55
  jadmin = Card["joe admin"]
56
- Card::Auth.current_id = jadmin.id
56
+ Card::Auth.signin jadmin.id
57
57
  # simulate login to get correct from address
58
58
 
59
59
  Card::Env[:params] = { email: { subject: "Hey Joe!",
@@ -151,7 +151,7 @@ RSpec.describe Card::Set::Right::Account do
151
151
  before do
152
152
  @email = "joe@user.com"
153
153
  @account = Card::Auth.find_account_by_email(@email)
154
- Card::Auth.current_id = Card::AnonymousID
154
+ Card::Auth.signin Card::AnonymousID
155
155
  end
156
156
 
157
157
  let(:trigger_reset) { @account.update! trigger: :reset_password }
@@ -2,7 +2,7 @@
2
2
 
3
3
  RSpec.describe Card::Set::Type::Signup do
4
4
  before do
5
- Card::Auth.current_id = Card::AnonymousID
5
+ Card::Auth.signin Card::AnonymousID
6
6
  end
7
7
 
8
8
  let :big_bad_signup do
@@ -30,7 +30,7 @@ RSpec.describe Card::Set::Type::Signup do
30
30
  Card::Auth.as_bot do
31
31
  Card.create! name: "User+*type+*create", content: "[[Anyone]]"
32
32
  end
33
- Card::Auth.current_id = Card::AnonymousID
33
+ Card::Auth.signin Card::AnonymousID
34
34
 
35
35
  @signup = big_bad_signup
36
36
  @account = @signup.account
@@ -89,7 +89,7 @@ RSpec.describe Card::Set::Type::Signup do
89
89
  before do
90
90
  # NOTE: by default Anonymous does not have permission
91
91
  # to create User cards and thus requires approval
92
- Card::Auth.current_id = Card::AnonymousID
92
+ Card::Auth.signin Card::AnonymousID
93
93
  @signup = big_bad_signup
94
94
  @account = @signup.account
95
95
  end
@@ -172,7 +172,7 @@ RSpec.describe Card::Set::Type::Signup do
172
172
  before do
173
173
  # NOTE:
174
174
  # by default Anonymous does not have permission to create User cards.
175
- Card::Auth.current_id = Card::WagnBotID
175
+ Card::Auth.signin Card::WagnBotID
176
176
  @signup = big_bad_signup
177
177
  @account = @signup.account
178
178
  end
@@ -119,7 +119,7 @@ format :html do
119
119
  end
120
120
 
121
121
  def machine_cache_count
122
- Card::Virtual.where(right_id: MachineCacheID).count
122
+ Card::Virtual.where(right_id: Card::MachineCacheID).count
123
123
  end
124
124
 
125
125
  def delete_sessions_link months
@@ -6,8 +6,8 @@ format :html do
6
6
  view :core do
7
7
  warnings = []
8
8
  warnings << email_warning if Card.config.action_mailer.perform_deliveries == false
9
- if Card.config.recaptcha_public_key ==
10
- Card::Auth::Permissions::RECAPTCHA_DEFAULTS[:recaptcha_public_key] &&
9
+ if Card.config.recaptcha_site_key ==
10
+ Card::Auth::Permissions::RECAPTCHA_DEFAULTS[:recaptcha_site_key] &&
11
11
  card.rule(:captcha) == "1"
12
12
  warnings << recaptcha_warning
13
13
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
- require_dependency "card/version"
3
+ # require "card/version"
4
4
 
5
5
  def ok_to_read
6
6
  true
@@ -16,6 +16,10 @@ def item_names _args={}
16
16
  parse_content.keys
17
17
  end
18
18
 
19
+ def item_values
20
+ parse_content.values
21
+ end
22
+
19
23
  format :html do
20
24
  view :core do
21
25
  process_content ::CodeRay.scan(_render_raw, :json).div
@@ -2,7 +2,7 @@
2
2
 
3
3
  RSpec.describe Card::Set::Type::Html 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
  it "has special editor" do
@@ -16,12 +16,12 @@ class MigrateClassicSkinsToBootstrap < ActiveRecord::Migration[5.2]
16
16
 
17
17
  def change
18
18
  style_rule = Card[:all, :style]
19
- if style_rule.item_names.first.key.in? UNSUPPORTED_SKINS
19
+ if style_rule.first_name.key.in? UNSUPPORTED_SKINS
20
20
  style_rule.update! content: DEFAULT_SKIN
21
21
  end
22
22
 
23
23
  layout_rule = Card[:all, :layout]
24
- return unless layout_rule.item_names.first.key == UNSUPPORTED_LAYOUT
24
+ return unless layout_rule.first_name.key == UNSUPPORTED_LAYOUT
25
25
  layout_rule.update! content: DEFAULT_LAYOUT
26
26
  end
27
27
  end
@@ -2,7 +2,7 @@ class Bootstrap
2
2
  module ComponentLoader
3
3
  def load_components
4
4
  components.each do |component|
5
- require "component/#{component}"
5
+ require_relative "component/#{component}"
6
6
  include_component component
7
7
  end
8
8
  end
@@ -473,6 +473,7 @@ body.mceContentBody {
473
473
  > .bar-bottom {
474
474
  padding: 1em 1em 1em 2em;
475
475
  border-top: 0;
476
+ overflow: hidden;
476
477
  }
477
478
  }
478
479
 
@@ -68,7 +68,7 @@ end
68
68
 
69
69
  # reject cards that don't contribute directly to the content like skin or pointer cards
70
70
  def engine_input
71
- extended_input_cards.select { |ca| ca.type_id.in? [ScssID, CssID] }
71
+ extended_input_cards.select { |ca| ca.type_id.in? [Card::ScssID, Card::CssID] }
72
72
  end
73
73
 
74
74
  # Don't create "+*machine output" file card
@@ -19,7 +19,7 @@ format :html do
19
19
  else
20
20
  [tab_content, {}]
21
21
  end
22
- tab_buttons += tab_button("##{id}", tab_name, active_tab, button_attr)
22
+ tab_buttons += tab_button(id, tab_name, active_tab, button_attr)
23
23
  tab_panes += tab_pane(id, tab_name, tab_content, active_tab, args[:pane])
24
24
  end
25
25
  tab_panel tab_buttons, tab_panes, tab_type
@@ -57,7 +57,7 @@ format :html do
57
57
  def lazy_tab_button tab_name, id, url, active_tab
58
58
  return wrap_with(:li, tab_name, role: "presentation") unless url
59
59
  tab_button(
60
- "##{id}", tab_name, active_tab,
60
+ id, tab_name, active_tab,
61
61
  "data-url" => url.html_safe,
62
62
  class: (active_tab ? nil : "load")
63
63
  )
@@ -109,8 +109,8 @@ format :html do
109
109
 
110
110
  def tab_button target, text, active=false, link_attr={}
111
111
  add_class link_attr, "active" if active
112
- link = tab_button_link target, text, link_attr
113
- li_args = { role: :presentation, class: "nav-item tab-li-#{text.to_name.key}" }
112
+ link = tab_button_link "##{target}", text, link_attr
113
+ li_args = { role: :presentation, class: "nav-item tab-li-#{target}" }
114
114
  wrap_with :li, link, li_args
115
115
  end
116
116
 
@@ -70,13 +70,13 @@ event :copy_theme, :prepare_to_store, on: :create do
70
70
  end
71
71
 
72
72
  def initialize_theme style_item_names=nil
73
- add_subfield :colors, type_id: ScssID
73
+ add_subfield :colors, type_id: Card::ScssID
74
74
  add_variables_subfield
75
75
  add_stylesheets_subfield style_item_names
76
76
  end
77
77
 
78
78
  def add_stylesheets_subfield style_items=nil
79
- opts = { type_id: SkinID }
79
+ opts = { type_id: Card::SkinID }
80
80
  if theme_name
81
81
  theme_style = add_bootswatch_subfield
82
82
  opts[:content] = "[[#{theme_style.name}]]"
@@ -92,12 +92,13 @@ def add_variables_subfield
92
92
  theme_content = content_from_theme(:variables)
93
93
  default_content = Type::CustomizedBootswatchSkin.read_bootstrap_variables
94
94
  add_subfield :variables,
95
- type_id: ScssID,
95
+ type_id: Card::ScssID,
96
96
  content: "#{theme_content}\n\n\n#{default_content}"
97
97
  end
98
98
 
99
99
  def add_bootswatch_subfield
100
- add_subfield :bootswatch, type_id: ScssID, content: content_from_theme(:bootswatch)
100
+ add_subfield :bootswatch, type_id: Card::ScssID,
101
+ content: content_from_theme(:bootswatch)
101
102
  end
102
103
 
103
104
  def theme_card
@@ -1,6 +1,4 @@
1
- ActiveSupport.on_load :before_card do
2
- require "carrierwave"
3
- end
1
+ require "carrierwave"
4
2
 
5
3
  ActiveSupport.on_load :card do
6
4
  Card.extend CarrierWave::Mount
@@ -1,6 +1,7 @@
1
1
  require "carrierwave"
2
2
 
3
3
  module CarrierWave
4
+ # adapt carrierwave mount to cards
4
5
  module CardMount
5
6
  include CarrierWave::Mount
6
7
 
@@ -74,7 +75,6 @@ module CarrierWave
74
75
  assign_file(url) { super }
75
76
  end
76
77
 
77
-
78
78
  def assign_file file
79
79
  db_column = _mounter(:#{column}).serialization_column
80
80
  send(:"\#{db_column}_will_change!") # unless attribute_is_changing? db_column
@@ -103,7 +103,7 @@ module CarrierWave
103
103
  @#{column}_changed = true
104
104
  @#{column}_is_changing = true
105
105
  end
106
-
106
+
107
107
  def #{column}_is_changing?
108
108
  @#{column}_is_changing
109
109
  end
@@ -4,6 +4,20 @@ module CarrierWave
4
4
  @tmp_path ||= Card.paths["tmp"].existent.first
5
5
  end
6
6
  end
7
+
8
+ class SanitizedFile
9
+ def content_type
10
+ # the original content_type method doesn't seem to be very reliable
11
+ # It uses mime_magic_content_type - which returns invalid/invalid for css files
12
+ # that start with a comment - as the second option. (we switch the order and
13
+ # use it as the third option)
14
+ @content_type ||=
15
+ existing_content_type ||
16
+ mini_mime_content_type ||
17
+ mime_magic_content_type
18
+ end
19
+ end
20
+
7
21
  module Uploader
8
22
  # Implements a different name pattern for versions than CarrierWave's
9
23
  # default: we expect the version name at the end of the filename separated
@@ -52,7 +66,7 @@ module CarrierWave
52
66
  # ## Storage types
53
67
  # You can choose between four different storage options
54
68
  # - coded: These files are in the codebase, like the default logo.
55
- # Every view is a wagn request.
69
+ # Every view is a decko request.
56
70
  # - local: Uploaded files which are stored in a local upload directory
57
71
  # (upload path is configurable via config.paths["files"]).
58
72
  # If read permissions are set such that "Anyone" can read, then there is
@@ -180,14 +194,6 @@ module CarrierWave
180
194
  end.downcase
181
195
  end
182
196
 
183
- def content_type
184
- # the original file's content_type method doesn't seem to be very reliable
185
- # It uses mime_magic_content_type which returns invalid/invalid for css files
186
- # that start with a comment
187
- @content_type ||=
188
- file.send(:existing_content_type) || file.send(:mini_mime_content_type)
189
- end
190
-
191
197
  # generate identifier that gets stored in the card's db_content field
192
198
  # @param opts [Hash] generate an identifier using the given storage options
193
199
  # instead of the storage options derived from the model and
@@ -281,9 +287,17 @@ module CarrierWave
281
287
  model.selected_content_action_id || action_id_stand_in
282
288
  end
283
289
 
284
- # delegate carrierwave's fog config methods to cardio's config methods
290
+ # delegate carrierwave's fog config methods to bucket configuration
285
291
  ::CarrierWave::FileCardUploader::CONFIG_OPTIONS.each do |name|
286
- define_method("fog_#{name}") { @model.bucket_config[name] }
292
+ define_method("fog_#{name}") { bucket_config name }
293
+ end
294
+
295
+ def bucket_config option
296
+ @model.bucket_config[option]
297
+ end
298
+
299
+ def asset_host
300
+ bucket_config(:asset_host) || super
287
301
  end
288
302
 
289
303
  private
@@ -298,7 +312,8 @@ module CarrierWave
298
312
  case @model.storage_type
299
313
  when :cloud
300
314
  ::CarrierWave::Storage::Fog.new(self)
301
- else ::CarrierWave::Storage::File.new(self)
315
+ else
316
+ ::CarrierWave::Storage::File.new(self)
302
317
  end
303
318
  end
304
319
  end