card 1.15.1 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/card.gemspec +19 -16
  4. data/config/initializers/recaptcha.rb +1 -0
  5. data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +13 -14
  6. data/db/migrate_core_cards/20150326205655_bootswatch_themes.rb +30 -0
  7. data/db/migrate_core_cards/20150331135745_new_card_menu.rb +8 -0
  8. data/db/migrate_core_cards/20150508212032_menu_compatibility.rb +27 -0
  9. data/db/migrate_core_cards/20150510031118_fix_skin_images.rb +13 -0
  10. data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +9 -5
  11. data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +5 -5
  12. data/{test/fixtures/.gitkeep → db/migrate_core_cards/data/themes/bootstrap_default/_bootswatch.scss} +0 -0
  13. data/db/migrate_core_cards/data/themes/bootstrap_default/_variables.scss +866 -0
  14. data/db/migrate_core_cards/data/themes/cerulean/_bootswatch.scss +125 -0
  15. data/db/migrate_core_cards/data/themes/cerulean/_variables.scss +861 -0
  16. data/db/migrate_core_cards/data/themes/cosmo/_bootswatch.scss +237 -0
  17. data/db/migrate_core_cards/data/themes/cosmo/_variables.scss +861 -0
  18. data/db/migrate_core_cards/data/themes/cyborg/_bootswatch.scss +210 -0
  19. data/db/migrate_core_cards/data/themes/cyborg/_variables.scss +861 -0
  20. data/db/migrate_core_cards/data/themes/darkly/_bootswatch.scss +330 -0
  21. data/db/migrate_core_cards/data/themes/darkly/_variables.scss +861 -0
  22. data/db/migrate_core_cards/data/themes/flatly/_bootswatch.scss +313 -0
  23. data/db/migrate_core_cards/data/themes/flatly/_variables.scss +861 -0
  24. data/db/migrate_core_cards/data/themes/journal/_bootswatch.scss +120 -0
  25. data/db/migrate_core_cards/data/themes/journal/_variables.scss +861 -0
  26. data/db/migrate_core_cards/data/themes/lumen/_bootswatch.scss +496 -0
  27. data/db/migrate_core_cards/data/themes/lumen/_variables.scss +861 -0
  28. data/db/migrate_core_cards/data/themes/paper/_bootswatch.scss +607 -0
  29. data/db/migrate_core_cards/data/themes/paper/_variables.scss +861 -0
  30. data/db/migrate_core_cards/data/themes/readable/_bootswatch.scss +174 -0
  31. data/db/migrate_core_cards/data/themes/readable/_variables.scss +861 -0
  32. data/db/migrate_core_cards/data/themes/sandstone/_bootswatch.scss +194 -0
  33. data/db/migrate_core_cards/data/themes/sandstone/_variables.scss +861 -0
  34. data/db/migrate_core_cards/data/themes/simplex/_bootswatch.scss +142 -0
  35. data/db/migrate_core_cards/data/themes/simplex/_variables.scss +861 -0
  36. data/db/migrate_core_cards/data/themes/slate/_bootswatch.scss +417 -0
  37. data/db/migrate_core_cards/data/themes/slate/_variables.scss +861 -0
  38. data/db/migrate_core_cards/data/themes/spacelab/_bootswatch.scss +137 -0
  39. data/db/migrate_core_cards/data/themes/spacelab/_variables.scss +861 -0
  40. data/db/migrate_core_cards/data/themes/superhero/_bootswatch.scss +332 -0
  41. data/db/migrate_core_cards/data/themes/superhero/_variables.scss +861 -0
  42. data/db/migrate_core_cards/data/themes/united/_bootswatch.scss +42 -0
  43. data/db/migrate_core_cards/data/themes/united/_variables.scss +861 -0
  44. data/db/migrate_core_cards/data/themes/yeti/_bootswatch.scss +437 -0
  45. data/db/migrate_core_cards/data/themes/yeti/_variables.scss +861 -0
  46. data/db/seed/README.md +2 -0
  47. data/db/{bootstrap → seed/new}/card_actions.yml +561 -295
  48. data/db/{bootstrap → seed/new}/card_acts.yml +1 -1
  49. data/db/seed/new/card_changes.yml +29331 -0
  50. data/db/{bootstrap → seed/new}/card_references.yml +1544 -1355
  51. data/db/seed/new/cards.yml +28057 -0
  52. data/db/seed/test/fixtures/.gitkeep +0 -0
  53. data/{test → db/seed/test}/fixtures/card_actions.yml +1501 -1235
  54. data/{test → db/seed/test}/fixtures/card_acts.yml +244 -244
  55. data/db/seed/test/fixtures/card_changes.yml +34527 -0
  56. data/{test → db/seed/test}/fixtures/card_references.yml +2215 -2026
  57. data/db/seed/test/fixtures/cards.yml +32708 -0
  58. data/{test → db/seed/test}/fixtures/mao2.jpg +0 -0
  59. data/{test → db/seed/test}/fixtures/rails.gif +0 -0
  60. data/{test → db/seed/test}/seed.rb +0 -0
  61. data/db/version_core_cards.txt +1 -1
  62. data/lib/card/format.rb +56 -56
  63. data/lib/cardio.rb +7 -5
  64. data/mod/01_core/chunk/include.rb +1 -1
  65. data/mod/01_core/set/all/fetch.rb +27 -27
  66. data/mod/01_core/set/all/rules.rb +53 -53
  67. data/mod/01_core/set/all/states.rb +5 -0
  68. data/mod/01_core/spec/format/html_format_spec.rb +6 -6
  69. data/mod/01_core/spec/set/all/rules2_spec.rb +6 -6
  70. data/mod/01_history/set/all/history.rb +4 -4
  71. data/mod/02_basic_types/set/all/rss.rb +10 -9
  72. data/mod/03_machines/lib/javascript/script_card_menu.js.coffee +20 -0
  73. data/mod/03_machines/lib/javascript/wagn.js.coffee +46 -34
  74. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +36 -148
  75. data/mod/03_machines/lib/stylesheets/style_bootstrap_compatible.css +10 -96
  76. data/mod/03_machines/lib/stylesheets/style_cards.scss +127 -87
  77. data/mod/03_machines/set/self/script_card_menu.rb +10 -2
  78. data/mod/05_email/set/all/follow.rb +38 -22
  79. data/mod/05_email/set/right/follow.rb +79 -1
  80. data/mod/05_email/set/type_plus_right/user/follow.rb +31 -31
  81. data/mod/05_email/spec/set/all/follow_spec.rb +37 -28
  82. data/mod/05_email/spec/set/right/followers_spec.rb +29 -29
  83. data/mod/05_standard/set/all/error.rb +17 -20
  84. data/mod/05_standard/set/all/links.rb +31 -18
  85. data/mod/05_standard/set/all/rich_html/content.rb +41 -18
  86. data/mod/05_standard/set/all/rich_html/editing.rb +21 -17
  87. data/mod/05_standard/set/all/rich_html/header.rb +13 -48
  88. data/mod/05_standard/set/all/rich_html/menu.rb +147 -0
  89. data/mod/05_standard/set/all/rich_html/modal.rb +54 -0
  90. data/mod/05_standard/set/all/rich_html/toolbar.rb +237 -0
  91. data/mod/05_standard/set/all/rich_html/wrapper.rb +43 -25
  92. data/mod/05_standard/set/right/account.rb +8 -7
  93. data/mod/05_standard/set/rstar/rules.rb +111 -84
  94. data/mod/05_standard/set/self/head.rb +15 -15
  95. data/mod/05_standard/set/type/set.rb +65 -34
  96. data/mod/05_standard/spec/set/all/attach_spec.rb +1 -1
  97. data/mod/05_standard/spec/set/all/rich_html/wrapper_spec.rb +13 -9
  98. data/mod/05_standard/spec/set/rstar/rules_spec.rb +1 -1
  99. data/mod/06_bootstrap/lib/javascript/bootstrap.js +108 -97
  100. data/mod/06_bootstrap/lib/javascript/smartmenu.js +94 -0
  101. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_alerts.scss +73 -0
  102. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_badges.scss +68 -0
  103. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_breadcrumbs.scss +26 -0
  104. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_button-groups.scss +243 -0
  105. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_buttons.scss +160 -0
  106. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_carousel.scss +269 -0
  107. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_close.scss +36 -0
  108. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_code.scss +69 -0
  109. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_component-animations.scss +37 -0
  110. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_dropdowns.scss +214 -0
  111. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_forms.scss +578 -0
  112. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_glyphicons.scss +305 -0
  113. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_grid.scss +84 -0
  114. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_input-groups.scss +166 -0
  115. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_jumbotron.scss +50 -0
  116. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_labels.scss +66 -0
  117. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_list-group.scss +124 -0
  118. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_media.scss +61 -0
  119. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_mixins.scss +39 -0
  120. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_modals.scss +150 -0
  121. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_navbar.scss +662 -0
  122. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_navs.scss +242 -0
  123. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_normalize.scss +427 -0
  124. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_pager.scss +54 -0
  125. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_pagination.scss +88 -0
  126. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_panels.scss +265 -0
  127. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_popovers.scss +135 -0
  128. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_print.scss +107 -0
  129. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_progress-bars.scss +87 -0
  130. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_responsive-embed.scss +35 -0
  131. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_responsive-utilities.scss +177 -0
  132. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_scaffolding.scss +162 -0
  133. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_tables.scss +234 -0
  134. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_theme.scss +273 -0
  135. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_thumbnails.scss +38 -0
  136. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_tooltip.scss +102 -0
  137. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_type.scss +298 -0
  138. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_utilities.scss +55 -0
  139. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_variables.scss +866 -0
  140. data/mod/06_bootstrap/lib/stylesheets/bootstrap/_wells.scss +29 -0
  141. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_alerts.scss +14 -0
  142. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_background-variant.scss +11 -0
  143. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_border-radius.scss +18 -0
  144. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_buttons.scss +52 -0
  145. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_center-block.scss +7 -0
  146. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_clearfix.scss +22 -0
  147. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_forms.scss +88 -0
  148. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_gradients.scss +58 -0
  149. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_grid-framework.scss +81 -0
  150. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_grid.scss +122 -0
  151. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_hide-text.scss +21 -0
  152. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_image.scss +33 -0
  153. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_labels.scss +12 -0
  154. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_list-group.scss +31 -0
  155. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_nav-divider.scss +10 -0
  156. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_nav-vertical-align.scss +9 -0
  157. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_opacity.scss +8 -0
  158. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_pagination.scss +23 -0
  159. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_panels.scss +24 -0
  160. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_progress-bar.scss +10 -0
  161. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_reset-filter.scss +8 -0
  162. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_resize.scss +6 -0
  163. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_responsive-visibility.scss +21 -0
  164. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_size.scss +10 -0
  165. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_tab-focus.scss +9 -0
  166. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_table-row.scss +28 -0
  167. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_text-emphasis.scss +11 -0
  168. data/mod/06_bootstrap/lib/stylesheets/bootstrap/mixins/_text-overflow.scss +8 -0
  169. data/mod/06_bootstrap/lib/stylesheets/{bootswatch_mixins.scss → bootstrap/mixins/_vendor-prefixes.scss} +1 -61
  170. data/mod/06_bootstrap/lib/stylesheets/bootstrap_cards.scss +20 -13
  171. data/mod/06_bootstrap/lib/stylesheets/smartmenu.css +433 -0
  172. data/mod/06_bootstrap/set/all/bootstrap/wrapper.rb +2 -2
  173. data/mod/06_bootstrap/set/all/rich_bootstrap.rb +58 -4
  174. data/mod/06_bootstrap/set/self/bootstrap_js.rb +1 -1
  175. data/mod/06_bootstrap/set/self/bootswatch_shared.rb +32 -0
  176. data/mod/06_bootstrap/set/self/smartmenu_css.rb +7 -0
  177. data/mod/06_bootstrap/set/self/smartmenu_js.rb +7 -0
  178. data/spec/spec_helper.rb +16 -16
  179. metadata +133 -93
  180. data/db/bootstrap/card_changes.yml +0 -12765
  181. data/db/bootstrap/cards.yml +0 -11567
  182. data/db/seeds.rb +0 -8
  183. data/mod/03_machines/lib/javascript/script_card_menu.js +0 -72
  184. data/mod/06_bootstrap/lib/stylesheets/bootstrap_css.css +0 -6565
  185. data/mod/06_bootstrap/lib/stylesheets/theme_bootstrap_default.css +0 -476
  186. data/mod/06_bootstrap/lib/stylesheets/theme_cerulean.css +0 -6721
  187. data/mod/06_bootstrap/lib/stylesheets/theme_cosmo.css +0 -5898
  188. data/mod/06_bootstrap/lib/stylesheets/theme_cyborg.css +0 -5876
  189. data/mod/06_bootstrap/lib/stylesheets/theme_darkly.css +0 -5986
  190. data/mod/06_bootstrap/lib/stylesheets/theme_flatly.css +0 -6830
  191. data/mod/06_bootstrap/lib/stylesheets/theme_journal.css +0 -6647
  192. data/mod/06_bootstrap/lib/stylesheets/theme_lumen.css +0 -6097
  193. data/mod/06_bootstrap/lib/stylesheets/theme_paper.css +0 -6647
  194. data/mod/06_bootstrap/lib/stylesheets/theme_readable.css +0 -5896
  195. data/mod/06_bootstrap/lib/stylesheets/theme_sandstone.css +0 -6733
  196. data/mod/06_bootstrap/lib/stylesheets/theme_simplex.css +0 -5886
  197. data/mod/06_bootstrap/lib/stylesheets/theme_slate.css +0 -7057
  198. data/mod/06_bootstrap/lib/stylesheets/theme_spacelab.css +0 -5935
  199. data/mod/06_bootstrap/lib/stylesheets/theme_superhero.css +0 -5964
  200. data/mod/06_bootstrap/lib/stylesheets/theme_united.css +0 -6588
  201. data/mod/06_bootstrap/lib/stylesheets/theme_yeti.css +0 -6088
  202. data/mod/06_bootstrap/set/self/bootstrap_css.rb +0 -9
  203. data/mod/06_bootstrap/set/self/bootswatch_mixins.rb +0 -9
  204. data/mod/06_bootstrap/set/self/theme_bootstrap_default.rb +0 -2
  205. data/mod/06_bootstrap/set/self/theme_cerulean.rb +0 -9
  206. data/mod/06_bootstrap/set/self/theme_cosmo.rb +0 -2
  207. data/mod/06_bootstrap/set/self/theme_cyborg.rb +0 -2
  208. data/mod/06_bootstrap/set/self/theme_darkly.rb +0 -2
  209. data/mod/06_bootstrap/set/self/theme_flatly.rb +0 -2
  210. data/mod/06_bootstrap/set/self/theme_journal.rb +0 -2
  211. data/mod/06_bootstrap/set/self/theme_lumen.rb +0 -2
  212. data/mod/06_bootstrap/set/self/theme_paper.rb +0 -2
  213. data/mod/06_bootstrap/set/self/theme_readable.rb +0 -2
  214. data/mod/06_bootstrap/set/self/theme_sandstone.rb +0 -2
  215. data/mod/06_bootstrap/set/self/theme_simplex.rb +0 -2
  216. data/mod/06_bootstrap/set/self/theme_slate.rb +0 -2
  217. data/mod/06_bootstrap/set/self/theme_spacelab.rb +0 -2
  218. data/mod/06_bootstrap/set/self/theme_superhero.rb +0 -2
  219. data/mod/06_bootstrap/set/self/theme_united.rb +0 -2
  220. data/mod/06_bootstrap/set/self/theme_yeti.rb +0 -2
  221. data/test/fixtures/card_changes.yml +0 -17961
  222. data/test/fixtures/cards.yml +0 -16218
@@ -1,16 +1,16 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  describe Card::Set::Right::Followers do
4
-
5
-
6
-
4
+
5
+
6
+
7
7
  describe '#raw_content' do
8
8
  it 'returns a pointer list of followers' do
9
9
  card = Card.fetch 'All Eyes on me'
10
- expect( card.followers_card.raw_content).to eq "[[John]]\n[[Sara]]\n[[Big Brother]]"
10
+ expect( card.followers_card.item_names.sort).to eq ['Big Brother','John','Sara']
11
11
  end
12
12
  end
13
-
13
+
14
14
  describe 'view :core' do
15
15
  it 'contains follower' do
16
16
  card = Card.fetch 'All Eyes on me'
@@ -18,30 +18,30 @@ describe Card::Set::Right::Followers do
18
18
  expect(view).to include("Sara")
19
19
  end
20
20
  end
21
-
21
+
22
22
  describe 'view :raw' do
23
23
  it 'renders a pointer list of followers' do
24
24
  card = Card.fetch 'All Eyes on me'
25
25
  view = card.followers_card.format.render_raw
26
- expect(view).to eq "[[John]]\n[[Sara]]\n[[Big Brother]]"
26
+ expect(view.split("\n").sort).to eq ['[[Big Brother]]','[[John]]','[[Sara]]']
27
27
  end
28
28
  end
29
-
30
-
31
- describe 'item_names' do
32
- subject { @card.followers_card.item_names }
29
+
30
+
31
+ describe 'item_names' do
32
+ subject { @card.followers_card.item_names.sort }
33
33
  it 'is an array of followers' do
34
34
  @card = Card['All Eyes On Me']
35
- is_expected.to eq ['John','Sara','Big Brother']
35
+ is_expected.to eq ['Big Brother','John','Sara']
36
36
  end
37
-
38
- it 'recognizes card name changes' do
39
- @card = Card['Look At Me']
37
+
38
+ it 'recognizes card name changes' do
39
+ @card = Card['Look At Me']
40
40
  @card.update_referencers = true
41
41
  @card.update_attributes! :name=>'Look away'
42
42
  is_expected.to eq ['Big Brother']
43
43
  end
44
-
44
+
45
45
  it 'recognizes +*following changes' do
46
46
  Card::Auth.as_bot do
47
47
  card = Card['Joe User'].follow 'Look At Me'
@@ -50,41 +50,41 @@ describe Card::Set::Right::Followers do
50
50
  is_expected.to include 'Joe User'
51
51
  end
52
52
 
53
- context 'when following a card' do
53
+ context 'when following a card' do
54
54
  it 'contains follower' do
55
55
  @card = Card['All Eye On Me']
56
56
  is_expected.to include('Big Brother')
57
57
  end
58
58
  end
59
-
59
+
60
60
  context 'when following a *self set' do
61
61
  it 'contains follower' do
62
62
  @card = Card['Look At Me']
63
63
  is_expected.to include('Big Brother')
64
64
  end
65
65
  end
66
-
66
+
67
67
  context 'when following a *type set' do
68
68
  it 'contains follower' do
69
69
  @card = Card.create! :name=>'telescope', :type=>'Optic'
70
70
  is_expected.to include('Big Brother')
71
71
  end
72
72
  end
73
-
73
+
74
74
  context 'when following a *right set' do
75
75
  it 'contains follower' do
76
76
  @card = Card.create! :name=>'telescope+lens'
77
77
  is_expected.to include('Big Brother')
78
78
  end
79
79
  end
80
-
80
+
81
81
  context 'when following a *type plus right set' do
82
82
  it 'contains follower' do
83
83
  @card = Card['Sunglasses+tint']
84
84
  is_expected.to include('Big Brother')
85
85
  end
86
86
  end
87
-
87
+
88
88
  context 'when following content I created' do
89
89
  it 'contains creator' do
90
90
  Card::Auth.current_id = Card['Big Brother'].id
@@ -92,10 +92,10 @@ describe Card::Set::Right::Followers do
92
92
  is_expected.to include('Big Brother')
93
93
  end
94
94
  end
95
-
95
+
96
96
  context 'when following content I edited' do
97
97
  it 'contains editor' do
98
- Card::Auth.as_bot do
98
+ Card::Auth.as_bot do
99
99
  Card['Sara'].follow '*all', '*edited'
100
100
  end
101
101
 
@@ -105,22 +105,22 @@ describe Card::Set::Right::Followers do
105
105
  is_expected.to include('Sara')
106
106
  end
107
107
  end
108
-
109
-
108
+
109
+
110
110
  context 'for a set card' do
111
111
  it 'contains followers of that set' do
112
112
  @card = Card['lens+*right']
113
113
  is_expected.to include('Big Brother')
114
114
  end
115
115
  end
116
-
116
+
117
117
  context 'for a type card' do
118
118
  it 'contains followers of that type' do
119
119
  @card = Card['Optic']
120
120
  is_expected.to include('Optic fan')
121
121
  end
122
122
  end
123
-
123
+
124
124
  end
125
-
125
+
126
126
  end
@@ -4,7 +4,7 @@ format do
4
4
  view :closed_missing, :perms=>:none, :closed=>true do |args|
5
5
  ''
6
6
  end
7
-
7
+
8
8
  view :missing, :perms=>:none do |args|
9
9
  ''
10
10
  end
@@ -32,7 +32,7 @@ format do
32
32
 
33
33
  view :too_slow, :perms=>:none, :closed=>true do |args|
34
34
  %{ Timed out! #{ showname } took too long to load. }
35
- end
35
+ end
36
36
  end
37
37
 
38
38
 
@@ -44,13 +44,13 @@ format :html do
44
44
  else super
45
45
  end
46
46
  end
47
-
47
+
48
48
  def commentable? view, args
49
- self.class.tagged view, :comment and
49
+ self.class.tagged view, :comment and
50
50
  show_view? :comment_box, args.merge( :default_visibility=>:hide ) and #developer or wagneer has overridden default
51
51
  ok? :comment
52
52
  end
53
-
53
+
54
54
  def rendering_error exception, view
55
55
  details = if Auth.always_ok?
56
56
  card_link(error_cardname, :class=>'render-error-link') +
@@ -58,16 +58,13 @@ format :html do
58
58
  %{
59
59
  <h3>Error message (visible to admin only)</h3>
60
60
  <p><strong>#{ exception.message }</strong></p>
61
- <div>
62
- #{exception.backtrace * "<br>\n"}
63
- </div>
64
- </div>
61
+ <div>#{exception.backtrace * "<br>\n"}</div>
65
62
  }
66
63
  end
67
64
  else
68
65
  error_cardname
69
66
  end
70
-
67
+
71
68
  content_tag :span, :class=>'render-error alert alert-danger' do
72
69
  [
73
70
  'error rendering',
@@ -80,7 +77,7 @@ format :html do
80
77
  def unsupported_view view
81
78
  "<strong>view <em>#{view}</em> not supported for <em>#{error_cardname}</em></strong>"
82
79
  end
83
-
80
+
84
81
  view :message, :perms=>:none, :tags=>:unknown_ok do |args|
85
82
  frame args do
86
83
  params[:message]
@@ -102,9 +99,9 @@ format :html do
102
99
  view :closed_missing, :perms=>:none do |args|
103
100
  %{<span class="faint"> #{ showname } </span>}
104
101
  end
105
-
106
-
107
-
102
+
103
+
104
+
108
105
  view :conflict, :error_code=>409 do |args|
109
106
  # FIXME: hack to get the conflicted update as a proper act for the diff view
110
107
  card.current_act.save
@@ -112,7 +109,7 @@ format :html do
112
109
  action.card_act_id = card.current_act.id
113
110
  action.draft = true
114
111
  action.save
115
- card.store_changes # deletes action if there are no changes
112
+ card.store_changes # deletes action if there are no changes
116
113
 
117
114
  # as a consequence card.current_act.actions can be empty when both users made exactly the same changes
118
115
  # but an act is always supposed to have at least one action, so we have to delete the act to avoid bad things
@@ -134,22 +131,22 @@ format :html do
134
131
  "No difference between your changes and #{card.last_action.act.actor.name}'s version."
135
132
  end
136
133
  end
137
- }
134
+ }
138
135
  }
139
136
  end
140
137
  end
141
138
  end
142
-
139
+
143
140
  view :errors, :perms=>:none do |args|
144
141
  if card.errors.any?
145
142
  title = %{ Problems #{%{ with #{card.name} } unless card.name.blank?} }
146
- frame args.merge(:slot_class=>"panel panel-warning", :title=>title, :hide=>'menu' ) do
143
+ frame args.merge(:panel_class=>"panel panel-warning", :title=>title, :hide=>'menu' ) do
147
144
  card.errors.map do |attrib, msg|
148
145
  msg = "<strong>#{attrib.to_s.upcase}:</strong> #{msg}" unless attrib == :abort
149
146
  alert 'warning', :dismissible=>true, :alert_class=>'card-error-msg' do
150
147
  msg
151
148
  end
152
- end
149
+ end
153
150
  end
154
151
  end
155
152
  end
@@ -210,5 +207,5 @@ format :html do
210
207
  </body>
211
208
  }
212
209
  end
213
-
210
+
214
211
  end
@@ -6,7 +6,7 @@ format do
6
6
  # (and is overridden in other formats)
7
7
  def link_to text, href, opts={}
8
8
  href = interpret_href href
9
-
9
+
10
10
  if text and href != text
11
11
  "#{text}[#{href}]"
12
12
  else
@@ -26,7 +26,7 @@ format do
26
26
  else
27
27
  return card_link href, opts
28
28
  end
29
- add_class opts, new_class
29
+ add_class opts, new_class
30
30
  link_to text, href, opts
31
31
  end
32
32
 
@@ -38,15 +38,14 @@ format do
38
38
  when Card then name_or_card.cardname
39
39
  else name_or_card
40
40
  end
41
-
41
+
42
42
  path_opts = opts.delete( :path_opts ) || {}
43
43
  path_opts[:name ] = name
44
- path_opts[:known] = opts[:known].nil? ? Card.known?(name) : opts.delete(:known)
44
+ path_opts[:known] = opts[:known].nil? ? Card.known?(name) : opts.delete(:known)
45
45
  add_class opts, ( path_opts[:known] ? 'known-card' : 'wanted-card' )
46
46
  link_to text, path_opts, opts
47
47
  end
48
48
 
49
-
50
49
  # link to a specific view (defaults to current card)
51
50
  # this is generally used for ajax calls
52
51
  def view_link text, view, opts={}
@@ -54,30 +53,44 @@ format do
54
53
  path_opts[:view] = view unless view == :home
55
54
  opts[:remote] = true
56
55
  opts[:rel] = 'nofollow'
57
-
56
+
58
57
  link_to text, path_opts, opts
59
58
  end
60
59
 
60
+ def related_link name_or_card, opts={}
61
+ name = case name_or_card
62
+ when Symbol then Card.fetch( name_or_card, :skip_modules=>true ).cardname
63
+ when Card then name_or_card.cardname
64
+ else name_or_card
65
+ end
66
+ opts[:path_opts] ||= {:view=>:related}
67
+ opts[:path_opts][:related] = {:name=>"+#{name}"}
68
+ opts[:path_opts][:related].merge! opts[:related_opts] if opts[:related_opts]
69
+ view_link( opts[:text] || name, :related, opts)
70
+ end
71
+
72
+
73
+
61
74
  def path opts={}
62
75
  name = opts.delete(:name) || card.name
63
76
  base = opts[:action] ? "card/#{ opts.delete :action }/" : ''
64
-
77
+
65
78
  opts[:no_id] = true if [:new, :create].member? opts[:action]
66
79
  #generalize. dislike hardcoding views/actions here
67
-
80
+
68
81
  linkname = name.to_name.url_key
69
82
  unless name.empty? || opts.delete(:no_id)
70
83
  base += ( opts[:id] ? "~#{ opts.delete :id }" : linkname )
71
84
  end
72
-
73
- opts[:card] = {}
85
+
86
+ opts[:card] ||= {}
74
87
  opts[:card][:name] = name if opts.delete(:known)==false && name.present? && name.to_s != linkname
75
-
88
+
76
89
  if type = opts.delete(:type) and Card.known?( type )
77
90
  opts[:card][:type] = type
78
91
  end
79
92
  opts.delete(:card) if opts[:card].empty?
80
-
93
+
81
94
  query = opts.empty? ? '' : "?#{opts.to_param}"
82
95
  internal_url( base + query )
83
96
  end
@@ -85,16 +98,16 @@ format do
85
98
  def internal_url relative_path
86
99
  card_path relative_path
87
100
  end
88
-
101
+
89
102
  def interpret_href href
90
103
  Hash===href ? path(href) : href
91
104
  end
92
-
105
+
93
106
  end
94
107
 
95
108
  format :html do
96
-
97
-
109
+
110
+
98
111
  def link_to text, href, opts={}
99
112
  href = interpret_href href
100
113
 
@@ -103,8 +116,8 @@ format :html do
103
116
  opts["data-#{key}"] = val
104
117
  end
105
118
  end
106
-
119
+
107
120
  content_tag :a, raw(text), opts.merge(:href=>href)
108
121
  end
109
-
122
+
110
123
  end
@@ -25,7 +25,7 @@ format :html do
25
25
  ]
26
26
  end
27
27
  end
28
-
28
+
29
29
  view :content_panel do |args|
30
30
  wrap args.reverse_merge(:slot_class=>'card-content panel panel-default') do
31
31
  wrap_with :div, :class=>'panel-body' do
@@ -38,7 +38,7 @@ format :html do
38
38
  end
39
39
 
40
40
  view :titled, :tags=>:comment do |args|
41
- wrap args do
41
+ wrap args do
42
42
  [
43
43
  _render_header( args ),
44
44
  wrap_body( :content=>true ) { _render_core args },
@@ -60,8 +60,10 @@ format :html do
60
60
  end
61
61
 
62
62
  view :title do |args|
63
- title = fancy_title args[:title]
64
- title = _optional_render( :title_link, args.merge( :title_ready=>title ), :hide ) || title
63
+ title = fancy_title args[:title], args[:title_class]
64
+ title = _optional_render( :title_toolbar, args, (show_view?(:toolbar,args.merge(:default_visibility=>:hide)) ? :show : :hide)) ||
65
+ _optional_render( :title_link, args.merge( :title_ready=>title ), :hide ) ||
66
+ title
65
67
  add_name_context
66
68
  title
67
69
  end
@@ -70,6 +72,20 @@ format :html do
70
72
  card_link card.cardname, :text=>( args[:title_ready] || showname(args[:title]) )
71
73
  end
72
74
 
75
+ view :title_toolbar do |args|
76
+ links = card.cardname.parts.map do |name|
77
+ card_link name
78
+ end
79
+ res = links.shift
80
+ links.each_with_index do |link, index|
81
+ res += card_link card.cardname.parts[0..index+1].join('+'), :text=>glyphicon('plus','header-icon')
82
+ res += link
83
+ end
84
+ res += ' '
85
+ res.concat view_link(glyphicon('edit','header-icon'),:edit_name, :class=>'slotter', 'data-toggle'=>'tooltip', :title=>'edit name')
86
+ res
87
+ end
88
+
73
89
  view :open, :tags=>:comment do |args|
74
90
  args[:optional_toggle] ||= main? ? :hide : :show
75
91
  frame args.merge(:content=>true) do
@@ -80,13 +96,13 @@ format :html do
80
96
  end
81
97
  end
82
98
 
83
-
84
-
85
- =begin
99
+
100
+
101
+ =begin
86
102
  view :anchor, :perms=>:none, :tags=>:unknown_ok do |args|
87
103
  %{ <a id="#{card.cardname.url_key}" name="#{card.cardname.url_key}"></a> }
88
104
  end
89
- =end
105
+ =end
90
106
 
91
107
  view :type do |args|
92
108
  klasses = ['cardtype']
@@ -113,13 +129,18 @@ format :html do
113
129
  end
114
130
 
115
131
  view :options, :tags=>:unknown_ok do |args|
116
- current_set = Card.fetch( params[:current_set] || card.related_sets[0][0] )
117
-
118
132
  frame args do
119
- subformat( current_set ).render_content
133
+ subformat( current_set_card ).render_content args
120
134
  end
121
135
  end
122
136
 
137
+ def current_set_card
138
+ set_name = params[:current_set]
139
+ set_name ||= "#{card.name}+*type" if card.known? && card.type_id==Card::CardtypeID
140
+ set_name ||= "#{card.name}+*self"
141
+ Card.fetch(set_name)
142
+ end
143
+
123
144
 
124
145
  view :related do |args|
125
146
  if rparams = params[:related]
@@ -130,9 +151,11 @@ format :html do
130
151
  :view => ( rparams[:view] || :open ),
131
152
  :optional_toggle => :hide,
132
153
  :optional_help => :show,
133
- :optional_menu => :show
154
+ :optional_menu => :show,
155
+ :parent => card
134
156
  }
135
-
157
+ nest_args.merge! ( rparams[:slot] || {} ).deep_symbolize_keys
158
+
136
159
  nest_args[:optional_comment_box] = :show if rparams[:name] == '+discussion' #fixme. yuck!
137
160
 
138
161
  frame args do
@@ -140,7 +163,7 @@ format :html do
140
163
  end
141
164
  end
142
165
  end
143
-
166
+
144
167
  view :help, :tags=>:unknown_ok do |args|
145
168
  text = if args[:help_text]
146
169
  args[:help_text]
@@ -157,7 +180,7 @@ format :html do
157
180
  %{<div class="#{klass}">#{raw text}</div>} if text
158
181
  end
159
182
 
160
-
183
+
161
184
  view :last_action do |args|
162
185
  action_type = case ( action = card.last_act.action_on(card.id) and action.action_type )
163
186
  when :create then 'added'
@@ -171,14 +194,14 @@ format :html do
171
194
  #{ _render_acted_at }
172
195
  ago by
173
196
  #{ subformat(card.last_actor)._render_link }
174
- </span>
197
+ </span>
175
198
  }
176
199
  end
177
200
 
178
201
  private
179
202
 
180
- def fancy_title title=nil
181
- raw %{<span class="card-title">#{ showname(title).to_name.parts.join %{<span class="joint">+</span>} }</span>}
203
+ def fancy_title title=nil, title_class=nil
204
+ raw %{<span class="card-title#{" #{title_class}"if title_class}">#{ showname(title).to_name.parts.join %{<span class="joint">+</span>} }</span>}
182
205
  end
183
206
  end
184
207