card 1.20.0 → 1.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/card.gemspec +1 -1
  4. data/lib/card.rb +7 -3
  5. data/lib/card/act_manager/stage_director.rb +22 -10
  6. data/lib/card/cache/persistent.rb +15 -9
  7. data/lib/card/format/nest.rb +12 -5
  8. data/lib/card/format/nest/fetch.rb +2 -1
  9. data/lib/card/format/render.rb +5 -2
  10. data/lib/card/set/event.rb +7 -1
  11. data/lib/card/subcards.rb +3 -3
  12. data/lib/card/view/cache.rb +1 -1
  13. data/lib/card/view/fetch.rb +17 -5
  14. data/lib/card/view/options.rb +52 -26
  15. data/lib/cardio.rb +2 -1
  16. data/mod/account/spec/set/right/account_spec.rb +17 -3
  17. data/mod/admin/set/self/admin.rb +0 -2
  18. data/mod/admin/spec/set/self/admin_spec.rb +14 -11
  19. data/mod/bootstrap/set/all/bootstrap/helper.rb +27 -29
  20. data/mod/carrierwave/set/type/file.rb +1 -1
  21. data/mod/carrierwave/set/type/image.rb +18 -6
  22. data/mod/core/set/all/collection.rb +33 -7
  23. data/mod/core/set/all/fetch.rb +16 -3
  24. data/mod/core/set/all/permissions.rb +6 -12
  25. data/mod/core/set/all/trash.rb +3 -1
  26. data/mod/core/spec/set/all/collection_spec.rb +9 -8
  27. data/mod/email/set/all/notify.rb +27 -17
  28. data/mod/email/set/right/follow.rb +49 -36
  29. data/mod/email/set/type/email_template.rb +25 -69
  30. data/mod/email/set/type/email_template/email_config.rb +63 -0
  31. data/mod/email/set/type_plus_right/user/follow.rb +3 -3
  32. data/mod/machines/lib/stylesheets/style_cards.scss +292 -0
  33. data/mod/pointer/set/abstract/01_pointer.rb +8 -8
  34. data/mod/pointer/set/abstract/01_pointer/edit.rb +6 -2
  35. data/mod/prosemirror_editor/lib/javascript/script_prosemirror.js +12283 -11605
  36. data/mod/prosemirror_editor/lib/javascript/script_prosemirror_config.js.coffee +1 -1
  37. data/mod/standard/set/abstract/01_search_params.rb +1 -1
  38. data/mod/standard/set/abstract/search/paging.rb +4 -4
  39. data/mod/standard/set/all/comment.rb +67 -47
  40. data/mod/standard/set/all/links.rb +2 -2
  41. data/mod/standard/set/all/rich_html/content.rb +1 -1
  42. data/mod/standard/set/all/rich_html/editing.rb +3 -2
  43. data/mod/standard/set/all/rich_html/form.rb +21 -12
  44. data/mod/standard/set/all/rich_html/header.rb +9 -0
  45. data/mod/standard/set/all/rich_html/menu.rb +16 -12
  46. data/mod/standard/set/all/rich_html/toolbar.rb +140 -130
  47. data/mod/standard/set/all/rich_html/wrapper.rb +11 -1
  48. data/mod/standard/set/rstar/rules_editor.rb +2 -34
  49. data/mod/standard/set/self/search.rb +1 -1
  50. data/mod/standard/set/type/set.rb +4 -4
  51. data/mod/standard/spec/set/type/email_template/email_config_spec.rb +218 -0
  52. data/mod/standard/spec/set/type/email_template_spec.rb +3 -185
  53. data/spec/lib/card/cache_spec.rb +0 -1
  54. data/spec/lib/card/format/render_spec.rb +19 -0
  55. data/spec/lib/card/stage_director_spec.rb +1 -1
  56. data/tmpsets/set/mod001-core/all/actify.rb +5 -6
  57. data/tmpsets/set/mod001-core/all/fetch.rb +14 -12
  58. data/tmpsets/set/mod001-core/all/name.rb +1 -1
  59. data/tmpsets/set/mod001-core/all/permissions.rb +12 -22
  60. data/tmpsets/set/mod001-core/all/tracked_attributes.rb +76 -0
  61. data/tmpsets/set/mod001-core/all/utils.rb +40 -3
  62. data/tmpsets/set/mod002-history/all/history.rb +1 -2
  63. data/tmpsets/set/mod008-solid_cache/abstract/solid_cache.rb +1 -1
  64. data/tmpsets/set/mod013-carrierwave/abstract/attachment.rb +282 -0
  65. data/tmpsets/set/mod013-carrierwave/type/file.rb +155 -0
  66. data/tmpsets/set/mod013-carrierwave/type/image.rb +96 -0
  67. data/tmpsets/set/mod014-admin/self/admin.rb +113 -0
  68. data/tmpsets/set/mod014-admin/self/admin_info.rb +110 -0
  69. data/tmpsets/set/mod014-admin/self/version.rb +15 -0
  70. data/tmpsets/set/mod015-developer/all/event_viz.rb +59 -0
  71. data/tmpsets/set/mod015-developer/all/view_viz.rb +30 -0
  72. data/tmpsets/set/mod015-developer/right/debug.rb +96 -0
  73. metadata +15 -2
@@ -0,0 +1,15 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; class Self; module Version; extend Card::Set
3
+ # ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/admin/set/self/version.rb ~~
4
+ # -*- encoding : utf-8 -*-
5
+ require_dependency "card/version"
6
+
7
+ view :raw do |_args|
8
+ Card::Version.release
9
+ end
10
+
11
+ view :core, :raw
12
+
13
+
14
+ # ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/admin/set/self/version.rb ~~
15
+ end;end;end;end;
@@ -0,0 +1,59 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; class All; module EventViz; extend Card::Set
3
+ # ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/event_viz.rb ~~
4
+ require_dependency 'active_support/callbacks_ext'
5
+
6
+ # the events method is a developer's tool for visualizing the event order
7
+ # for a given card.
8
+ # For example, from a console you might run
9
+ #
10
+ # puts mycard.events :update
11
+ #
12
+ # to see the order of events that will be executed on mycard.
13
+ # The indention and arrows (^v) indicate event dependencies.
14
+ #
15
+ # Note: as of yet, the functionality is a bit rough. It does not display events
16
+ # that are called directly from within other events,
17
+ # and certain event requirements (like the presence of a 'current_act') may
18
+ # prevent events from showing up in the tree.
19
+ def events action
20
+ @action = action
21
+ events = Card::Stage::STAGES.map { |stage| events_tree("#{stage}_stage") }
22
+ @action = nil
23
+ puts_events events
24
+ end
25
+
26
+ # private
27
+
28
+ def puts_events events, prefix="", depth=0
29
+ r = ""
30
+ depth += 1
31
+ events.each do |e|
32
+ space = " " * (depth * 2)
33
+
34
+ # FIXME: this is not right. before and around callbacks are processed in
35
+ # declaration order regardless of kind. not all befores then all arounds
36
+ e[:before] && r += puts_events(e[:before], space + "v ", depth)
37
+ e[:around] && r += puts_events(e[:around], space + "vv ", depth)
38
+ r += "#{prefix}#{e[:name]}\n"
39
+ e[:after] && r += puts_events(e[:after].reverse, space + "^ ", depth)
40
+ end
41
+ r
42
+ end
43
+
44
+ def events_tree filt
45
+ hash = { name: filt }
46
+ if respond_to? "_#{filt}_callbacks"
47
+ send("_#{filt}_callbacks").each do |callback|
48
+ next unless callback.applies? self
49
+ hash[callback.kind] ||= []
50
+ hash[callback.kind] << events_tree(callback.filter)
51
+ end
52
+ end
53
+
54
+ hash
55
+ end
56
+
57
+
58
+ # ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/event_viz.rb ~~
59
+ end;end;end;end;
@@ -0,0 +1,30 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; class All; module ViewViz; extend Card::Set
3
+ # ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/view_viz.rb ~~
4
+ format :html do
5
+ view :views_by_format do
6
+ format_views =
7
+ self.class.ancestors.each_with_object({}) do |format_class, hash|
8
+ views =
9
+ format_class.instance_methods.map do |method|
10
+ next unless method.to_s =~ /^_view_(.+)$/
11
+ Regexp.last_match(1)
12
+ end.compact
13
+ next unless views.present?
14
+ format_class.name =~ /^Card(::Set)?::(.+?)$/ #::(\w+Format)
15
+ hash[Regexp.last_match(2)] = views
16
+ end
17
+ accordion_group format_views
18
+ end
19
+
20
+ view :views_by_name do
21
+ views = methods.map do |method|
22
+ Regexp.last_match(1) if method.to_s =~ /^_view_(.+)$/
23
+ end.compact.sort
24
+ list_group views
25
+ end
26
+ end
27
+
28
+
29
+ # ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/all/view_viz.rb ~~
30
+ end;end;end;end;
@@ -0,0 +1,96 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; class Right; module Debug; extend Card::Set
3
+ # ~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/right/debug.rb ~~
4
+ def virtual?
5
+ true
6
+ end
7
+
8
+ format :html do
9
+ view :core do |_args|
10
+ subject = card.left
11
+
12
+ output [
13
+ ["Sets",
14
+ static_tabs("set modules" => set_modules_accordion(subject),
15
+ "all modules" => singleton_modules_list(subject),
16
+ "patterns" => set_patterns_breadcrumb(subject))],
17
+ ["Views",
18
+ static_tabs("by format" => subformat(subject)._render_views_by_format,
19
+ "by name" => subformat(subject)._render_views_by_name)],
20
+ ["Events",
21
+ static_tabs(create: "<pre>#{subject.events(:create)}</pre>",
22
+ update: "<pre>#{subject.events(:update)}</pre>",
23
+ delete: "<pre>#{subject.events(:delete)}</pre>")],
24
+ ["Cache/DB Comparison", cache_comparison_table(subject)]
25
+ ].map { |item| section(*item) }
26
+ end
27
+
28
+ # rubocop:disable AccessorMethodName
29
+ def set_modules_accordion subject
30
+ sets = subject.set_modules.each_with_object({}) do |sm, hash|
31
+ ans = sm.ancestors
32
+ ans.shift
33
+ hash[sm.to_s] = ans
34
+ end
35
+ accordion_group sets
36
+ end
37
+
38
+ def set_patterns_breadcrumb subject
39
+ links = subject.patterns.reverse.map { |pattern| card_link pattern.to_s }
40
+ breadcrumb(links)
41
+ end
42
+ # rubocop:enable AccessorMethodName
43
+
44
+ def singleton_modules_list subject
45
+ all_mods = subject.singleton_class.ancestors.map(&:to_s)
46
+ all_mods.shift
47
+ list_group all_mods
48
+ end
49
+
50
+ def cache_comparison_table subject
51
+ cache_card = Card.fetch(subject.key)
52
+ db_card = Card.find_by_key(subject.key)
53
+ return unless cache_card && db_card
54
+ table(
55
+ [:name, :updated_at, :updater_id, :content, :inspect].map do |field|
56
+ [field.to_s,
57
+ h(cache_card.send(field)),
58
+ h(db_card.send(field))]
59
+ end,
60
+ header: ["Field", "Cache Val", "Database Val"]
61
+ )
62
+ end
63
+
64
+ def section title, content
65
+ %(
66
+ <h2>#{title}</h2>
67
+ #{content}
68
+ )
69
+ end
70
+
71
+ def class_locations klass
72
+ methods = defined_methods(klass)
73
+ file_groups = methods.group_by { |sl| sl[0] }
74
+ file_counts = file_groups.map do |file, sls|
75
+ lines = sls.map { |sl| sl[1] }
76
+ count = lines.size
77
+ line = lines.min
78
+ { file: file, count: count, line: line }
79
+ end
80
+ file_counts.sort_by! { |fc| fc[:count] }
81
+ file_counts.map { |fc| [fc[:file], fc[:line]] }
82
+ end
83
+
84
+ def defined_methods klass
85
+ methods =
86
+ klass.methods(false).map { |m| klass.method(m) } +
87
+ klass.instance_methods(false).map { |m| klass.instance_method(m) }
88
+ methods.map!(&:source_location)
89
+ methods.compact!
90
+ methods
91
+ end
92
+ end
93
+
94
+
95
+ # ~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/developer/set/right/debug.rb ~~
96
+ end;end;end;end;
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.20.0
4
+ version: 1.20.1
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: 2017-01-02 00:00:00.000000000 Z
14
+ date: 2017-01-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: smartname
@@ -892,6 +892,7 @@ files:
892
892
  - mod/email/set/self/follow_defaults.rb
893
893
  - mod/email/set/self/never.rb
894
894
  - mod/email/set/type/email_template.rb
895
+ - mod/email/set/type/email_template/email_config.rb
895
896
  - mod/email/set/type_plus_right/user/follow.rb
896
897
  - mod/email/spec/set/all/follow_spec.rb
897
898
  - mod/email/spec/set/all/notify_spec.rb
@@ -1129,6 +1130,7 @@ files:
1129
1130
  - mod/standard/spec/set/type/basic_spec.rb
1130
1131
  - mod/standard/spec/set/type/cardtype_spec.rb
1131
1132
  - mod/standard/spec/set/type/date_spec.rb
1133
+ - mod/standard/spec/set/type/email_template/email_config_spec.rb
1132
1134
  - mod/standard/spec/set/type/email_template_spec.rb
1133
1135
  - mod/standard/spec/set/type/html_spec.rb
1134
1136
  - mod/standard/spec/set/type/layout_type_spec.rb
@@ -1155,6 +1157,7 @@ files:
1155
1157
  - spec/lib/card/content_spec.rb
1156
1158
  - spec/lib/card/diff_spec.rb
1157
1159
  - spec/lib/card/format/nest_spec.rb
1160
+ - spec/lib/card/format/render_spec.rb
1158
1161
  - spec/lib/card/format_spec.rb
1159
1162
  - spec/lib/card/i18n_spec.rb
1160
1163
  - spec/lib/card/loader/Modfile
@@ -1323,6 +1326,15 @@ files:
1323
1326
  - tmpsets/set/mod012-email/self/never.rb
1324
1327
  - tmpsets/set/mod012-email/type/email_template.rb
1325
1328
  - tmpsets/set/mod012-email/type_plus_right/user/follow.rb
1329
+ - tmpsets/set/mod013-carrierwave/abstract/attachment.rb
1330
+ - tmpsets/set/mod013-carrierwave/type/file.rb
1331
+ - tmpsets/set/mod013-carrierwave/type/image.rb
1332
+ - tmpsets/set/mod014-admin/self/admin.rb
1333
+ - tmpsets/set/mod014-admin/self/admin_info.rb
1334
+ - tmpsets/set/mod014-admin/self/version.rb
1335
+ - tmpsets/set/mod015-developer/all/event_viz.rb
1336
+ - tmpsets/set/mod015-developer/all/view_viz.rb
1337
+ - tmpsets/set/mod015-developer/right/debug.rb
1326
1338
  - tmpsets/set/mod016-standard/all/comment.rb
1327
1339
  - tmpsets/set/mod016-standard/all/error.rb
1328
1340
  - tmpsets/set/mod016-standard/all/links.rb
@@ -1426,6 +1438,7 @@ test_files:
1426
1438
  - spec/lib/card/content_spec.rb
1427
1439
  - spec/lib/card/diff_spec.rb
1428
1440
  - spec/lib/card/format/nest_spec.rb
1441
+ - spec/lib/card/format/render_spec.rb
1429
1442
  - spec/lib/card/format_spec.rb
1430
1443
  - spec/lib/card/i18n_spec.rb
1431
1444
  - spec/lib/card/loader/Modfile