card 1.16.9 → 1.16.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +3 -1
  4. data/db/seed/new/card_actions.yml +389 -557
  5. data/db/seed/new/card_acts.yml +595 -1
  6. data/db/seed/new/card_changes.yml +22595 -7526
  7. data/db/seed/new/card_references.yml +379 -407
  8. data/db/seed/new/cards.yml +1694 -2072
  9. data/db/seed/test/fixtures/card_actions.yml +966 -1102
  10. data/db/seed/test/fixtures/card_acts.yml +1017 -399
  11. data/db/seed/test/fixtures/card_changes.yml +24750 -9681
  12. data/db/seed/test/fixtures/card_references.yml +603 -631
  13. data/db/seed/test/fixtures/cards.yml +2293 -2671
  14. data/lib/card/set.rb +1 -1
  15. data/mod/01_core/set/all/content.rb +14 -12
  16. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +1 -1
  17. data/mod/05_standard/set/abstract/attachment.rb +9 -9
  18. data/mod/05_standard/set/all/rich_html/content.rb +115 -103
  19. data/mod/05_standard/set/type/file.rb +1 -1
  20. data/tmpsets/set/mod001-01_core/all/active_card.rb +2 -1
  21. data/tmpsets/set/mod001-01_core/all/collection.rb +3 -3
  22. data/tmpsets/set/mod001-01_core/all/content.rb +2 -1
  23. data/tmpsets/set/mod001-01_core/all/erb.rb +2 -1
  24. data/tmpsets/set/mod001-01_core/all/fetch.rb +169 -93
  25. data/tmpsets/set/mod001-01_core/all/haml.rb +2 -1
  26. data/tmpsets/set/mod001-01_core/all/initialize.rb +11 -23
  27. data/tmpsets/set/mod001-01_core/all/name.rb +130 -80
  28. data/tmpsets/set/mod001-01_core/all/pattern.rb +2 -1
  29. data/tmpsets/set/mod001-01_core/all/permissions.rb +2 -1
  30. data/tmpsets/set/mod001-01_core/all/phases.rb +95 -96
  31. data/tmpsets/set/mod001-01_core/all/references.rb +2 -1
  32. data/tmpsets/set/mod001-01_core/all/rules.rb +2 -1
  33. data/tmpsets/set/mod001-01_core/all/states.rb +2 -1
  34. data/tmpsets/set/mod001-01_core/all/templating.rb +2 -1
  35. data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +85 -60
  36. data/tmpsets/set/mod001-01_core/all/trash.rb +16 -13
  37. data/tmpsets/set/mod001-01_core/all/type.rb +5 -25
  38. data/tmpsets/set/mod001-01_core/all/utils.rb +2 -1
  39. data/tmpsets/set/mod001-01_core/all/view_cache.rb +2 -1
  40. data/tmpsets/set/mod002-01_history/all/actions.rb +2 -1
  41. data/tmpsets/set/mod002-01_history/all/content_history.rb +7 -4
  42. data/tmpsets/set/mod002-01_history/all/history.rb +119 -83
  43. data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +2 -1
  44. data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +2 -1
  45. data/tmpsets/set/mod003-02_basic_types/all/all_js.rb +2 -1
  46. data/tmpsets/set/mod003-02_basic_types/all/base.rb +52 -50
  47. data/tmpsets/set/mod003-02_basic_types/all/file.rb +2 -1
  48. data/tmpsets/set/mod003-02_basic_types/all/json.rb +2 -1
  49. data/tmpsets/set/mod003-02_basic_types/all/rss.rb +2 -1
  50. data/tmpsets/set/mod003-02_basic_types/all/text.rb +2 -1
  51. data/tmpsets/set/mod003-02_basic_types/type/html.rb +2 -1
  52. data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +2 -1
  53. data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +10 -1
  54. data/tmpsets/set/mod004-03_machines/right/machine_input.rb +2 -1
  55. data/tmpsets/set/mod004-03_machines/right/machine_output.rb +2 -1
  56. data/tmpsets/set/mod004-03_machines/self/script_ace.rb +2 -1
  57. data/tmpsets/set/mod004-03_machines/self/script_card_menu.rb +2 -1
  58. data/tmpsets/set/mod004-03_machines/self/script_html5shiv_printshiv.rb +2 -1
  59. data/tmpsets/set/mod004-03_machines/self/script_jquery.rb +2 -1
  60. data/tmpsets/set/mod004-03_machines/self/script_jquery_helper.rb +2 -1
  61. data/tmpsets/set/mod004-03_machines/self/script_slot.rb +2 -1
  62. data/tmpsets/set/mod004-03_machines/self/script_tinymce.rb +2 -1
  63. data/tmpsets/set/mod004-03_machines/self/style_bootstrap_compatible.rb +2 -1
  64. data/tmpsets/set/mod004-03_machines/self/style_cards.rb +2 -1
  65. data/tmpsets/set/mod004-03_machines/self/style_jquery_ui_smoothness.rb +2 -1
  66. data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +2 -1
  67. data/tmpsets/set/mod004-03_machines/type/css.rb +2 -1
  68. data/tmpsets/set/mod004-03_machines/type/java_script.rb +2 -1
  69. data/tmpsets/set/mod004-03_machines/type/scss.rb +2 -1
  70. data/tmpsets/set/mod004-03_machines/type/skin.rb +2 -1
  71. data/tmpsets/set/mod005-04_settings/abstract/permission.rb +2 -1
  72. data/tmpsets/set/mod005-04_settings/right/add_help.rb +2 -1
  73. data/tmpsets/set/mod005-04_settings/right/comment.rb +2 -1
  74. data/tmpsets/set/mod005-04_settings/right/create.rb +2 -1
  75. data/tmpsets/set/mod005-04_settings/right/default.rb +2 -1
  76. data/tmpsets/set/mod005-04_settings/right/delete.rb +2 -1
  77. data/tmpsets/set/mod005-04_settings/right/help.rb +2 -1
  78. data/tmpsets/set/mod005-04_settings/right/read.rb +2 -1
  79. data/tmpsets/set/mod005-04_settings/right/script.rb +2 -1
  80. data/tmpsets/set/mod005-04_settings/right/structure.rb +2 -1
  81. data/tmpsets/set/mod005-04_settings/right/style.rb +2 -1
  82. data/tmpsets/set/mod005-04_settings/right/update.rb +2 -1
  83. data/tmpsets/set/mod005-04_settings/self/accountable.rb +2 -1
  84. data/tmpsets/set/mod005-04_settings/self/add_help.rb +2 -1
  85. data/tmpsets/set/mod005-04_settings/self/autoname.rb +2 -1
  86. data/tmpsets/set/mod005-04_settings/self/captcha.rb +2 -1
  87. data/tmpsets/set/mod005-04_settings/self/create.rb +2 -1
  88. data/tmpsets/set/mod005-04_settings/self/default.rb +2 -1
  89. data/tmpsets/set/mod005-04_settings/self/delete.rb +2 -1
  90. data/tmpsets/set/mod005-04_settings/self/help.rb +2 -1
  91. data/tmpsets/set/mod005-04_settings/self/input.rb +2 -1
  92. data/tmpsets/set/mod005-04_settings/self/layout.rb +2 -1
  93. data/tmpsets/set/mod005-04_settings/self/on_create.rb +2 -1
  94. data/tmpsets/set/mod005-04_settings/self/on_delete.rb +2 -1
  95. data/tmpsets/set/mod005-04_settings/self/on_update.rb +2 -1
  96. data/tmpsets/set/mod005-04_settings/self/options.rb +2 -1
  97. data/tmpsets/set/mod005-04_settings/self/options_label.rb +2 -1
  98. data/tmpsets/set/mod005-04_settings/self/read.rb +2 -1
  99. data/tmpsets/set/mod005-04_settings/self/recent_settings.rb +2 -1
  100. data/tmpsets/set/mod005-04_settings/self/script.rb +2 -1
  101. data/tmpsets/set/mod005-04_settings/self/structure.rb +2 -1
  102. data/tmpsets/set/mod005-04_settings/self/style.rb +2 -1
  103. data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +2 -1
  104. data/tmpsets/set/mod005-04_settings/self/thanks.rb +2 -1
  105. data/tmpsets/set/mod005-04_settings/self/update.rb +2 -1
  106. data/tmpsets/set/mod005-04_settings/type/setting.rb +2 -1
  107. data/tmpsets/set/mod006-05_email/all/email_html.rb +2 -1
  108. data/tmpsets/set/mod006-05_email/all/email_text.rb +2 -1
  109. data/tmpsets/set/mod006-05_email/all/follow.rb +2 -1
  110. data/tmpsets/set/mod006-05_email/all/notify.rb +2 -1
  111. data/tmpsets/set/mod006-05_email/all/observer.rb +2 -1
  112. data/tmpsets/set/mod006-05_email/right/bcc.rb +2 -1
  113. data/tmpsets/set/mod006-05_email/right/cc.rb +2 -1
  114. data/tmpsets/set/mod006-05_email/right/follow.rb +2 -1
  115. data/tmpsets/set/mod006-05_email/right/follow_fields.rb +2 -1
  116. data/tmpsets/set/mod006-05_email/right/followers.rb +7 -6
  117. data/tmpsets/set/mod006-05_email/right/following.rb +3 -2
  118. data/tmpsets/set/mod006-05_email/right/from.rb +2 -1
  119. data/tmpsets/set/mod006-05_email/right/html_message.rb +2 -1
  120. data/tmpsets/set/mod006-05_email/right/to.rb +2 -1
  121. data/tmpsets/set/mod006-05_email/self/always.rb +2 -1
  122. data/tmpsets/set/mod006-05_email/self/created.rb +2 -1
  123. data/tmpsets/set/mod006-05_email/self/edited.rb +2 -1
  124. data/tmpsets/set/mod006-05_email/self/follow.rb +2 -1
  125. data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +2 -1
  126. data/tmpsets/set/mod006-05_email/self/never.rb +2 -1
  127. data/tmpsets/set/mod006-05_email/type/email_template.rb +2 -1
  128. data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +3 -2
  129. data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +22 -9
  130. data/tmpsets/set/mod007-05_standard/all/account.rb +2 -1
  131. data/tmpsets/set/mod007-05_standard/all/comment.rb +2 -1
  132. data/tmpsets/set/mod007-05_standard/all/error.rb +2 -1
  133. data/tmpsets/set/mod007-05_standard/all/event_viz.rb +2 -1
  134. data/tmpsets/set/mod007-05_standard/all/links.rb +2 -1
  135. data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +3 -2
  136. data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +2 -1
  137. data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +23 -12
  138. data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +2 -1
  139. data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +3 -2
  140. data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +2 -1
  141. data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +2 -1
  142. data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +2 -1
  143. data/tmpsets/set/mod007-05_standard/right/account.rb +7 -6
  144. data/tmpsets/set/mod007-05_standard/right/discussion.rb +2 -1
  145. data/tmpsets/set/mod007-05_standard/right/email.rb +2 -1
  146. data/tmpsets/set/mod007-05_standard/right/password.rb +2 -1
  147. data/tmpsets/set/mod007-05_standard/right/salt.rb +2 -1
  148. data/tmpsets/set/mod007-05_standard/right/stats.rb +2 -1
  149. data/tmpsets/set/mod007-05_standard/right/status.rb +2 -1
  150. data/tmpsets/set/mod007-05_standard/right/token.rb +2 -1
  151. data/tmpsets/set/mod007-05_standard/right/when_created.rb +2 -1
  152. data/tmpsets/set/mod007-05_standard/right/when_last_edited.rb +2 -1
  153. data/tmpsets/set/mod007-05_standard/rstar/rules.rb +2 -1
  154. data/tmpsets/set/mod007-05_standard/self/account_links.rb +2 -1
  155. data/tmpsets/set/mod007-05_standard/self/alerts.rb +2 -1
  156. data/tmpsets/set/mod007-05_standard/self/all.rb +2 -1
  157. data/tmpsets/set/mod007-05_standard/self/foot.rb +2 -1
  158. data/tmpsets/set/mod007-05_standard/self/head.rb +2 -2
  159. data/tmpsets/set/mod007-05_standard/self/navbox.rb +2 -1
  160. data/tmpsets/set/mod007-05_standard/self/now.rb +2 -1
  161. data/tmpsets/set/mod007-05_standard/self/recent.rb +2 -1
  162. data/tmpsets/set/mod007-05_standard/self/search.rb +2 -1
  163. data/tmpsets/set/mod007-05_standard/self/signin.rb +45 -36
  164. data/tmpsets/set/mod007-05_standard/self/stats.rb +2 -1
  165. data/tmpsets/set/mod007-05_standard/self/version.rb +2 -1
  166. data/tmpsets/set/mod007-05_standard/type/basic.rb +2 -1
  167. data/tmpsets/set/mod007-05_standard/type/cardtype.rb +2 -1
  168. data/tmpsets/set/mod007-05_standard/type/date.rb +2 -1
  169. data/tmpsets/set/mod007-05_standard/type/file.rb +11 -3
  170. data/tmpsets/set/mod007-05_standard/type/image.rb +2 -1
  171. data/tmpsets/set/mod007-05_standard/type/layout_type.rb +2 -1
  172. data/tmpsets/set/mod007-05_standard/type/number.rb +2 -1
  173. data/tmpsets/set/mod007-05_standard/type/phrase.rb +2 -1
  174. data/tmpsets/set/mod007-05_standard/type/search_type.rb +70 -64
  175. data/tmpsets/set/mod007-05_standard/type/session.rb +2 -1
  176. data/tmpsets/set/mod007-05_standard/type/set.rb +2 -1
  177. data/tmpsets/set/mod007-05_standard/type/signup.rb +96 -64
  178. data/tmpsets/set/mod007-05_standard/type/toggle.rb +2 -1
  179. data/tmpsets/set/mod007-05_standard/type/uri.rb +2 -1
  180. data/tmpsets/set/mod007-05_standard/type/user.rb +50 -40
  181. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/form.rb +2 -1
  182. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +2 -1
  183. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +2 -1
  184. data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +2 -1
  185. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_cards.rb +2 -1
  186. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_js.rb +2 -1
  187. data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +2 -1
  188. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_css.rb +2 -1
  189. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_js.rb +2 -1
  190. metadata +2 -2
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Session; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/session.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Session; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/session.rb ~~~~~~~~~~~
3
4
  include Pointer
4
5
 
5
6
  def history?
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Set; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/set.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Set; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/set.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
6
 
@@ -1,82 +1,115 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Signup; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/signup.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Signup; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/signup.rb ~~~~~~~~~~~
3
4
 
4
5
  format :html do
5
-
6
6
  def default_new_args args
7
7
  super args
8
8
  args.merge!(
9
- optional_help: :show, #, optional_menu: :never
10
- buttons: button_tag( 'Submit', disable_with: 'Submitting', situation: 'primary' ),
11
- account: card.fetch( trait: :account, new: {} ),
12
- title: 'Sign up',
13
- hidden: {
9
+ optional_help: :show, # , optional_menu: :never
10
+ buttons: button_tag(' Submit',
11
+ disable_with: 'Submitting', situation: 'primary'),
12
+ account: card.fetch(trait: :account, new: {}),
13
+ title: 'Sign up',
14
+ hidden: {
14
15
  success: (card.rule(:thanks) || '_self'),
15
16
  'card[type_id]' => card.type_id
16
17
  }
17
18
  )
19
+ return unless Auth.signed_in? && args[:account].confirm_ok?
20
+ invite_args args
21
+ end
18
22
 
19
- if Auth.signed_in? and args[:account].confirm_ok?
20
- args[:title] = 'Invite'
21
- args[:buttons] = button_tag 'Send Invitation', situation: 'primary'
22
- args[:hidden][:success] = '_self'
23
- end
23
+ def invite_args args
24
+ args.merge!(
25
+ title: 'Invite',
26
+ buttons: button_tag('Send Invitation', situation: 'primary'),
27
+ hidden: { success: '_self' }
28
+ )
24
29
  end
25
30
 
26
31
  view :new do |args|
27
- #FIXME - make more use of standard new view?
32
+ # FIXME: make more use of standard new view?
28
33
 
29
- frame_and_form :create, args, 'main-success'=>"REDIRECT" do
34
+ frame_and_form :create, args, 'main-success' => 'REDIRECT' do
30
35
  [
31
- _render_name_formgroup( help: 'usually first and last name' ),
32
- _optional_render( :account_formgroups, args),
33
- ( card.structure ? edit_slot : ''),
34
- _optional_render( :button_formgroup, args )
36
+ _render_name_formgroup(help: 'usually first and last name'),
37
+ _optional_render(:account_formgroups, args),
38
+ (card.structure ? edit_slot : ''),
39
+ _optional_render(:button_formgroup, args)
35
40
  ]
36
41
  end
37
42
  end
38
43
 
39
-
40
44
  view :account_formgroups do |args|
41
45
  sub_args = { structure: true }
42
46
  sub_args[:no_password] = true if Auth.signed_in?
43
- Auth.as_bot { subformat( args[:account] )._render :content_formgroup, sub_args } #YUCK!!!!
47
+ Auth.as_bot do
48
+ subformat(args[:account])._render :content_formgroup, sub_args
49
+ end # YUCK!!!!
44
50
  end
45
51
 
46
-
47
- view :core do |args|
48
- headings, links = [], []
49
- if !card.new_card? #necessary?
50
- by_anon = card.creator_id == AnonymousID
51
- headings << %(<strong>#{ card.name }</strong> #{ 'was' if !by_anon } signed up on #{ format_date card.created_at })
52
- if account = card.account
53
- token_action = 'Send'
54
- if account.token.present?
55
- headings << "A verification email has been sent #{ "to #{account.email}" if account.email_card.ok? :read }"
56
- token_action = 'Resend'
57
- end
58
- if account.confirm_ok?
59
- links << link_to( "#{token_action} verification email", card_path("update/~#{card.id}?approve_with_token=true" ) )
60
- links << link_to( "Approve without verification", card_path("update/~#{card.id}?approve_without_token=true") )
61
- end
62
- if card.ok? :delete
63
- links << link_to( "Deny and delete", card_path("delete/~#{card.id}") )
64
- end
65
- headings << links * '' if links.any?
66
- else
67
- headings << "ERROR: signup card missing account"
68
- end
52
+ view :core do |_args|
53
+ return if card.new_card? # necessary?
54
+ headings = []
55
+ by_anon = card.creator_id == AnonymousID
56
+ headings << %(
57
+ <strong>#{ card.name }</strong> #{ 'was' if !by_anon } signed up on
58
+ #{ format_date card.created_at }
59
+ )
60
+ if (account = card.account)
61
+ headings += verification_info account
62
+ else
63
+ headings << 'ERROR: signup card missing account'
69
64
  end
70
- %{<div class="invite-links">
71
- #{ headings.map { |h| "<div>#{h}</div>"} * "\n" }
65
+ <<-HTML
66
+ <div class="invite-links">
67
+ #{ headings.map { |h| "<div>#{h}</div>" }.join "\n" }
72
68
  </div>
73
69
  #{ process_content render_raw }
74
- }
70
+ HTML
71
+ end
72
+
73
+ def verification_info account
74
+ headings = []
75
+ token_action = 'Send'
76
+ if account.token.present?
77
+ headings << 'A verification email has been sent ' \
78
+ "#{ "to #{account.email}" if account.email_card.ok? :read }"
79
+ token_action = 'Resend'
80
+ end
81
+ links = verification_links account, token_action
82
+ headings << links * '' if links.any?
83
+ headings
84
+ end
85
+
86
+ def verification_links account, token_action
87
+ links = []
88
+ if account.confirm_ok?
89
+ links << link_to(
90
+ "#{token_action} verification email",
91
+ card_path("update/~#{card.id}?approve_with_token=true")
92
+ )
93
+ links << link_to(
94
+ 'Approve without verification',
95
+ card_path("update/~#{card.id}?approve_without_token=true")
96
+ )
97
+ end
98
+ if card.ok? :delete
99
+ links << link_to('Deny and delete', card_path("delete/~#{card.id}"))
100
+ end
101
+ links
75
102
  end
76
103
  end
77
104
 
78
- event :activate_by_token, before: :approve, on: :update, when: proc{ |c| c.has_token? } do
79
- result = account ? account.authenticate_by_token( @env_token ) : "no account associated with #{name}"
105
+ event :activate_by_token, before: :approve, on: :update,
106
+ when: proc { |c| c.has_token? } do
107
+ result = if account
108
+ account.authenticate_by_token(@env_token)
109
+ else
110
+ "no account associated with #{name}"
111
+ end
112
+
80
113
  case result
81
114
  when Integer
82
115
  abort :failure, 'no field manipulation mid-activation' if subcards.present?
@@ -98,18 +131,23 @@ def has_token?
98
131
  end
99
132
 
100
133
  event :activate_account do
101
- subcards['+*account'] = {'+*status'=>'active'}
134
+ add_subfield :account
135
+ subfield(:account).add_subfield :status, content: 'active'
102
136
  self.type_id = Card.default_accounted_type_id
103
137
  account.send_welcome_email
104
138
  end
105
139
 
106
- event :approve_with_token, on: :update, before: :approve, when: proc {|c| Env.params[:approve_with_token] } do
140
+ event :approve_with_token,
141
+ on: :update, before: :approve,
142
+ when: proc { Env.params[:approve_with_token] } do
107
143
  abort :failure, 'illegal approval' unless account.confirm_ok?
108
144
  account.reset_token
109
145
  account.send_account_verification_email
110
146
  end
111
147
 
112
- event :approve_without_token, on: :update, before: :approve, when: proc {|c| Env.params[:approve_without_token] } do
148
+ event :approve_without_token,
149
+ on: :update, before: :approve,
150
+ when: proc { Env.params[:approve_without_token] } do
113
151
  abort :failure, 'illegal approval' unless account.confirm_ok?
114
152
  activate_account
115
153
  end
@@ -120,31 +158,25 @@ event :resend_activation_token do
120
158
  Env.params[:success] = {
121
159
  id: '_self',
122
160
  view: 'message',
123
- message: "Sorry, this token has expired. Please check your email for a new password reset link."
161
+ message: 'Sorry, this token has expired. ' \
162
+ ' Please check your email for a new password reset link.'
124
163
  }
125
164
  end
126
165
 
127
166
  def signed_in_as_me_without_password?
128
- Auth.signed_in? && Auth.current_id==id && account.password.blank?
167
+ Auth.signed_in? && Auth.current_id == id && account.password.blank?
129
168
  end
130
169
 
131
- event :redirect_to_edit_password, on: :update, after: :store, when: proc {|c| c.signed_in_as_me_without_password? } do
170
+ event :redirect_to_edit_password,
171
+ on: :update, after: :store,
172
+ when: proc { |c| c.signed_in_as_me_without_password? } do
132
173
  Env.params[:success] = account.edit_password_success_args
133
174
  end
134
175
 
135
- event :preprocess_account_subcards, before: :process_subcards, on: :create do
136
- #FIXME: use codenames!
137
- email, password = subcards.delete('+*account+*email'), subcards.delete('+*account+*password')
138
- subcards['+*account'] ||={}
139
- subcards['+*account']['+*email'] = email if email
140
- subcards['+*account']['+*password' ]=password if password
141
- end
142
-
143
176
  event :act_as_current_for_extend_phase, before: :extend, on: :create do
144
- Auth.current_id = self.id
177
+ Auth.current_id = id
145
178
  end
146
179
 
147
180
 
148
-
149
181
  # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/signup.rb ~~~~~~~~~~~
150
182
  end;end;end;end;
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Toggle; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/toggle.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Toggle; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/toggle.rb ~~~~~~~~~~~
3
4
 
4
5
  view :core do |args|
5
6
  case card.raw_content.to_i
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module Uri; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/uri.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module Uri; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/uri.rb ~~~~~~~~~~~
3
4
  format do
4
5
  include Phrase::Format
5
6
 
@@ -1,46 +1,59 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Type; module User; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/user.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Type; module User; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/user.rb ~~~~~~~~~~~
3
4
 
4
5
  include Basic
5
6
 
6
7
  attr_accessor :email
7
8
 
8
9
  format :html do
9
-
10
- view :setup, tags: :unknown_ok, perms: lambda { |r| Auth.needs_setup? } do |args|
11
- help_text = '<h3>To get started, set up an account.</h3>'
12
- if Card.config.action_mailer.perform_deliveries == false
13
- help_text += '<br>WARNING: Email delivery is turned off. Change settings in config/application.rb to send sign up notifications.'
10
+ view :setup, tags: :unknown_ok,
11
+ perms: lambda { |_r| Auth.needs_setup? } do |args|
12
+ account = card.fetch trait: :account, new: {}
13
+ Auth.as_bot do
14
+ frame_and_form :create, args do
15
+ [
16
+ _render_name_formgroup(help: 'usually first and last name'),
17
+ subformat(account)._render(:content_formgroup, structure: true),
18
+ _render_button_formgroup(args)
19
+ ]
20
+ end
14
21
  end
15
- args.merge!( {
22
+ end
23
+
24
+ def default_setup_args args
25
+ args.merge!(
16
26
  title: 'Welcome, Wagneer!',
17
27
  optional_help: :show,
18
28
  optional_menu: :never,
19
29
  help_text: help_text,
20
- buttons: button_tag( 'Set up', disable_with: 'Setting up', situation: 'primary' ),
30
+ buttons: setup_button,
21
31
  hidden: {
22
32
  success: "REDIRECT: #{ Card.path_setting '/' }",
23
33
  'card[type_id]' => Card.default_accounted_type_id,
24
- 'setup'=>true
34
+ 'setup' => true
25
35
  }
26
- } )
27
-
28
- account = card.fetch trait: :account, new: {}
36
+ )
37
+ end
29
38
 
30
- Auth.as_bot do
31
- frame_and_form :create, args do
32
- [
33
- _render_name_formgroup( help: 'usually first and last name' ),
34
- subformat(account)._render( :content_formgroup, structure: true ),
35
- _render_button_formgroup( args )
36
- ]
37
- end
39
+ def help_text
40
+ text = '<h3>To get started, set up an account.</h3>'
41
+ if Card.config.action_mailer.perform_deliveries == false
42
+ text += <<-HTML
43
+ <br>WARNING: Email delivery is turned off.
44
+ Change settings in config/application.rb to send sign up notifications.'
45
+ HTML
38
46
  end
47
+ text
39
48
  end
40
- end
41
49
 
50
+ def setup_button
51
+ button_tag 'Set up', disable_with: 'Setting up', situation: 'primary'
52
+ end
53
+ end
42
54
 
43
- event :setup_as_bot, before: :check_permissions, on: :create, when: proc{ |c| Card::Env.params[:setup] } do
55
+ event :setup_as_bot, before: :check_permissions, on: :create,
56
+ when: proc { Card::Env.params[:setup] } do
44
57
  abort :failure unless Auth.needs_setup?
45
58
  Auth.as_bot
46
59
  # we need bot authority to set the initial administrator roles
@@ -48,31 +61,28 @@ event :setup_as_bot, before: :check_permissions, on: :create, when: proc{ |c| Ca
48
61
  # flexibility and security when configuring initial setups
49
62
  end
50
63
 
51
- event :setup_first_user, before: :process_subcards, on: :create, when: proc{ |c| Card::Env.params[:setup] } do
52
- subcards['signup alert email+*to'] = name
53
- subcards['+*roles'] = { content: Card[:administrator].name }
54
-
55
- email, password = subcards.delete('+*account+*email'), subcards.delete('+*account+*password')
56
- subcards['+*account'] = { '+*email'=>email, '+*password'=>password }
64
+ event :setup_first_user, before: :process_subcards, on: :create,
65
+ when: proc { Card::Env.params[:setup] } do
66
+ add_subcard 'signup alert email+*to', content: name
67
+ add_subfield :roles, content: Card[:administrator].name
57
68
  end
58
69
 
59
- event :signin_after_setup, before: :extend, on: :create, when: proc{ |c| Card::Env.params[:setup] } do
60
- Card.cache.delete Auth::NEED_SETUP_KEY
70
+ event :signin_after_setup, before: :extend, on: :create,
71
+ when: proc { Card::Env.params[:setup] } do
61
72
  Auth.signin id
62
73
  end
63
74
 
64
- def follow follow_name, option = '*always'
65
- if (card = Card.fetch(follow_name)) && (set_card = card.default_follow_set_card)
66
- if (follow_rule = Card.fetch(set_card.follow_rule_name(name), new: {}))
67
- follow_rule.drop_item "*never"
68
- follow_rule.add_item option
69
- follow_rule.save!
70
- end
71
- end
75
+ def follow follow_name, option='*always'
76
+ return unless
77
+ (card = Card.fetch follow_name) &&
78
+ (set_card = card.default_follow_set_card) &&
79
+ (follow_rule_name = set_card.follow_rule_name(name)) &&
80
+ (follow_rule = Card.fetch follow_rule_name, new: {})
81
+ follow_rule.drop_item '*never'
82
+ follow_rule.add_item option
83
+ follow_rule.save!
72
84
  end
73
85
 
74
86
 
75
-
76
-
77
87
  # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/05_standard/set/type/user.rb ~~~~~~~~~~~
78
88
  end;end;end;end;
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module All; module Bootstrap; module Form; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/bootstrap/form.rb ~~~~~~~~~~~
2
+ class Card; module Set; module All; module Bootstrap; module Form; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/bootstrap/form.rb ~~~~~~~~~~~
3
4
  format :html do
4
5
  def button_tag content_or_options = nil, options = {}, &block
5
6
  bootstrapify_button( block_given? ? content_or_options : options )
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module All; module Bootstrap; module Helper; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/bootstrap/helper.rb ~~~~~~~~~~~
2
+ class Card; module Set; module All; module Bootstrap; module Helper; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/bootstrap/helper.rb ~~~~~~~~~~~
3
4
  format :html do
4
5
  def glyphicon icon_type, extra_class=''
5
6
  content_tag(:span, '', class: "glyphicon glyphicon-#{icon_type} #{extra_class}", 'aria-hidden'=>true)
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module All; module Bootstrap; module Wrapper; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/bootstrap/wrapper.rb ~~~~~~~~~~~
2
+ class Card; module Set; module All; module Bootstrap; module Wrapper; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/bootstrap/wrapper.rb ~~~~~~~~~~~
3
4
  format :html do
4
5
 
5
6
  def frame args={}, &block
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module All; module RichBootstrap; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/rich_bootstrap.rb ~~~~~~~~~~~
2
+ class Card; module Set; module All; module RichBootstrap; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/all/rich_bootstrap.rb ~~~~~~~~~~~
3
4
  format :html do
4
5
 
5
6
  view :closed do |args|
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module BootstrapCards; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/self/bootstrap_cards.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module BootstrapCards; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/self/bootstrap_cards.rb ~~~~~~~~~~~
3
4
  view :raw do |args|
4
5
  File.read "#{Cardio.gem_root}/mod/06_bootstrap/lib/stylesheets/#{card.codename}.scss"
5
6
  end
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module BootstrapJs; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/self/bootstrap_js.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module BootstrapJs; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/self/bootstrap_js.rb ~~~~~~~~~~~
3
4
  view :raw do |args|
4
5
  [ "bootstrap.js", "bootstrap_modal_wagn.js" ].map do |name|
5
6
  File.read "#{Cardio.gem_root}/mod/06_bootstrap/lib/javascript/#{name}"
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
- class Card; module Set; module Self; module BootswatchShared; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/self/bootswatch_shared.rb ~~~~~~~~~~~
2
+ class Card; module Set; module Self; module BootswatchShared; extend Card::Set
3
+ # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/06_bootstrap/set/self/bootswatch_shared.rb ~~~~~~~~~~~
3
4
  view :raw do |args|
4
5
  bootstrap_path = "#{Cardio.gem_root}/mod/06_bootstrap/lib/stylesheets/bootstrap"
5
6